Monday, February 08, 2010

Simple Prism Application Templates

This article describes a set of templates that I have written which are intended to help create simple WPF applications based on the Composite WPF Framework using the Prism libraries. Why write these templates when there are already templates available, e.g., Calcium? This is a very valid question. There are a number of reasons.

How many times do you have the need to create a simple application either at work or home? This could be a small utility you are creating, a prototype application to prove some new functionality / concept, or some code just to experiment with Prism etc. You know that you would like to use the Prism libraries to build it, but to be honest, you also know that to setup a Prism application from scratch, hooking the shell, infrastructure, and modules together, will take more time than you plan to spend creating the actual application. You could, of course, just take an existing Prism based application if you have one and throw out what you don't need, but this is not usually a clean way to go. The same applies if you use one of the existing Prism frameworks, e.g., Calcium.

What I need are a couple of VSTemplates that would allow me to create a Prism based application quickly and which will have a common format, e.g., Shell, Infrastructure, and modules that I could create quickly and that I could quickly instantiate, enabling me to focus on the task at hand. It is also important to me that they use the basic functionality of Prism without any adaptations. I don't want to have to learn a framework on a framework just to create my simple application. What I have read and learned from the web on Prism should just work out of the box. I also wanted to be able to add additional modules that would automatically wire themselves up, and have the flexibility to add new regions to the default shell.

The two VSTemplates described in this application provide just that. I don't, for one minute, compare these templates with the professional templates provided with Calcium. But my new templates have enabled me to create my simple applications quickly and with a standard architecture. They have also been useful for training and introducing new people to Prism concepts, allowing them to be able to prototype / test applications easily.

Although I have tried to incorporate many best practices when creating these templates, I have taken a pragmatic approach which not all people will support. For example, the MVVP modules created do have a reference to the view. Although none of the examples use it in favour of a more traditional MVVM, it is there should your simple application require it.

Read more: Codeproject

Posted via email from jasper22's posterous