views:

392

answers:

3

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]
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)?

A: 

It's probably not popular, but it's also probably a good design practice.

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)?

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.

Robert Harvey
A: 

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: ARF

ArjanP
I was asking about the MVP pattern, not ASP.NET MVC. Although I think you're right, there are a lot more difficulties with using ASP.NET MVC in SharePoint.
Jon Schoning
A: 

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 SharePointMVC

Framework. This has a rather big disadvantage that you have to create a seperate WebApplication for it.

Vojtech Nadvornik
Thanks for your post! Good catch on the EditorPart. Yeah, I don't think MVC has a bright future with SharePoint. Thats why I was looking into possibilities with MVP.
Jon Schoning