Vous êtes sur la page 1sur 12

ASP.NET MVC vs. Web Forms Part 1: The Advantages of MVC - blog.credera.

com

Author
Recent Posts

ASP.NET MVC vs.


Web Forms Part 1:
The Advantages of
MVC

Thiago Silva

Modern Web Developmen


Best Practices Powered b
Grunt.js Part 2: Diving In
In part two of this series, Ill discuss
basics, and we can start getting our h
dirty with Grunt.js.

Read Post

0
Like

Share

This is part 1 of a 3-part series comparing ASP.NET

MVC and Web Forms as a paradigm for ASP.NET


websites. The purpose of this series is not to choose

Modern Web Developmen


Best Practices Powered b
Grunt.js Part 1: Introductio

out each of their strong points and equip the reader

Developing for the World Wide Web


always been a challenge. At first, the
challenge came because it was such

with enough information to make the appropriate

Read Post

one technology versus the other, but rather to point

decision when selecting which tool to use for their


next web application project.
I recently presented on this topic at the Dallas

When Does SharePoint on


Office 365 Make Sense?

people who have no plans to adopt MVC for new web

You have decided Microsoft SharePo


Server 2013 is the best option for you
business document and content
management platformgreat. But

application projects at their jobs and client

Read Post

Techfest and was very surprised by two things: (1) the


increased interest in MVC, and (2) the number of

engagements.
While those two points are juxtaposing, they indicate
that a lot of people, simply put, just dont know the
CREDERA.COM

BUSINESS INSIGHTS
advantages
of the MVC pattern and how to sell those

TECHNOLOGY INSIGHTS

NEWS & EVENTS CLIENT STORIES


to the business
owners and the rest of their team, in

CAREERS

CONTACT

order to get buy in. This post will provide you with
some major pointers to help in making the case for

http://blog.credera.com/technology-insights/microsoft-solutions/asp-net-mvc-vs-web-forms-part-1-the-advantages-of-mvc/[24/07/2014 11:32:31 a.m.]

ASP.NET MVC vs. Web Forms Part 1: The Advantages of MVC - blog.credera.com

ASP.NET MVC.
MVC is a
mature design
pattern, dating
back to 1979
from the Xerox
PARC. It
conveys the idea that your presentation should be
ignorant of your business and domain logic in other
words, it enforces separation of concerns. In the MVC
world, web requests are received and dispatched by
the controller which is in charge of communicating
with the business logic to retrieve data and then to
pass this data, the model, to the presentation layer,
the view.
What does this buy us, might you ask? Well, it fosters
the adoption of best practices and good software
development patterns, such as:
Separation of Concerns
Unit Test/TDD and Type Mocking
Loosely coupled tiers
Highly maintainable code
Better code organization
S.O.L.I.D.
The

ASP.NET MVC framework is built on top of a mature


web stack and, thus, provides the developer with all
the goodness that comes with ASP.NET, such as
Session State, Caching, Profiles, Security and
Membership, Master pages, Localization,

http://blog.credera.com/technology-insights/microsoft-solutions/asp-net-mvc-vs-web-forms-part-1-the-advantages-of-mvc/[24/07/2014 11:32:31 a.m.]

ASP.NET MVC vs. Web Forms Part 1: The Advantages of MVC - blog.credera.com

Configuration, Health Monitoring, Tracing, and more.


When opting to develop yourapplications with MVC,
you are not throwing away years of investment into a
platform, but rather increasing the ability to write
BETTER code.
Its true that MVC forces the developer to rethink their
strategy for handling web requests by ditching
Viewstate and Postbacks, but it also embraces the web
for what it is: a stateless protocol. It doesnt try to
shield the developer from that truth by introducing
complex event lifecycles and bloated response
payloads. Furthermore, it makes it much easier to
adopt newer client and browser scripting frameworks,
such as jQuery, while giving the developer full control
of their mark up.
Additionally, as a side effect of having full control of
your markup, you have better opportunities to do
search engine optimization (SEO). Most search
engines use a combination of criteria to rank pages.
Web pages that yield better, lighter, semantic HTML
markup have a better chance to rank higher in search
results.
If you are planning a mobile strategy for your web
content, look no further. ASP.NET MVC makes it
rather simple to adopt HTML5 compliant web sites,
and will not corner you into non-semantic, server
control generated markup. With MVC, you can more
easily leverage new CSS3 constructs, as well JavaScript
libraries such as Modernizr, to provide progressive
enhancement and graceful degradation of web
content. This is great news when planning for a
website that should render well in many types of
connected devices, including tablets and mobile
phones.
While MVC has many advantages, one must consider
the learning curve required when jumping in from
http://blog.credera.com/technology-insights/microsoft-solutions/asp-net-mvc-vs-web-forms-part-1-the-advantages-of-mvc/[24/07/2014 11:32:31 a.m.]

