My old Intel buddy, Tim Heuer wrote an article I stumbled upon this weekend trying to learn Silverlight called
silverlight as a view in aspnet mvc. I'm pretty entrenched in MVC, but used MVP before and wanted to chime in on the "It's just another type of view" vs "We need a presenter" discussion.
I think that both sides are right, actually. Silverlight as used in Tim's sample
is just another view... And silverlight users
do probably need a presenter.
Why? Because I would wager that most folks aren't doing too much w/ their MVC views. They are just CRUDing data, and every action can be gloriously REST-ful because it doesn't do anything. Makes sense. That's certainly what all the MVC demos show. Besides, this is Html, CSS, javascript, and nearly 10 years of browser lunacy we're designing with here. Not exactly a killer UI platform, even with JQuery.
But... If you ARE trying to create a Web 2.0-ish site, MVC starts to expose you to some pain, because there is no facility available for testing those sophisticated interactions
1. The site becomes an application, complete with all of the pain that has always come with trying to create stateful components on a stateless platform. Unfortunately, that doesn't mean you can't create web apps. People like them. They're slick, fast, powerful.
So back to the conflict. Tim's point is that there's no difference between how he used Silverlight and a traditional HTML/AJAX view. And I agree. There isn't. HTML + AJAX callbacks amount to the exact same thing. But I think the issue at heart is higher than that. If you're going to write a website where Silverlight doesn't do any more for you than HTML did, then you're not using silverlight to its fullest potential.
Silverlight is supposed to help us create immersive, compeling web applications. As soon as you start using the full power of Silverlight (or Flash, HTML 5 etc.), then your views have logic in them, and are probably complex enough that you need to start testing them. At this point, the Presenter model starts to make a lot of sense, because it helps you isolate your view from the presentation layer's framework, making testing a lot easier.
-- One side note. Don't be fooled by the arguments that using presenters helps you use the same logic for different versions of your application. It's rarely true, because any application complex enough to need a sophisticated UI will have to be tuned for it's target medium. (Your presenter for a RIA probably won't work for for your mobile/offline/widget/facebook app because the user experience has to change). Presenters provide an effective testing solution, but that's really it as far as I've ever been able to tell.
1) Ok ok, there's Selenium, but as impressive of an engineering feat as it is, it's just not a great solution