9

My company is trying to make an informed decision about how to pursue future development.

We seem to have narrowed down our future internal and external Applications to being web applications. But we are still a bit confused from that point.

There is a large amount of support for Sharepoint here. As I understand it, Sharepoint is basically ASP.NET using MVP.

Others want to use normal ASP.NET using the newer MVC style.

I am also told that these don't easily play well together.

It is looking like Sharepoint (and ASP.NET MVP) is going to be the winner. Before we go that direction, I wanted to ask:

If we choose to base the next 5-10 years of our development efforts off of Sharepoint (ie ASP.NET and MVP) what are we giving up? And is it a big deal or just some "nice to haves" that we are loosing.

(It would have to be a fairly big deal to get management to change direction now.)

Ryan Kohn
  • 13,079
  • 14
  • 56
  • 81
Vaccano
  • 78,325
  • 149
  • 468
  • 850
  • 6
    SharePoint is not ASP.Net MVP. It can NOT be compared with MVC. From wikipedia: `Microsoft Sharepoint is a Web technology based server that can be used to build portals, collaboration sites, and also content management sites. It is very versatile in a number of features and support various enterprise and Web scenarios. It is also popular for document management solutions` – jgauffin Dec 07 '10 at 15:29
  • @Yuriy yes web client software factory was the MS implementation of MVP. It's very heavy to work with, and the last experience I had with it (around .NET 3.0 and no i do not mean 3.5) the project didn't even work at all it faced tons of basic IOC resolution failures from just trying to bind standard MVP pages. That's what lead me to create my MVP framework – Chris Marisic Dec 07 '10 at 15:39
  • 1
    To close the gap between your question about SharePoint=MVP vs. MVC and the answers about Webforms vs. MVC: The ASP.NET model used by SharePoint is called Webforms, not MVP. – chiccodoro Dec 07 '10 at 16:11
  • 1
    It's now been a year and a half since your decision. I suspect you took the *Sharepoint path*. Any regrets? BTW: Building web apps is not about choosing between MVC or Sharepoint. But rather between MVC and WebForms+MVP. Sharepoint is a completely different layer that's used in intranet environments mainly and for very special purposes. **Sharepoint is not a general web application development platform.** You must be regretting it big time if you thought of it that way. And your clients as well. – Robert Koritnik Jul 23 '12 at 08:54

5 Answers5

11

Whatever happens, WebForms will turn into a big ugly mess at some point. If you have to use webforms, don't use the postback and page lifycycle model - have aspx pages with presenters for get requests, and have a handler or empty aspx per post. It'll feel a lot more like MVC that way

mcintyre321
  • 12,996
  • 8
  • 66
  • 103
9

I would say that what you choose depends heavily upon who your developers are, and what kind of apps you intend to build.

If you build largely crud-like apps that make a lot of use of third party (or your own) custom controls, then staying with Webforms is probably a good idea.

If you build largely "web" style apps with lots of client-side functionality, then MVC is a much better choice.

If you have largely newbie developers, Webforms may be better. If you have more experienced developers, even if they're new to asp.net then MVC may be a better choice.

If you are building very data-centric applications with complex interconnections, then MVC may be a better choice.

There are lots of reasons why you might choose one or the other, and it's always "it depends on...".

Also, MVC and Webforms are not completely incompatible. You can't use them in the same page, but you can use both in the same site. Also, like the comment above says, Sharepoint is not Webforms or MVP per se.. it's kind of it's own thing that is based on webforms. It's very "Webpart" oriented, which is just a way of saying you build lots of custom controls.

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291
  • FWIW with some project file hacking I'm 90% sure you can run webforms and MVC concurrently if you really desired – Chris Marisic Dec 07 '10 at 20:53
  • @ChrisMarisic: I was personally able to integrate MVC into Sharepoint on some project that made it possible for me to develop a highly customized UI for a client in a modern and better way. – Robert Koritnik Jul 23 '12 at 08:56