ASP.NET MVC vs. Web Forms Part 1: The Advantages of MVC - blog.credera.com

Web Forms. Theres a significant amount of


knowledge to be gained by the web developer in order
to fully understand this paradigm in ASP.NET. Web
Forms developers have spent most of the last decade
writing code to handle postbacks, and relying on
viewstate to make some magic happen with their web
pages. Its hard to throw all of that out the window,
and get closer to the metal. Lets face it Web Forms
made it easy to create new web application! Debating
whether MVC is better than Web Forms is likely a
pointless debate, and is best left to the web zealots.
The next installments in this series will take a closer
look at Web Forms, and how it has evolved in order to
play well with the newer web stack, including support
for HTML5, CSS3, JavaScript and AJAX libraries.
Well also provide a feature comparison between the
two, and hopefully you can make your case for the
appropriate technology when creating your next web
application.

Posted on October 27th, 2011 in Article, Microsoft


Solutions, Technology Insights, Technology
Solutions.

Tags:
Microsoft

ASP.NET

Credera

HTML5

MVC

http://blog.credera.com/technology-insights/microsoft-solutions/asp-net-mvc-vs-web-forms-part-1-the-advantages-of-mvc/[24/07/2014 11:32:31 a.m.]

ASP.NET MVC vs. Web Forms Part 2: The Advantages of Web Forms - blog.credera.com

ASP.NET MVC vs. Web Forms Part 2: The


Advantages of Web Forms
Au thor

Gabe Salazar

This is part 2 of a 3-part series comparing ASP.NET MVC and Web Forms as a paradigm for ASP.NET websites. If
you missed the first part of the series, you can find it here. The purpose of this series is not to choose one technology
over the other, but rather to point out each of their strong points and equip the reader with enough information to
make the appropriate decision when selecting which tool to use for their next web application project.
Recent experience shows that enterprises are interested in MVC, but still leaning towards Web Forms. Familiarity is
the most likely reason for the slow transition to MVC. The stateful mechanisms utilized in Web Forms present a
programming model that is more consistent with desktop and non-user-interface based application development,
providing more familiarity for windows application developers and developers from other paradigms and platforms.
The bottom line is that Web Forms provide a smaller learning curve for developers from diverse backgrounds. While
this isnt necessarily a great reason for using Web Forms, it is a clear advantage when starting a project.
Web forms are also great for rapid application development. This can be good for prototypes or smaller applications.
Testable, maintainable solutions can be implemented with proper technical leadership when working on larger
applications, while MVC provides for these mechanisms by enforcing a separation of concerns. Keep in mind that
some of the larger enterprise eCommerce and employee portal solutions are built on web forms.

CREDERA.COM
TECHNOLOGY INSIGHTS
CAREERS

BUSINESS INSIGHTS
NEWS & EVENTS

CLIENT STORIES

CONTACT

The architecture and environment provided by Web Forms also enables developers with less Javascript, HTML and
CSS background to develop applications more quickly. Server side access for manipulating HTML markup and drag
and drop functionality of controls for creating page layouts can also lend itself to faster user interface development as
server controls will generate all necessary HTML/CSS markup. And dont forget that major off the shelf solutions use

http://blog.credera.com/custom-application-development/asp-net-mvc-vs-web-forms-part-2-the-advantages-of-web-forms/[24/07/2014 11:33:46 a.m.]

ASP.NET MVC vs. Web Forms Part 2: The Advantages of Web Forms - blog.credera.com

web forms, including Microsoft SharePoint and Microsoft Commerce Server. Even while custom development projects
transition to MVC, certain solutions will always require expertise in web forms.
Here at Credera, our staff has extensive experience in both Web Forms and MVC development. We have also
implemented solutions in may off the shelf technologies. If you have questions about which technology makes the
most sense for you project or have other questions about Microsoft Development, please contact us for more
information.

Look for a side by side breakdown of MVC and Web Form technologies in our next installment of this blog series.

