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

    • 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.
    • Alpha quality and not yet feature complete.

    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#

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

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

    Even if called MVC#, it uses the MVP (Model View Presenter) variation. The fact that it's built to support Winform, Silverlight and 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

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

    • Limited features
    • Limited documentation

    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.