Posted by: rcosic | 08/03/2010

My word on PRISM for WPF and Silverlight

Composite Application Guidance for WPF and Silverlight (aka PRISM) is a guide for developers that teach you how to build so-called composite application. In real life they represent LOB (line-of-business) modular, scalable and multitargeting applications. They are modular because they are built of modules – parts that can be easily added, modified and removed from the application functionality set. They are also multi-targeted, since the CAG is written to accommodate both WPF and Silverlight applications.

The guidance includes a vast set of handy stuff: a reference application (StockTrader) written in both WPF and Silverlight, a tutorial with QuickStarts, How-Tos, and, the most valuable – Composite Application Library.

Composite Application Library (CAL) is a set of assemblies that helps you build composite applications, and it is formed in a shape of well-known Microsoft’s application blocks. The library is very good written, all by the book, covered with unit and acceptance tests, and it confines with CA. The main benefit in using the library is that developers can now concentrate on their own specific tasks, and leave the infrastructure to CAL. You don’t have to worry about on how to shape a module, composite views, exception handling, logging, authorization, etc.., but rather make your business and UX-logic as you desired.

HowTo’s and QuickStarts help a lot, because creating and adapting the application is very easy and straightforward. I’ve passed all the materials in one grasp and I can tell that is really good written.

Design and technical concept is also very interesting. Not just it gives you an insight on what is used in the Framework, but it teaches you some of the patterns and principles used in current development on the way. For example, here are explained dependency injection (DI) and inversion of control (IoC) patterns (implemented in Unity Application Block), separated interface & composite view, service locator, command, adapter, event aggregator, separated presentation, facade pattern, registry.. It is exciting to see how all these pattern (for me, most of them presented just theory, and not practise) fit together in one peace! Great!

Maybe your implementation of the composite framework won’t be exactly as described, but it would certainly help you on how to make up your mind on choosing the right elements for the job. It definitely define the mindset on the composite approach, leveraging all the knowledge that you currently need (WPF / Silverlight) – XAML in general, views, commands and routed events, UI composition – PM, MVP, MVC and MVVP patterns, modularity with DI & IoC, and lots more…

Also the powerful benefit is multitargeting. Not just you could make the PRISM application on one platform (lets say, on a WPF), but you can easily port it on another platform as well (for instance, on a Silverlight). Most of the code is shared or linked to each of the projects (because of binary incompatible platforms), and it’s up to you to just make this empty cells with your platform-specific code. For example, you can easily reuse presenters, controllers, models, services, unit tests, and simple views. And then adapt only complex views (in XAML), specific controls, styling and animations.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: