5

Possible Duplicate:
MVC versus WebForms
ASP.NET MVC Performance

I'll be starting a new web project in the coming weeks. It's a public facing web site for a somewhat famous person. I have 2 choices: use good-old ASP.NET 4 or new ASP.NET MVC 3 with Razor.

I do not plan to do any kind of unit testing. It's rather simple website mainly consisting of javascript, html and css.

I'll need to build an admin panel to create/delete/edit pages; add/remove pictures to portfolio gallery. And that's probably all I need from an admin panel. Nothing complicated.

Disclaimer: I do not have much experience with either Webforms or MVC, other than what I have learned from Pluralsight Training and ASP.NET Official Tutorials. I do have intermediate knowledge of css and html; no experience with javascript. But given how javascript is so similar to other OOP languages I am not too worried if I have to get my hands dirty with JS.

  • In terms of development speed, which would be faster: WebForms or MVC?
  • How about out-of-box performance between the two?
  • In a long term which would be easier to maintain?

If you advise against starting a web project from scratch, perhaps you could recommend a light ASP.NET CMS instead?

2
  • You're asking at least three questions here, and by combining them you make this nearly - if not completely - too localized. However, the key individual questions have already been asked and answered, if you care to look around for them... If you can't find an answer in one of these existing questions, post a new one that doesn't duplicate what's already been asked.
    – Shog9
    Jun 3, 2011 at 3:59
  • 2
    I really hate when I do a google search only to find the answer to be "look around for them".
    – SixOThree
    Jul 30, 2012 at 18:28

6 Answers 6

14

In terms of development speed, which would be faster: webforms or mvc?

This depends on many factors, but suppose that you use eqal technologies both with webforms and mvc then mvc should be faster. Webforms has some overhead because of the mismatch between how things really work (eg. that http is stateless) and what is assumed while writing the code (you're programming as if the application was stateful)

In a long term which would be easier to maintain?

IMO MVC is easier to maintain, because it's easier to change bare html/js code, the model(MVC) is well defined which makes it less painful for a new person to get to figure out how everything works.

I'll need to build an admin panel to create/delete/edit pages; add/remove pictures to portfolio gallery.

This is the kind of thing that MVC is good with - define entities and quickly create List/Details/Create/Edit/Delete actions and views.

PS> I'm not saying that plain old ASP.NET Webforms is bad, it's just that it sometimes becomes too complicated and you need to pay the price for it. I think that open source e-commerce solution - NopCommerce is a good example. It's well designed, well written, but it's really slow because of the overhead that is needed for web forms.

3
  • I agree, MVC will be far easier to maintain. It will also be a faster website, and don't forget... no ViewState :-) May 8, 2011 at 22:53
  • What if development time is also a factor ? I mean I do not know MVC however I have time constraints in developing a project. Should I go for MVC or Web forms. ( I know web forms model).
    – VJOY
    Jul 27, 2012 at 4:58
  • This decision is totally up to you. All I can say is that MVC is really easy to learn and barely ever causes some weird errors. However ASP.NET Web Forms has recently evolved and is now a lot better than it was before.
    – kubal5003
    Jul 30, 2012 at 7:05
5

In terms of development speed, which would be faster: webforms or mvc?

WebForms can be a little faster to develop since it's a lot of R.A.D. development. Long term however, you will regret not separating your concerns. Keeping a separation of concerns may take longer but is a lot easier to maintain after the fact.

How about out-of-box performance between the two?

MVC will perform better since there is no "extras" being passed between the controller and the View. you only pass what's necessary (IE: no ViewState)

In a long term which would be easier to maintain?

Back to what I mentioned above. Keeping a separation of concerns may take longer but is a lot easier to maintain after the fact.

2

There are pros and cons for both web forms and MVC. But you don't have to choose. You can use the nuget package for adding MVC to a web forms application. You just have to start with web forms and then it will incorporate the MVC. That way you can have the best of both worlds depending on what your needs are.

Here is the link to that nuget package from Scott Hanselman.

If you are just looking to do a CMS then you should definitely use Orchard

1
  • 8
    Since this is a NEW project, I wouldn't mix WebForms and MVC as a "choice". The maintenance would be a nightmare (IMO) May 8, 2011 at 22:54
2

In terms of development speed, which would be faster: webforms or mvc?

Some would argue Web Forms because of the "off the shelf" server controls that can do basically anything you want. Whilst this may have been true in the intial version of MVC, now that we are at v3 and the community is getting heavily involved - you'll be able to find a MVC-port (e.g custom HTML helper) to do those things for you.

Not to mention the vast scaffolding improvements in the MVC tooling will make your "CRUD" life a hell of a lot faster.

So it's hard to categorize "development", but in terms of getting a full page running based on a backend database, i'd say MVC is faster.

How about out-of-box performance between the two?

That's tough to answer. Anything with performance is. I've read somewhere that the Razor view engine is marginally faster than the ASPX view engine, which is what Web Forms is based on. Add onto that things like ViewState, and i'd have to say (without any backing "facts") that MVC would be faster. But don't look to the technology to have well performing applications, look to yourself to write optimal code using the technologies at hand.

In a long term which would be easier to maintain?

Definetely MVC - no question on this one. SoC (seperation of concerns) is a huge pushing point in MVC, not only with the M-V-C segregration, but also the "convention over configuration" approach that is at the heart of MVC. EditorTemplates and DisplayTemplates are a perfect example of this - they work off convention (the model type being passed to it). So you can create multiple templates and flick over different model types without any backend code changes.

That being said - nothing stopping you from having a well seperated and layed out Web Forms application - but there's only so far you can go without hitting a roadblock in the technology itself - such as the "code behind model" which cannot be avoided.

Overall - MVC FTW.

1

Orchard is the MVC cms of note.

If you are going to pick a pre-built CMS, pick it based on the merits of the CMS. MVC vs Web Forms probably doesn't matter too much here if you know what you are looking to build.

If you are intent in building this yourself and you are comfortable with Html, Css and Javascript then you probably want to do MVC3. Presuming you have some underlying web skills, MVC3 really has erased most of the potential productivity advantages of web forms.

0
-1

Umbraco is a free CMS, awesome and .NET based.

http://umbraco.com/

1
  • 7
    Yeah, but why use this over a web app or MVC approach?
    – slugster
    May 8, 2011 at 22:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.