Tuesday, October 12, 2010

Jounce Part 1: Why?

Over the next few weeks I will be publishing a series of posts explaining the open source Jounce project that I just released. Jounce provides guidance for building modular Silverlight applications using the Managed Extensibility Framework (MEF) and Model-View-ViewModel (MVVM).

Origins

I have been building enterprise Silverlight applications since late in the version 2.0 cycle. Many of these applications require extensibility: making it easy to add new screens or modules. The applications often require modularity as well, specifically to allow for dynamic loading of assemblies to reduce the initial memory footprint and impact on the client browser.

In addition, after trying Model-View-Controller (MVC) and experimenting with MVVM, I quickly found MVVM to be the right tool for my job. My background of developing mission critical applications for over a decade had already imposed the discipline of creating decoupled solutions that are easy to unit test and build in parallel to scale across large development teams. After exploring homegrown factory methods, Unity, and other patterns, I found that MEF really addressed most of my Silverlight needs out of the box.

The end result is that I've been using a common set of patterns across multiple applications. Developers know and understand the value of tools and macros. We're wasting our customers' time if and when we build something from scratch that has already been addressed, and this is why I constantly found myself sharing base classes, interfaces, and other core structures across various projects. I kept this basic framework factored separately to seed new projects and added to it as I encountered new challenges.

This framework is what I recently packaged as Jounce. It is similar to many MVVM frameworks because it provides messaging services and notify property changed handlers. It is different beacuse it does not attempt to abstract the underlying inversion of control - make no mistake: Jounce has a direct, explicit dependency on the Managed Extensibility Framework.

Why Should I Use Jounce?

I've been wanting to share Jounce for quite awhile but resisted because the last thing we need is "yet another framework." I was asked that exact question when I decided that all of my blog posts and examples just don't make as much sense without the context of the underlying framework they derive from.

The answer to the question is a simple one. "Don't."

I'm not trying to compete with the many other mature frameworks that are there. I like all of them. So why Jounce? I released Jounce less as a framework to package and solve all problems, and more as guidance for how I've found MEF can help solve MVVM problems in the Silverlight domain. It's a very specific niche, and I'm not trying to cover both Silverlight and WPF and the Windows Phone 7, nor abstract the notion of dependency injection containers. This is a very specific set of principles that I've used to successfully resolve challenges in a specific space.

The idea here is that you can pull down the source for a framework that is extremely lightweight - less than 1,000 lines of code. That's something you can dig into and look at inside and out. The license for Jounce allows you to use it right out of the box if you like, but my guess is that most people have far more specific needs for their framework than any package can provide "out of the box." For this reason, you are welcome to customize and modify Jounce or use the pieces that make sense for your project and toss the rest out.

Jounce is far more lightweight than Prism is and addresses fewer concerns. The Jounce implementation of the region management pattern takes only a few lines of code and isn't quite as powerful as Prism is ... but I've seldom needed that extra power. Jounce does not have automatic convention-based data-binding that Calburn and Caliburn.Micro provide, but again, I've found I prefer to use explicit data binding and design-time view models with a focus designer-developer workflow.

I've tried to note where a portion of Jounce was derived from another framework, both to give due credit and also to give you a place to explore further.

Some of the guiding principles behind Jounce:

How do I Get Started?

The full source code for Jounce is available at Codeplex. You can pull it down, compile, and get started. The framework has a web project with a simple view and view model. There are several quick starts that demonstrate navigation, regions, dynamic XAP loading, and more ... and I plan on adding others for the 1.0 release.

The power of Jounce I believe comes from the experience of using it. None of the quick starts took very long for me to create with no or minimal troubleshooting to make a feature work. That in my mind is the ideal goal of a framework: to be lightweight and easy to use, and easy to troubleshoot when things go sour. I believe Jounce exhibits all of this.

So in conclusion, Jounce is not the "next hot framework" that I'm begging you to download and use. I don't intend to come out with super cool feature-packed releases ... but if I find a better way to solve a problem or a new idea that pops up often, I will look at including that in the future.

In the next posts I'll start drilling into the details of how Jounce works. Much of this will be familiar to long time readers of my blog, with the difference that the ideas are encapsulated in a full reference framework rather than parceled into small "sample project" chunks.

Your feedback and suggestions are more than welcome!

Jeremy Likness

11 comments:

  1. Jeremy,

    Nice. After the P & P Symposium, I'll get into Jounce.

    Thanks for sharing your awesome work.

    Best,

    Karl

    ReplyDelete
  2. Finally I've found what I was looking for!

    ReplyDelete
  3. "Jounce is not the 'next hot framework' that I'm begging you to download and use. I don't intend to come out with super cool feature-packed releases"

    I like that! Yes, what we need is a simple and clearer problem solving stuff, and I'm sure you have got it right.

    ReplyDelete
  4. Hi,
    Thanks for sharing this great work.
    I like to use Jounce in LOB application.
    Have you a sample application ?

    Thanks

    ReplyDelete
  5. You're welcome! I don't have a large application yet but am looking into some reference ones ... thinking of maybe a Scrum manager that uses Jounce and Sterling - will keep everyone posted. There are plenty of quick starts included.

    ReplyDelete
  6. Hi, Jeremy.

    At last I show this cool framework.
    Thank you for sharing your nice work.
    I'll try to adapt some simple project.

    HK.Lee

    ReplyDelete
  7. I think I'll finally give these concepts a try now using Jounce. Thanks JLi

    ReplyDelete
  8. Hi Jeremy,
    Nice to see an open source framework from you. Is there is any plan to include PRISM for modularity, caching aspects. or you going to stick with MEF to do all the actions.

    ReplyDelete
  9. This is meant to be direct MVVM+MEF guidance, so no PRISM - although I do recommend people look at that as it is a much larger system that addresses far more scenarios.

    ReplyDelete
  10. Is there a way to extend Jounse with PRISM as a add-in, to leverage the benefits of prism for modularity and xap initialization part.

    Do you have any plans of extending PRISM as part of JOUNCE to make sure further enhacnements to PRISM is well consumed with in JOUNSE.

    ReplyDelete
  11. I hadn't intended to ... I find modularity using MEF works just fine without having to use the modules in PRISM, so didn't see the need to build those types of bridges.

    ReplyDelete