Posted by Gabe Salazar on January 19th, 2012 in Article, Custom Application Development, Microsoft Solutions.

Tags:

ASP.NET

Credera

HTML5

Microsoft

MVC

http://blog.credera.com/custom-application-development/asp-net-mvc-vs-web-forms-part-2-the-advantages-of-web-forms/[24/07/2014 11:33:46 a.m.]

ASP.NET MVC vs. Web Forms Part 3: The Breakdown - blog.credera.com

Author
Recent Posts

ASP.NET MVC vs.


Web Forms Part 3:
The Breakdown
Mike Breske
This is the final installment of a three-part series

0
Like

comparing ASP.NET MVC and Web Forms as a

Another year is upon us. Having bee


the technology space for two decade
fascinating to look where

Read Post

Dependency Injection Par


The Need

first or second parts of the series, you can find part

This is part one of a three-part series


dependency injection, which is a soft
design pattern that allows the

one here and part two here. The purpose of this series

Read Post

Share

paradigm for ASP.NET websites. If you missed the

5 Technology Trends for 2

is not to choose one technology versus the other, but


rather to point out each of their strong points and
equip the reader with enough information to make the
appropriate decision when selecting which tool to use

New Visual Studio 2012


Features for Web Develop

If you have read parts one and two of this blog series,

Visual Studio 2012 introduces a num


of new and exciting capabilities for
development on the latest platforms
previous

you should be more comfortable putting MVC and

Read Post

for their next web application project.

Web Forms head-to-head to answer the burning


question: Which technology should I use for my
project? Lets walk through some considerations
when choosing the appropriate technology for any
web project and discuss how MVC and Web Forms
stack up against each other in each category.
CREDERA.COM

BUSINESS INSIGHTS

Team

TECHNOLOGY INSIGHTS
CAREERS

NEWS & EVENTS

CLIENT STORIES

CONTACT

http://blog.credera.com/custom-application-development/asp-net-mvc-vs-web-forms-part-3-the-breakdown/[24/07/2014 11:36:19 a.m.]

ASP.NET MVC vs. Web Forms Part 3: The Breakdown - blog.credera.com

experience and
background

Playing to your teams strengths should never be


underestimated. If you are building an ASP.NET web
application, chances are you have .NET developers on
your team. If your team has strong Web Forms
expertise or come from a Win Forms background,
writing a greenfield web application using ASP.NET
MVC might be a hard sell. If you do not have a team
of Web/Win Forms veterans, ASP.NET MVC starts to
look appealing. The reason is that the MVC pattern is
extremely popular and embraced by many web based
frameworks outside of the Microsoft world. Ruby on
Rails, Cake PHP, Spring MVC, Django are all popular
frameworks that implement the MVC design pattern
and a developer coming from any of these
backgrounds should easily become comfortable with
ASP.NET MVC. This implies that hiring productive
developers to maintain and extend your application
will likely be easier if you chose ASP.NET MVC. Many
say that MVC has a steeper learning curve when
compared to Web Forms development for those with
no web development experience. I will stray from the
herd and disagree with that assessment. Web Forms
employs partial classes, a complex page event lifecycle,
and simulated state which operates contrary to the
way the web works. MVC is simple to explain because

http://blog.credera.com/custom-application-development/asp-net-mvc-vs-web-forms-part-3-the-breakdown/[24/07/2014 11:36:19 a.m.]

ASP.NET MVC vs. Web Forms Part 3: The Breakdown - blog.credera.com

it does not mask the web being a stateless protocol.


Instead it embraces how users interact with a web
server and provides a clean pattern in which to do so.

Extensibility

The word extensibility get thrown around a lot, what


are we really talking about here? Extensibility is a
measure of how easy it is to make changes to your
application, from small feature additions to large
infrastructure changes. Imagine you decide to
completely change the database technology you use to
back your application. For example, maybe a NOSQL
database will suit your technical needs perfectly and
want to save money by not purchasing SQL Server
licenses. This change would frighten some Web Forms
teams, unless they took extreme care and were very
diligent in building a sound infrastructure. If a
developer decided to bind some controls directly to a
SQL server data source using a connection string,
making your database switch could be a nightmare.
On the other hand, ASP.NET MVC makes it very easy
to decouple layers of your application. For example, it
is very simple to set up and use a dependency
injection framework because controllers are just
simple classes.
Additionally, Web Forms server controls generate
their own HTML and in the process of nesting certain
http://blog.credera.com/custom-application-development/asp-net-mvc-vs-web-forms-part-3-the-breakdown/[24/07/2014 11:36:19 a.m.]

