Some of you may be wondering why I went MIA for for about 8 weeks. Obviously, I got busy. There were two forces sucking up all my time over the last couple months. The largest one was a complete rewrite of the some of the functionality in the digital locker. The existing code base in the digital locker (and pretty much all of Windows Marketplace) is extremely monolithic. As a monolithic block of code it is extremely difficult to fully comprehend, enhance both tactically and strategically and it is completely impossible to unit test.
Since I was tasked with this very large feature modification for the digital locker, I took the opportunity to go out and learn the latest in web application design especially as it relates to UI. This was vital since I've never really drilled down into UI design and how it should interact with data. You can actually see me starting the learning process back here on August 26th. It was pretty clear (at that point in time) that Model View Presenter (MVP) was the predominant leader in UI design for ASP.NET based web applications.
Yesterday, I presented my two months of learning about the "best way to design web applications" to my team in an hour+ meeting. The functionality for the digital locker is basically complete and we are into integration testing so I had plenty of code to reference throughout the presentation. Unfortunately, I don't feel comfortable sharing the code with the outside world so instead, I'm going to share the links that I found most useful to learn about MVP and how to use it in ASP.NET based web applications.
Phil Haack had two great blog posts that where at exactly the right level of complexity when I first started.
- http://haacked.com/archive/2006/08/09/ASP.NETSupervisingControllerModelViewPresenterFromSchematicToUnitTestsToCode.aspx - this is a nice overview of how we approached things for the digital locker improvements. We do some of the smaller details differently (for example our Views use an Update method to get data out of the view into the model) but it is a very easy to understand overview.
- http://haacked.com/archive/2006/06/23/usingrhinomockstounittesteventsoninterfaces.aspx - this is where I first discovered Rhino Mocks. This has a pretty nice overview. Mocking just takes a little bit of playing with it to really understand it.
At the same time I was reading through Phil's comments, I was looking for more detailed information. Billy McCafferty showed up a number of times and these two links where referenced much as I tried to be understand the minutiae of MVP.
- http://www.codeproject.com/aspnet/ModelViewPresenter.asp - this is a really long article that covers lots of information in depth. I read this about 5 times before it all started making sense. The first overview above is a nicer introduction but this has lots of good detail.
- http://devlicio.us/blogs/billy_mccafferty/archive/2007/03/19/considering-a-view-s-get-set-roles-with-mvp.aspx - this is where the view’s get/set discussion happens. We’re attempting to use the View.Update method he describes in this entry.
While I was creating my presentation for yesterday I found the following blog entry. I so wish I had found this earlier.
- http://blogs.infragistics.com/blogs/tsnyder/archive/2007/10/17/mvc-or-mvp-pattern-whats-the-difference.aspx - this provides a really nice graphical representation of one concept that took me a while time to truly grok.
Those top four links made up the bulk of my reading and re-reading over and over. The following links were stuff I kept being looped back to so reading them is encouraged but I liked the way the information was presented above far better.
- http://martinfowler.com/eaaDev/SupervisingPresenter.html - this is the actual pattern we are implementing. MVP actually started here: http://martinfowler.com/eaaDev/ModelViewPresenter.html
- http://msdn.microsoft.com/msdnmag/issues/06/08/DesignPatterns/default.aspx - an MSDN article that I never really liked. It’s worth a read but don’t get too hung up on it. The stuff above is far better.
- Random other interesting pages:
Now, on October 14th Scott Guthrie announced a new MVC framework for AS.NET. I am extremely excited about what they are doing here because when I first started reading about UI design in ASP.NET it was clear that the "state of the art" was being kinda' kludged into the ASP.NET Page/PostBack system. There were moments when I wondered what it would take to move the digital locker to Ruby on Rails. <smile/> MVP ended up working out just fine but it is great to see ASP.NET adapting to support MVC and TDD more natively.
Anyway, we have a decent infrastructure in place now. When the ASP.NET MVC Framework is finally released I'll have a hard decision to make about what to do with our existing architecture. In the meantime, there is plenty of work to do and I'm now in position to pursue 95% code coverage with my unit tests (something that was completely impossible before).