Mike Taulty has published an excellent series of screencasts illustrating some of the ideas found in "Prism" or the "Composite Application Guidance" from the Patterns and Practices team that can be used to build Silverlight applications in a way that lends itself to testability and modularity.
In talking to customers building business applications with Silverlight I find that Prism (and it’s friend Unity) is frequently mentioned but not everyone has seen it and so I thought I would explore it myself and capture some of the results of that exploration here. – Mike Taulty
Mike starts off with some fairly basic code and starts making use of dependency injection and modularity:
- Part 1: Taking Sketched Code Towards Unity
- Part 2: Dependency Injection with Unity
- Part 3: Modularity with Prism
- Part 4: The Unity Bootstrapper
Next Mike moves that code into the Silverlight world and illustrates some specific areas of Prism:
- Part 5: Moving to a Modular Silverlight Project
- Part 6: Shells, Regions, Views
- Part 7: Commands
- Part 8: Loosely Coupled Events with Event Aggregation
- Part 9: Sharing Data via Region Contexts
Finally Mike brings some of these concepts together in a longer, more realistic example of a simple Email application built using the Prism framework – warning, this is a much longer session but I wanted something that draws things together:
Mike recommends that you watch the 10 screencasts in order but if that feels like too long a process or if you’re already very familiar with concepts like dependency injection and containers like Unity then perhaps watch the last screencast first and then refer back to the previous screencasts if certain areas need more illumination.
Mike has made the source code for Video 10 here for download as it’s a bigger set of source and something you might want to explore after the video – this does not necessarily represent "best practice" but is, instead, just meant to illustrate some of the Prism ideas.