Monday, January 5, 2009

MVC with Silverlight - Frameworks review

For those that want to build large applications or are using TDD for all their projects, the MVC pattern is often used to make the presentation code more testable.
Almost every development platform have frameworks to assist developers when building MVC applications. With Flex, Cairngorm is the most popular I think but what about Silverlight?
If you don't like frameworks, you can just do MVC without using any but if you'd like to leverage a framework, I've found 3 frameworks:
  • Caliburn
    Pros:

    • Support Commands, Actions
    • Includes a simple Dependency Injection Container
    • Easy to use, use of XAML
    • Small documentation available
    • Extensible, you can use another DI Container if you want.
    Cons:
    • Alpha quality and not yet feature complete.
    Comments:

    I think it's a good framework, that's the one I've selected for a small ShowCase in Silverlight and so far I'm happy with it even if it's an alpha build.
  • MVC#
    Pros:

    • Support for tasks (aka use cases)
    • Same code for WinForm,Silverlight and ASP.net can be used to create 3 applications.
    Cons:

    • No direct support for XAML and declarative coding.
    • Not built for Silverlight only.
    Comments:

    Even if called MVC#, it uses the MVP (Model View Presenter) variation. The fact that it's built to support Winform, Silverlight and ASP.net make it harder to use and you need to write more code compared with the other frameworks. I think it has been built for LOB applications and not really for RIA.
  • Silverlight.FX
    Pros:

    • Part of Silverlight.FX
    • Supports declarative coding
    • Lightweight
    Cons:

    • Limited features
    • Limited documentation
    Comments:

    For those that already have a reference to silverlight.FX in their application and don't need a fancy framework it will work well. You can even extend it if you want. Needless to say that it has been created by Nikhil and just like the Silverlight.FX code in general you can learn things by reading the source code even if you don't use the framework.