This post originated from an RSS feed registered with .NET Buzz
by Udi Dahan.
Original Post: A Model, a view, and a presenter walk into a bar...
Feed Title: Udi Dahan - The Software Simplist
Feed URL: http://feeds.feedburner.com/UdiDahan-TheSoftwareSimplist
Feed Description: I am a software simplist. I make this beast of architecting, analysing, designing, developing, testing, managing, deploying software systems simple.
This blog is about how I do it.
I've been a proponent of MVP style UIs for some time. Most projects I'm "evangelizing" it to get it pretty quickly - except for how to handle application startup. So, I put together a little sample (with VS2005 beta 2 - don't ask) to demonstrate.
The idea is simple, the problematic main form becomes just a shell which views are loaded into. Microsoft's smart client baseline toolkit has one built in already (and I suggest you look into it). But, to keep things simple, I've create my own shell. The sample also uses Spring for dependency injection. I'll explain that a bit:
In order to keep the presenter independent of the view (winforms) implementation, we have an interface that separates them in a different package. So, since the presenter may still need to instantiate a new view at runtime, we use the abstract factory in Spring.