This post is part of a series of blog
posts and videos about the Task-It (task management) application that I
have been building with Silverlight 4 and Telerik's RadControls for
Silverlight 4. For a full index of these resources, please go here.
One of the posts listed in the index provides a full source download
for the application.
One of the frameworks that I chose to leverage in the development of my Silverlight 4 Task-It application is MEF, the Managed Extensibility Framework. Actually, that decision came while I was at a Silverlight ‘Deep Dive’ session on the Microsoft campus in Redmond, WA, and came at the recommendation of John Papa (Microsoft Silverlight Evangelist) and Glenn Block (the “MEF Maniac”).
If you are not familiar with MEF, its primary function is to provide a framework for extensibility in Silverlight applications, however, what I found is that MEF's capabilities go beyond just this. As a matter of fact, Microsoft announced at MIX this week that its new Silverlight Analytics Framework would use MEF for composition. You can read about Telerik's support for this new framework here:
MEF used to be just one of many frameworks out there that could fill a need for Silverlight application developers, but as of Silverlight 4 it is now built right into the Silverlight framework.
Two of the primary concerns I had going into Microsoft’s Silverlight ‘Deep Dive’ were:
As my application was growing in size, I knew I was getting to the point where I should think about modularizing it…breaking it into smaller pieces. The load time of the app was becoming slower and slower, which is certainly a concern from a user experience perspective, but it was also taking quite a while just for my app to start up in VisualStudio.
I hit Ctrl+F5 or F5 in VisualStudio many times each day as I’m developing the app. The longer the wait time before the app appears in my browser, the more ‘dead’ time I have each day. Not enough time to grab coffee, but enough time for my brain to wander off, and then I have to remember why I started it up to begin with…what was the change I just made that I wanted to check?
Right now my app has 4 main pages. As the user enters a page and performs some actions, the page is naturally in a state that is a bit different from when they entered it. Now what if they leave the page and come back? How could I put the page back in the same state it was when they left? This is very basic stuff, so I know there will be a lot of other developers out there wondering the same thing.
For those of you that have some level of familiarity with Prism you may be asking “why didn’t you just use Prism for this?” The reason I chose MEF is that Prism is great for very large applications where the number of pages goes into the 50-100+ range. My app is not that large. Prism is also great for situations where a large team of developers is building the app, and this team can be broken into smaller teams that each focus on a separate module of the application. With Task-It, I am the sole developer, so although Prism could’ve also done the job, for my app it was overkill.
There are a lot of frameworks out there, and sometimes it’s just a matter of finding the right one for your situation.
I had heard of MEF, and knew it had a lot to offer to an application that required some level of extensibility, but what I didn’t realize is that it could solve both of my concerns.
In my next three posts I will explain how MEF solved the two concerns mentioned above, and will add links to those posts here when they are complete.