2

If you are performing page post-backs to handle events, I would suggest MVP as the Presenter would contain the event handlers for all versions of the view (Different user interfaces such as web pages, iPhone, Android, Windows forms), with a uniform behavior. In other words, you would not need to write control events in a code-behind for every view. At least, they'd do nothing more than call the Presenter's event handler method or raise an event the Presenter handles.

If you are creating web applications and heavily using Ajax for page updates, with one or more web views and a cross-browser JavaScript library, such as jQuery, I would recommend MVC.

So it comes down to how you want to handle page events. MVP & MVC both have separation of concerns. MVP is more server based and easier to add multiple UI's and MVC is more client based, for event handling and more web centric.

2

I have been a strong proponent of Separation of Concern (SOC) being built into software whether you use MVVM, MVC or MVP all three patterns are quite nice. With this being completely specific to ASP.NET, I would state you should use MVC3.

I have been a .NET developer for years now and have written my MVP pattern that is built on top of StructureMap (lots on my blog about it) and for a while I never saw the benefit of dealing with the changes associated from leaving webforms to goto MVC. However after dealing with ASP.NET for so long I've just had it with ASP.NET webforms errors that are completely out of my control.

The main errors from webforms occur with the ViewState timing out resulting in the generic cryptographic exception and the 2nd is where the ViewState is just truncated by the client or post somehow resulting in legitimate cryptographic errors. With MVC these errors just aren't applicable anymore. With .NET4 I attempted to create a webforms application without ViewState with the new features they added in .NET4 and that completely didn't work which cemented by decision that webforms time is past.

Out of MVC, MVC2 and MVC3 the feature set that comes with the MVC3 and the Razor view-engine is the most robust. You get all of the enhancements that came with MVC2 along with the much cleaner Views that the Razor view engine lets you create, on top of that you get global action filters and the baked jQuery client side templating (I'm 90% sure).

I would also approach MVC very similarly to MVVM where I would have 3 distinct sets of entities, my view models, my domain entities and my physical database models. (The last set may, or may not be the domain entities, I've started to realize trying to make your pure domain entities work with your database layer can be suboptimal at advanced stages)

Chris Marisic
  • 32,487
  • 24
  • 164
  • 258
  • 2
    Try Spark View Engine. Views as they should be. – jgauffin Dec 07 '10 at 15:38
  • 1
    I'd rather use Razor and get full syntax highlighting / intellisense. – Chris Marisic Dec 07 '10 at 15:41
  • Tried to install the syntax highlighter / intellisense that is available for vstudio2010? – jgauffin Dec 07 '10 at 15:46
  • 1
    Wasn't aware of that existing, that might've made sense previously but with Razor why would I use Spark? – Chris Marisic Dec 07 '10 at 20:51
  • An observation to your last paragraph: It's usually best to have application/domain model that contains all entities as per your domain/app and data model that turns out to have some of its own models (quite many times inherited from domain ones because they have more fields), but view model entities usually only have a subset of domain ones, because they rarely use different data. The main thing is that domain model is the complete model both of the others are usually related to it. – Robert Koritnik Jul 23 '12 at 09:05
0

From my experience, a strongly enforced MVP pattern has been much better for data centric complex LOB applications.

MVP offers greater seperation as your presenters have no knowledge of web centric concepts. Code coverage is also increased as you have no conditional code in the views. We have several apps that where the presenter is used between both web and windows apps. You presenter referes to a complete abstraction of the view, asp.net MVC relies on abstractions of view dependants (HttpContextBase etc.)

That all said you need to design this into web forms, its not out of the box, but if you do it right first time and have developers that understand it and stick to it you end up with a very clean solution.

there are some solid frameworks out there to support MVP in webforms:

http://www.codeguru.com/csharp/.net/net_general/patterns/article.php/c15173

webformsmvp dot com as well.

En55
  • 1