P&P Releases PRISM 2.0
The Patterns & Practices group at Microsoft has released version 2.0 of the PRISM framework. PRISM is a framework you can use you easily build loosely coupled composed applications. This new version supports both WPF and Silverlight! That is totally awesome.
I believe that we should focus on only writing the code that only we can write, and to leverage frameworks and components to provide the infrastructure and cross cutting concerns for our systems. This is a key way to provide more value to your business, and to reduce costs and time. There are plenty of other ways, like TDD, agile, pairing, etc. But this post is about PRISM, and there are far more smarter people than I to learn about those other practices from.
PRISM helps you create modules in your application. For example, a screen might have a list of upcoming appointments, and a section highlighting some tasks the user has to accomplish before the selected appointment. Each of these pieces would be a component. But they aren’t directly tied together. The first instinct might be to refresh the view of the task list when the selected appointment is changed in the list. You might go off and write some glue code to do this. There are many applications that are created like this, and in some situations, this is ok.
But some applications need a greater degree of loose coupling. PRISM provides a sort of message bus within the application that allows the modules to communicate without being directly bound to each other. This is really useful when these components are accessing different systems, and presenting their information in a composed manner.
Another great reason to build a system in such a loosely coupled manner is when the modules are being developed in a disconnected way. Perhaps each component is coming from different teams, and they need a separate development process. Maybe the architect expects a great degree of enhancement by the business over several years, and they want an easy way to plug in new modules as the system grows. This could easily be used by an ISV in such a manner, when they often need to deploy customer specific customizations.
This componentization also benefits the testability of your codebase. When a system is well architected, and has the proper level of the component isolation, it becomes easier to test each component in a stand alone manner.
The great thing about PRISM is it will give you the most reuse of you code across both platforms.
If you are building line of business applications, especially in a services environment, you should take 20 minutes and check out PRISM. The kit comes with a full reference application called Stock Trader. It is built using the framework, and following the latest guidance on how to build composed applications.
Of course guidance is exactly that. As with all things architecture, it depends. You need to spend an hour reading about this, understand how it might fit into what you might be doing, and be prepared to bring out of your toolbox when an opportunity exists. The videos on Channel 9 make it really easy to understand how it can help you.
Channel 9 videos
http://channel9.msdn.com/shows/Continuum/Prismv2/
http://channel9.msdn.com/posts/akMSFT/
Because it is from P&P, and hosted on CodePlex, you get access to the source code. So if it is close to what you need, but you want to enhance it, or tweak it to suit your needs, by all means go ahead. To get the bits, and to read more about the framework, check out these sites:
Comments