views:

568

answers:

13

I ask this not to start anything negative. Rather, after looking at ASP.NET MVC it hit me (duh) that I am not using controls like on webforms but coding html markup by hand (gasp.)

Is this a move backwards? I remember coming from classic asp to asp.net and dragging and dropping controls, creating a bll, etc. now it seems I am doing all that by hand, again, like classic, except I have good mvc design.

I guess I'm trying to figure out why this is a move forwards from what was a rapid development environment to what appears to be more tedious.

EDIT:

I always thought Visual Studio .NET was one huge reason to go with ASP.NET with all its controls and automation. Now with MVC it is makes me think it's just like any other MVC with a decent IDE, since I'm doing everything by hand now.

A: 

I think it's a step in the right direction, but it's nowhere near as mature as WebForms. I expect to see commercial 'control' libraries before long, although it won't be drag and drop stuff.

Also, if you're using WebForms for your view engine you're missing the point, in my opinion.

James L
+19  A: 
  • "Classic" ASP.NET hasn't gone anywhere - you can still use it if that's what you want or need
  • Though you may or may not get "drag-and-drop" fuctionality, between AutoComplete and the various render helpers you can easily get a working view in minutes
  • Creating the views is only a small fraction of the overall project
  • Even in ASP.NET I rarely used the visual editor. I always felt that it got in my way and made decisions for me, wrongly.
GalacticCowboy
+1 on the last line item. Any page I have created that has stepped outside the lines of what the designer put there is usually horribly disfigured if I modify it in the designer my changes.
mjmarsh
+1 for your last bullet. designing a page on the designer with drag-and-drop is a terrible way to layout html. I always end up doing it by hand to make it work the way I want.
Geoff
It's not just that it is drag and drop and you can see it in the designer. It's that it's a control, completely done. You can see it in the code, no visual editor, and use it.
johnny
but its not completely done. try getting xhtml compliant output that works in all browsers with the built in asp.net controls. too much extra work.
Geoff
+3  A: 

Tell me about it. I'm still trying to work out why I'm subjecting myself to this. Ultimately the number #1 sell is Unit Testing. For those of us who don't subscribe to this, the advantages are few, if any, IMHO.

That said, I'm open to be convinced otherwise. I think that MVC is a good foundation, but like you say, it's very very tedious at times. The RAD system of drag/drop controls from the toolbox used to be terrible, but since vs2008 it's been quite a pleasure. I expect the major toolkit vendors like Telerik, Infragistics, ComponentOne et al will soon ship MVC friendly toolkits (I hope!).

I'm only learning it because I'm currently on a project that was built on it (not my design). Don't forget though that YOU DONT HAVE TO USE IT. Classic ASP.NET didn't disappear. :)

-Oisin

x0n
Thank you. I know classic didn't go away and I know there is not one way that's right for every job but I really want to use MVC as it seems to be the norm outside of a Microsoft world and a very good way to do things.
johnny
Haha, when I hear people say Classic ASP I think of old ASP as in not .NET :-) But really you just mean ASP.NET without MVC :-)
Roberto Sebestyen
I didn't realize I did that. Funny. I always think of Class ASP too but here I meant it with webforms.
johnny
Classic ASP is ASP 3.0.
liammclennan
liam, read it again: i said "classic ASP.NET," not "classic ASP."
x0n
+14  A: 

Is a step forward:

  1. the code is fully testable
  2. you gain full control of what the server is generating
  3. no more viewstate!
  4. increased server response speed
  5. less server cpu load without the WebForm's Page lifecicle
  6. a programming model which is more close to the web (webforms aimed to bring to the web the desktop programming model).
  7. ....
Andrea Balducci
Yes and no - I agree with all your plusses - but on the down side, it's a lot more work, too, and for now doesn't have the same controls ecosystem as "classic" ASP.NET webforms, thus putting more burden on the dev teams to do it all themselves.
marc_s
It probably won't either. Most of what your putting out there is plain HTML. You might create partial views that kinda work like controls. The idea was though, is that the internet doesn't have controls like desktop apps do. ASP.NET liked to pretend it was a desktop app. ASP.NET MVC reminds you, it's not.
Sekhat
just few lines of code and you can create your own controls or your html helpers. And if you can use jQuery there are more controls out there than WebForms; and the overall user exprerience is better.The extra time spent to develop your own reusable controls is incredibly less than the time you'll gain on debug and enhancements in the medium-long term.MVC is only a new option for us and can be used side by side with classi WebForms if you want (= if you absolutely need a thirdy part control you can still use the classic WebFormPage)
Andrea Balducci
Re: less server cpu load without the WebForm's Page lifecicleClearly you haven't profiled an MVC app yet. There is just as much going on behind the scenes as with the ASP.NET standard page life cycle, if not more. Sure there's no view state and there are no "events", per se, but that doesn't mean less code is being executed to achieve a similar result.
Chris
@Chris: I've profiled (and built a tool to stress an mvc app and analyze server response time) an mvc app and there are out there a lot of good blog posts on optimizing asp.net mvc to improve the performances. MVC is just faster in my standard application context: no more updatepanel, server.trasfer, tweaking of httpresponse, serialization / deserialization of viewstate etc...
Andrea Balducci
+1  A: 

