Art Of Programming

musings by Dmytrii Nagirniak

Building Web Applications With ASP.NET MVC

I have just read a nice article: Building Web Apps without WebForms. As always, I like to use blog as a notebook to remember something for the future.

It mostly shows how to develop ASP.NET MVC application and has simple and useful samples.

I just want to quote couple of paragraphs from the topic.

ASP.NET Web Forms made it very easy to get started, but, in other ways, trying to apply my design principles to Web apps was a struggle. Web Forms are relentlessly UI focused; the fundamental atom is the page. You start by designing your UI and dragging controls. It’s very seductive to just start slapping your application logic into the page’s event handlers (much like Visual Basic® enabled for Windows® apps).

On top of that, unit testing of pages is often difficult. You can’t run a Page object through its lifecycle without spinning up all of ASP.NET. While it is possible to test Web apps by sending HTTP requests to a server or automating a browser, that kind of testing is fragile (change one control ID and the test breaks), hard to set up (you have to set up the server on every developer’s machine exactly the same way), and slow to run.

Cannot agree more with all that. And read this:

I had to figure out how to reduce the view state size to get my pages to load faster. Web Forms require that a physical file exist at every URL, something that dynamic sites (like a wiki, for example) make difficult. And successfully writing a custom WebControl is a remarkably complex process that requires a comprehensive understanding of both page lifecycle and the Visual Studio® designer.

This ViewState… Have a look at this article just to understand how the ViewState works. While many of us (WebForm devs) have already got it, but it’s just ridiculous. On the other hand there’s still a big disadvantage of using ASP.NET MVC instead of WebForms. There’re no large UI controls set available for it.

Comments

ftorres
For functional web testing of asp.net web form app or MVC app in C# or VB.NET check out http://www.InCisif.net.

InCisif.net does support ASP.NET’s ID and is integrated with Visual Studio.

http://www.incisif.net/blog/entries/2008-02-08%20Web_Testing_and_ASP.NET_ID.htm

Comments