Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# ASP.NET, WebForms to MVC : Does it make sense to change in our case?

We have a WebForms based web application with these properties:

Large Business Object Framework (Close knit DAL / Business Objects / Serverside Validation, similar to CSLA) Precompiled and placed in the Bin folder. Uses a lot of UserControls.

Looking at overviews of MVC it seems there is a distinctive split on how the code is split up, there is no Session State (which seems odd, but possibly ok if the website is primarily serving content?) and it appears constructing pages looks similar to classic asp (use of <% %> tags)

Do I have the wrong interpretation of MVC? Is MVC just a specific architecture, or is the way things will be going and WebForms will eventually be dropped? How does one split the M-V-C when an existing Business object Framework exists? Why is there no session state? Do UserControls work in MVC?

I realise this could be subjective, so mostly looking for your comments on the subject to make my up my own mind.

like image 345
Mark Redman Avatar asked Feb 07 '10 13:02

Mark Redman


1 Answers

MVC is 90%+ the same as WebForms, but of course when everyone's having debates they tend to leave that tid-bit out.

You can have as many layers underneath as you want providing yor data, and yes you can do the UserControl style. It's more of a mindset change than a technology change. MVC has it's advantages, it embraces the fact that HTTP is stateleess. Webforms abstracts that fact to a degree, making some things easier as well (viewstate for example). Session state, compilation...it's all there, it's in the same framework beneath both.

In short: use what you want, research it well (example projects are everywhere). If you're deep into a project, factor in time to change over, it's learning curve as well as the actual code time. This decision is up to you and your team, if it's too different, then it may not very beneficial because there is some adjusting. If you're more comfortable with new technology, MVC can be much cleaner...both still have their uses.

I wouldn't start another project in WebForms, but that's me, and what I'm comfortable with...you really have to figure out which feels more natural to you, and if applicable, your team.

Also, tvanfosson made an excellent point: the more validation or really whatever custom logic that was in the web project before, the more time it takes to move over. If you have an excellent separation of layers already, you're in a much better position to do so, if not, that's another major time consideration.

like image 98
Nick Craver Avatar answered Nov 15 '22 16:11

Nick Craver