Wednesday, February 18, 2009

Windows Presentation Foundation: New composite app framework

It's an exciting day for WPF (ok, for me at least). Today, The new Composite Application Guidance for WPF was released (Feb 2009). You can grab it here: http://msdn.microsoft.com/en-us/library/dd458809.aspx

So what is this? Basically, if you're building any type of UI-driven application, you have a few choices for wiring up your "View" to the underlying logic driving the view. Here are two:
  • Inline. This is where you jam all your code in the "code-behind." For instance: the user clicks a button, that button has a button_clicked() event handler, and you shove a bunch of code right into that event handler.
  • Model-View-Controller (or some derivative). This is where the "view" is limited to the UI portion of your app - buttons, boxes, etc. In the code-behind, you make a call to a "controller," notifying it that something happened (like HEY - THE USER CLICKED ME, THE SAVE BUTTON!!!). Then it's up to the controller to ask the view for stuff (like the info the user typed in) and save it to the model (maybe a database or something).
So the first step in cleaning up all those fat, monolithic apps of yours is moving from an inline model to an MVC model. Now... let's take it one step further: What happens when you start adding functionality to this big app, but the new functionality is relatively independent of the existing functionality? For instance, what if you have an order entry app, but you want the ability to view reports related to ordering, which has nothing to do with entry? And what if you want to build these modules in isolation, and test in isolation? And what if you have a whole bunch of these modules, and you'd like to pick-n-choose which modules to load (or not load), maybe depending on which user is logged into the application?

This is where the Composite Application framework comes into play. It has an entire infrastructure for managing these modules in a loosely coupled way. A long time ago (a few years ago), Microsoft's Patterns and Practices team published a composite framework called the Smart Client Software Factory. This was for WinForms applications. Eventually a Web Client Software Factory was published. And now, with the advent of WPF, there's a composite application framework for it, too (though it's not a port - it's pretty much a rewrite). The framework for WPF is codenamed "Prism."

Version 1 was published last summer, and version 2 was published just this morning. I'll be digging into it and following up with another post, once I find some juicy tidbits to write about.

Tuesday, February 17, 2009

Welcome to my strange not-so-new world

Everything seems to be connected online these days. Emails, IM, social networking sites, photo galleries, blogs...I currently blog at rdaarchitecture.blogspot.com, but that's specifically for software architecture and related guidance. here, I can go beyond that and write about other interests as well, especially photography. We'll see how it goes.