I thought part of the point of the ASP.Net MVC Framework was giving the developer more control over the HTML. Something the drag-and-drop controls make a mess of.

Geoff
+7  A: 

Funny you should mention this - I just finished reading a chapter in "Professional ASP.NET MVC 1.0" that answers this exact question.

The book they compare the difference between Web Forms and MVC as the difference between leading an orchestra and composing a song. MVC doesn't give you the same level of immediate response as web forms, however it does give you a level of granularity a lot of web developers have come to expect. It's well known that ASP.NET controls, even in their later versions, inject more HTML than is desired.

So, functionally yes it's a step back, but only because you've been given complete control over what gets put on the page. As always, pick the right language for the job.

Mike Robinson
Woot! - shanselman
Scott Hanselman
Haha! How very meta - love the book, nice job!
Mike Robinson
Going to check out this one soon. :)
Arnis L.
+1 great response.
Brian MacKay
+5  A: 

It's a step sideways, rather than forwards or backwards; just another way of doing the same thing, with a different emphasis. With ASP.NET forms, it's easy to "draw" the page so it looks roughly like you want it to look, but it's hard to make it behave like a proper web application. With ASP.NET MVC, it's not as easy to throw together the appearance of it, but it's actually easier to make it behave like a website, with URLs that describe the content being returned in a predictable way.

Daniel Earwicker
Interestingly, I never "draw" on the page with webforms. I barely ever use the visual editor since it's misleading and often broken. I wonder if that's just me.
Brian MacKay
+2  A: 

For me, getting rid of viewstate and the page life-cycle has been an addition by subtraction. :) Not to mention a boon to my knowledge of web programming because of having to get my hands "dirty".

Lunchy
+2  A: 

Some people might say that ASP.Net was a step backwards in that it can constrain the flexibility of the application by locking you into using pre-built controls.

Classic ASP was immature, but it did give you very fine-grain control over the mark-up code, which many find is lacking in vanilla ASP.Net.

As I see it the ASP.Net MVC paradigm gives the developer closer control over mark-up, while still giving access to all of the advantages of the .Net framework.

alchemical
+1  A: 

ASP.net MVC is not for everyone or for every application (some may argue this through!). MVC is a framework you can use in its basic form or extend to your hearts content. It allows you full control over what is rendered to the user.

MVC has a number of advantages:

Seperation of concerns resulting in better testability, arguably better design and easier to modify UI

Full control over what is rendered - which can result in standards compliant, smaller, faster pages

Clearn SEO friendly URLs although ASP.net 4 has routing features

In its purest form without use of session load balances very well.

It also has some disadvantages:

Learning curve and change of thinking required

Lack of 3rd party support although this will change

Pages can look cluttered

Can be more difficult to develop certain types of controls e.g. something like a reorderable data grid or something with many steps like a wizard

alexmac
+2  A: 

I think it was a necessary step backwards, or better yet backtracking a few steps to move ahead.

The web had evolved in a direction that diverged significantly from ASP.NET's core design premise.

In the end, comparing ASP.NET to other agile web frameworks, I believe it was a case of "you can't get there from here".

loudej
+1: Interesting way to put it.
Brian MacKay
A: 

One of the biggest differences is the page life cycle. This is for me the main paradigm change. Many other benefits could be addressed following good practices, although ASP.NET did not enforce them.

If you are used to WebForms and ASP.NET, MVC may seem awkward, but if you come from classic ASP, PHP, Rails o any other environment that respects the nature of the HTTP flow, its a good option. You get the benefits of a great IDE such as Visual Studio, a complete and powerful framework such as .NET (whether you use C# or VB.NET) and everything works in a more or less familiar way.

You may lose ASP.NET controls and visual designer but for many people that was more an annoyance than a benefit, depending on the type of applications you were building and your previous experience. ASP.NET was a nice transition from Winforms but for people who always worked on a web environment seemed a bit "forced".

Marc Climent
A: 

Didn't Scott Hanselman at one point say that "MVC isn't Web Forms 4.0"? I've taken from that, that he means that MVC isn't to replace ASP .Net at all, and it is simply another option to Win Forms and Web Forms.

I do agree in that when I first started looking at MVC, I was much more reminded about classic ASP (not the .Net version) in the way that there's no code behind page, and there's more <%= whatever %> markup in the views, which threw me for a little while, as when I used ASP .Net for the first time, it was as though ASP .Net discouraged the need for such markup.

Personally, I like MVC; I think it's great, but there's a little room too for ASP .Net..!

Brett Rigby