ASP.NET MVC vs. Web Forms Part 3: The Breakdown - blog.credera.com

controls, you can introduce auto generated HTML tag


ids that can break JavaScript functions that depend on
those ids. Tight control over HTML and separation of
concerns give ASP.NET MVC the edge when it comes
to extensibility. However, if you are building a one-off
intranet site to display some data, Web Forms might
be a great choice. If the application is not meant to
evolve, and rapid development is needed, using the
simulated statefulness and data binding tools Web
Forms provides starts to become more attractive.

Third Party
Tools
Web Forms is a mature framework and has plenty of
third party controls and tools that make some tasks
incredibly easy. The Ajax control toolkit, Telerik,
Infragistics, etc. all provide some awesome
functionality out of the box in the form of custom
controls. These third party offerings can save a ton of
development time if they meet your needs. While Web
Forms has the upper hand in the form of third party
tools that generate page content, ASP.NET MVC is
able to make better use of tools that are geared toward
quality code. Dependency injection, mocking, and unit
testing tools are able to be used to their fullest extent
in ASP.NET MVC projects with little set up effort.
Web Forms projects are at a disadvantage when it
comes to using these tools, as the framework itself
makes it difficult to enforce the decoupling required
for the tools such as Ninject, Moq, and NUnit to be
useful.

Design and
http://blog.credera.com/custom-application-development/asp-net-mvc-vs-web-forms-part-3-the-breakdown/[24/07/2014 11:36:19 a.m.]

ASP.NET MVC vs. Web Forms Part 3: The Breakdown - blog.credera.com

Device
Targeting
Web
design is

important in modern web development. Users


demand better looking websites with higher levels of
interactivity. ASP.NET MVC is a good fit if you are
looking to meet exacting design standards. ASP.NET
MVC allows for tight control over HTML and therefore
integrates extremely well with JavaScript frameworks
and it is easy to apply CSS rules. You will be able to
achieve the same look and feel using Web Forms, but
the journey might be a little more painful as you have
less control over the HTML being generated from
server controls.
Is your web application going to be viewed on a
mobile device? Today, the answer to that question is
almost always yes. Web Forms provides mobile
support in the form of custom device adapters that
create custom rendering for a control based on the
type of browser that is making the request for the
page. While using Web Forms it is necessary to create
a different page in your application for both desktop
and mobile devices. To target multiple devices using
ASP.NET MVC, you would create views that are
specific to mobile devices and one view specific to
desktop browsers. The key here is that by leveraging
http://blog.credera.com/custom-application-development/asp-net-mvc-vs-web-forms-part-3-the-breakdown/[24/07/2014 11:36:19 a.m.]

ASP.NET MVC vs. Web Forms Part 3: The Breakdown - blog.credera.com

the routing feature of ASP.NET MVC, there is a


potential to use the same controller action to service a
request for a page on a mobile device, as well as a
desktop PCs, and only the view returned from the
action will change. This is a great example of what we
gain from using the MVC design pattern. Since the
view is decoupled from the model, we can easily create
multiple views that display the same data in a
different format.

Conclusion
Hopefully this blog series has helped educate you on
the key advantages and disadvantages of both
ASP.NET Web Forms and ASP.NET MVC. The
discussions above should be a good starting point
when deciding which technology to use on your next
web development project. Remember to stay objective
and keep in mind that ASP.NET MVC and Web Forms
are both capable technologies and choosing one over
the other does not spell doom, nor guaranteed success,
for your project. Credera has experience implementing
and extending robust web applications built using
ASP.NET Web Forms and ASP.NET MVC for
companies including Radio Shack, GameStop, Alpha
Natural Resources, and Interstate Batteries (to name a
few). If you have questions about which technology
makes the most sense for you project or have other
questions about Microsoft Development, please
contact us for more information.

Posted on January 26th, 2012 in Article, Custom


Application Development, Microsoft Solutions.

Tags:

asp

asp.net mvc webforms

custom development

Microsoft

MVC

http://blog.credera.com/custom-application-development/asp-net-mvc-vs-web-forms-part-3-the-breakdown/[24/07/2014 11:36:19 a.m.]

Vous aimerez peut-être aussi