Solved

ASP.NET Web Forns or ASP.NET MVC

Posted on 2013-06-30
6
480 Views
Last Modified: 2013-08-19
Hello Experts,

I have developed ASP.NET web applications for years now using ASP.NET Web Forms while using ADO.NET to interact with a SQL database.

My question i have is can someone tell me the difference between using Web Forms and MVC to develop and interact with an SQL database and the pros and cons or each or at least why and for what reasons to use each?
0
Comment
Question by:asp_net2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39288655
Web Forms was created to help non-web programmers ease into development for the web. If you've ever done Win Forms development, then you know how similar the programming models are. The downside to all this "ease of use" is that a lot of extra cruft gets packed into your pages to help make that model work. Things like View State and all of the extra markup that helps a page determine which button was clicked...that all adds extra data to your pages. Web Forms tends to be larger in terms of payload to the client.

MVC is designed to be more light weight. You no longer have the TextBox, Label, ListBox, etc. controls that Web Forms has; instead you have the standard HTML controls that Web Forms ultimately turns all of its controls into (at page render). MVC doesn't require all of the View State and control tracking that Web Forms does. It functions on the premises that the original web was designed with.

All that said, you can accomplish a good separation of concerns with either approach. It's all in how you style your application. MVC, IMO, lends itself more to adhering to n-tier architecture. After all, ASP.NET MVC is just Microsoft's implementation of the MVC pattern. This is a pattern which by definition creates a separation of concerns between the various parts of your application.

Personally, I have come to like MVC much more than Web Forms. I appreciate the ease of throwing together a web site/application that Web Forms offers. But MVC is very clean in terms of the code and markup. Also, an expansion of MVC called Web API allows you to build RESTful services in an MVC style, very quickly, and very cleanly.
0
 
LVL 4

Author Comment

by:asp_net2
ID: 39288711
Hi Kaufmed,

Thank you for that information. So it sounds like neither is better than the other. I really enjoy working with Web Forms but have not tried MVC yet. I would prefer to just stick with what I have been using for years now. I truly enjoy working with design, programming ASP.NET controls, and programming using ADO.NET.

I was just curious if MVC was better than Web Forms or at least ask if MVC offered more options than web forms.

So I would not be able to work directly with the ASP.NET controls or the different Page Events if I used MVC then???
0
 
LVL 27

Expert Comment

by:Sammy
ID: 39288872
MVC is definitely better than web forms if you plan to do TDD and have concern in regards to Separation of Concerns (SOC)

As for you latest question, you are correct. you cannot using web controls or event driven server controls in MVC project.
You can however use a hybrid project where you can use both MVC and Web forms technologies on the same project.

An advice for your own career, learn MVC... No one is looking for web forms developers anymore (I run a development team and I wouldn't consider a resume if MVC experience isn't listed)

Good luck
0
Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

 
LVL 4

Author Comment

by:asp_net2
ID: 39290531
@sammy1971,

>> An advice for your own career, learn MVC... No one is looking for web forms developers anymore

Why is that? I don't see a TRUE benefit to use MVC over Web Forms. It seems more like user opinion. It also appears that you are limited to what can be done programming wise with MVC than Web Forms or maybe I'm wrong. It seems that Web Forms gives you more interaction with the ASP.NET Controls and Page Events when needed.

I just don't understand the sole purpose of MVC and why some say it's better than Web Forms.

Can someone help me understand in lamens terms why MVC is or is not better than Web Forms?
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 500 total points
ID: 39292163
I've been developing in ASP.NET for 10 years.  I can definitely say I like the MVC model better than webforms.

As well as the reasons posted above by kaufmed, in MVC:
The page lifecycle is simple, unlike webforms
Cleaner HTML, therefore easier to write javascript.  Easier to integrate javascript libraries such as jquery, meaning less reliance on third party controls.
The abstraction is moved from complex web controls to the binding layer  (Once you see this in action, you'll understand why it's genius.)  Your plain old HTML binds automagically to the model object.
Instead of having messy HTML and a sometimes functional event model, you get streamlined HTML and clean object data being posted back to the server.

AJAX is straight forward.  You use javascript and call a method in your controller.
But your mileage may vary.  Also what becomes popular in software development isn't always about what's better.  Often it's about what is new and shiny and cool.
0
 
LVL 27

Expert Comment

by:Sammy
ID: 39292172
Due to the level of abstraction involved in webforms,  it tends to get abused by lazy developers.
This abstraction doesn't exist in mvc, it's just simply developed to follow Web protocols. I have developed in both mvc and Web controls since the release of framework 1.1.
It's simpler, cleaner and more extendable.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question