Choosing the Right Programming Model - delete this video
0 (0 Likes / 0 Dislikes)
[Microsoft ASP.NET.]
[www.ASP.NET]
[Choosing your Programming Model] Hi, I'm Scott Hanselman.
Let's talk about choosing your programming model in ASP.NET.
ASP.NET is a flexible web platform that enables you to build great web applications
using 3 different programming models.
Those models are ASP.NET Web Forms, ASP.NET MVC, and ASP.NET Web Pages.
All 3 of these programming models are fully supported options,
and they're used by millions of developers.
Let's take a look at how these fit together and why there are 3 choices.
All these models build on top of the same core ASP.NET web platform.
Each model sits on top of ASP.NET, and each model is ASP.NET.
At the same time, though, each model creates and structures
a web application using a slightly different approach.
Just like people, each of the approaches values different things.
We offer these different approaches because we've found
that some developers prefer one set of values,
and other developers prefer another set of values.
All these programming models are good ones, and they solve real problems.
We'll continue to add features and innovate with all of them.
The programming model approach that's right for you depends
on what feels most natural for you and which set of values maps to what you're looking for.
If you're coming from a client application development background,
or perhaps you're familiar with UI controls and wiring up event handlers
that respond to user actions, you'll find a comfortable
programming model in ASP.NET Web Forms.
ASP.NET Web Forms provides a server-side web programming framework
that enables you to use server-side controls within your HTML markup.
Server controls in Web Forms encapsulate some of the complexities
of HTML, JavaScript, and CSS.
They support rich features like data binding and templating.
Web Forms includes dozens of rich user interface controls out of the box.
You'll be able to retrieve data from databases
and wire up controls to display and edit data in data grids and charts.
The controls will help you achieve common tasks easily.
Differences between browsers are handled by controls.
You may be familiar with Microsoft SharePoint.
It builds on top of Web Forms.
If you're a SharePoint developer or intend to be,
that's another reason for you to use Web Forms.
ASP.NET MVC is a slightly lower level web programming model.
It doesn't have higher level abstractions like controls
but rather asks that you know HTML and HTTP a little more deeply.
If you're someone who comes from a traditional web development background,
ASP.NET MVC will probably feel very comfortable to you.
MVC gives you total control over the HTML markup that you render
and the URLs that you expose within your application.
It enables you to have the full power and flexibility of CSS and JavaScript.
ASP.NET MVC also has great support for unit testing
and test driven development for your web applications,
and it's often used alongside Agile methodologies.
MVC encourages strong design patterns and prescriptive application architectures.
It's very flexible and can be extended in any way you like.
ASP.NET Web Pages is a simple model built around individual pages
similar in ways to PHP or Classic ASP.
It uses the same Razor syntax that MVC does
but with inline script rather than separate controller classes.
However, you have the full power of the .Net Runtime and all the flexibility
of C# and VB.NET at your fingertips.
Web Pages gives the developer full control over the generated markup.
The reusable methods and libraries that are used in Web Pages are called helpers.
They're like Web Forms controls in that they encapsulate reusable functionality.
However, Web Pages doesn't have a page lifecycle like Web Forms does,
so there's no hierarchy like Page_Load and Page_Render.
You can generally think of an ASP.NET Web Page
as executing top to bottom.
Web Pages is a powerful tool you can use within your Web Forms and MVC applications.
You can add a Web Page here and there to existing apps
and extend them in new ways you perhaps hadn't thought of.
Remember that choosing your programming model isn't a fork in the road
that you can't turn back from.
Underneath each of Web Forms, MVC, and Web Pages
is ASP.NET itself.
All these models share nearly all of their libraries with the core runtime.
This includes Authentication, Authorization, User Membership, Role Security,
Output Caching, Session State, Configuration,
Deployment, Ajax Support and more.
The skills and APIs that you'll learn in these core libraries
are used interchangeably between
Web Forms, MVC, and Web Pages.
Learn one, and you're well on your way to learning them all.
And because it's all ASP.NET underneath,
you can even choose to have hybrid applications
that are built with any and all of these programming models.
It's up to you.
Pick the right tool for the job.
As an example, some programmers use Web Pages for rapid prototyping,
and then they move to MVC.
ASP.NET makes it all possible and gives you a lot of flexibility.
You can download everything you need to start developing right here
on the ASP.NET website.
A great way to get started if you're a new developer
is to start with Web Pages.
Click the Web Pages tab and click Install Web Matrix.
This friendly IDE gets you started with your first website in minutes.
You can even download and run popular Open Source applications
directly from within Web Matrix.
Or if you're ready to move up to a more powerful tool
and start creating Web Forms or MVC applications,
click the Downloads tab and download Visual Studio Express for free.
Visual Studio can be used to create ASP.NET websites of any type.
I'd encourage you to spend some time learning a little about
all these models so that you can get a feel for each.
Each tab on the ASP.NET website includes a short video
that will show you what building a simple application is like with ASP.NET.
There's also extensive text tutorials and walkthroughs to get you started.
Visit the Web Forms, MVC, or Web Pages tabs
on the ASP.NET website and learn more about each programming model approach.
Each section has sample applications, tutorials,
videos, and walkthroughs to help you not only get started
but to handle advanced scenarios as well.
Thank you. I'm looking forward to seeing what you'll create.
[Microsoft ASP.NET]
[www.ASP.NET]