ASP.NET MVC and the Future of Model View Presenter : Interview with Jeffery Palermo
- Listen now:
This show features an interview with Software Management Consultant and CTO of Headspring Systems, Jeffrey Palermo. Jeffery takes us through the current state of the ASP.NET MVC framework and explains how to construct an MVC website and delves into some of the relevent controls that make up the framework.
What is the ASP.NET MVC Framework?
The ASP.NET MVC Framework is a new effort from the ASP.NET team to adjust the architecture of web applications to more closely resemble what you find in MonoRail or even Ruby on Rails. The logical portions of a page are separated down natural lines of differentiation. Code responsible for "modeling" your domain is separated from code that handles interaction among busines objects which is still separate from code that presents data to the user. For more information about the Model-View-Control ler design pattern (MVC) please refer to the following resources:
- Scott Guthrie's articles on the ASP.NET MVC Framework
- Wikipedia Article on MVC
- MVC from Patterns of Enterprise Application Architecture
MVP in light of the ASP.NET MVC Framework
The rise in interest in the ASP.NET MVC Framework has many people wondering where the Model-View-Pre senter (MVP) pattern fits in to the mix. We have spent a lot of time on the Polymorphic Podcast thinking about MVP in not just one, but two podcasts and a series of 5 how-to screen casts.
Some interesting ideas are floating about on some podcasts and blogs lately regarding the purpose of ASP.NET MVC and the value of MVP. Further, I recently received this email from listener Buddy Stein trying to reconcile the ASP.NET MVC and MVP patterns:
You've made a convert of me to the MVP pattern, but after listening to your interview with Scott Hanselman, I couldn't help but think he's "drinking the Microsoft Kool-aid".
If the MS MVC framework only works with asp.net, then why bother? Just stick with code-behind and save the trouble.
Isn't the whole point of the extra MVP effort; that you can re-use your code for winforms and asp.net? If your coding to the lowest common demoninator by coding for both platforms as Scott states. Then please enlightenment me what we can't do in ASP.NET or Winforms because were using the MVP pattern.
Craig, If I'm wrong, tell me, but I'm a corporate developer and I'm convinced that the combination of MVP and TDD are the most professional approach to .NET programming today.
In response to Buddy's points, I suggest we consider the following:
- ASP.NET MVC is not mandatory: The ASP.NET team is
working hard on making the MVC Framework the best it can be, but it is not a
replacement for WebForms. If your application is better suited as a
traditional WebForms project, by all means use it.
- ASP.NET MVC is about more control: The changes we see
coming up in the MVC framework is increased control in your site's URLs,
cleaning up HTML with the ditching of ViewState, coming out from under web
controls and letting the developer easily dictacte the HTML sent to the
browser. On top of all of this you have true testibility of the UI for the
first time in Microsoft web technologies. The reasons to use ASP.NET MVC are
more compelling than a mere replacement of code-behind.
- Theory is different than practice: One of the
questions I had for a long time when ASP.NET MVC came out was, "Why
target an MVC framework to ASP.NET?" Scott Hanselman makes an interesting point
interview where he basically states that an MVC framework fine tuned for
the web may not pay the same dividends in other environments.
While we would all like to write features that may be automatically re-purposed from windows to web and vice versa that is a tall order. True, MVP gives you the building blocks to create an controller you can use in any environment, but there is a lot of fine-tuning required to effectivley deal with state and resource management among the different environments.
- ASP.NET MVC & MVP can play nice: If you really
think about it the ASP.NET MVC Framework does is give you an alternative to
the traditional code-behind model. ASP.NET MVC is better separated and more
testable, but that doesn't mean you can not still implment a presenter
underneath the ASP.NET MVC controller class. Think that is overkill? For
some applications it's total crazy talk. If you have an enterprise
application that must weather the storm of changing technologies from
year-to-year, then you might want to consider it. Just stop of a second and
think about the lines of code you have stitting in WebForm code-behind
files... now if those pages were implmented using MVP how hard would it be
to make that site an ASP.NET MVC project if necessary?
What this all boils down to is that in the end you need to use the right tool for the right job... something I have advocated for a long time.
A Seriously Special Music Episode
As if the "Lambada" goof wasn't enough, this show I even more music for you! This show is packaged (at no extra cost) with "Seriously" from Greenleaf Avenue. Greenleaf's lead guitar player is one of my good friends Sol Rodriguez. Sol and his boys have entered a battle-of-the-bands type contest through a Los Angeles radio station.
If you like rock music I would love if you could take a minute and vote for "Seriously" from Greenleaf Avenue. You have heard some of Greenleaf's music peppered thoughout different episodes of the Polymorphic Podcast as bumper music.
Please note, the voting process does require a valid email and you have to click the confirmation link in the message they send you...
Try before you buy? You can check out a video the band produced for the song below...