Is it a popular techinque to use the Model View Presenter (MVP) design pattern when creating Web Parts for SharePoint? It seems (to me) that this pattern is applied more often in the custom application space. So, if you have any thoughts on this, please share...
[Edit]<br /> Perhaps the more important question is, if MVP is less popular in a SharePoint WebPart than in a custom application, why do you think this is (what <b>factors</b> contribute to this observation)?Answer1:
It's probably not popular, but it's also probably a good design practice.<blockquote>
Perhaps the more important question is, if MVP is less popular in a SharePoint WebPart than in a custom application, why do you think this is (what factors contribute to this observation)?</blockquote>
It is the "new" approach in the SharePoint world. Everyone is used to doing it the old SharePoint way. This is also true of ASP.NET and ASP.NET MVC.
MVC and MVP patterns are becoming more popular because they allow you to "decouple" the presentation layer from the underlying logic, essentially "uncomplicating" the UI.
Personally, I think anything that makes SharePoint an easier platform to program on is a welcome relief.Answer2:
Because SharePoint is not compatible with ASP.NET MVC? It's planned somewhere down the line.. e.g. you're doing a lot of plumbing yourself before you can get any functionality going and I imagine out of all web parts created for SharePoint most will not be very complex because they are likely to be only a small part of the complete -SharePoint- solution.
Here is someone who built something like it, sort of: <a href="http://www.spworks.co.uk/arf/default.aspx" rel="nofollow">ARF</a>Answer3:
I have developed some webparts for SharePoint using MVP Pattern and I find it pretty good from the point of testability. However I discovered following problem: If you have a webpart with custom EditorPart (the pane with custom properties) then the decoupling through MVP is not easily achievable, because the data from Toolpart is stored back to the WebPart.
Second thing: I do not think that the MVC pattern will be introduced into SharePoint soon (my oppinion I am not an insider), the impact would too big. However there exists an <a href="http://www.codeplex.com/SharePointMVC" rel="nofollow">SharePointMVC</a>
Framework. This has a rather big disadvantage that you have to create a seperate WebApplication for it.