A few hours ago, I stumbled on asp.net mvp – an up and coming asp.net opensource framework who’s aim to to unit the productivity of asp.net webforms and the exensibilty of asp.net mvc. After combing through the links and the how-to’s on http://aspnetmvp.com , I had warmed up to the idea and was willing to give it a try in the new furture. This post should probably be titled asp.net mvp but the blog post(http://www.aaron-powell.com/yes-i-like-webforms) in relation to asp.net mvp in support of asp.net webforms got my heart going so I decided to respond with this post. If you have head it all, please skip this post else you are welcome to read on.
The blog post(http://www.aaron-powell.com/yes-i-like-webforms) in support of asp.net webforms list some very interesting point that I strongly support especially in relation to viewstate. People who complain about veiwstate just don’t know how to use it and its a fact. I actually agree with everything except for his argument quoted below in support of asp.net webform controls.
Controls are great, they package up some functionality and make it easy to redistribute. But people often say that this is one of the big downsides of WebForms and MVC gives you much better flexibility. But think about some of the trivial (read: boring) tasks which we have to do as developers:
- Create a login form
- Output a collection of data using a template
So with MVC this is something that you end up having to write yourself, sure there are some helpers like
Html.EditorForand stuff so you can quickly display something. And it’s true there’s plenty of good extensions to do things like Repeaters, so this is just taking WebForms concept into MVC right?
One of the other main criticisms of controls is that they generate HTML for you that is hard to style, and often unchangable. But think about what they are trying to generate, a standard design cross-browser. Try having a floating layout which can be dropped anywhere and look the same?
True it makes them less flexible, but it depends what you’re trying to achieve
Sure, controls are great because they allow us to componentize and reuse functionalities but with a greater sacrifice. If you just want to get up and going looking like ooh say anything else but precise, webform controls will do it well. Webforms are great in its composition architecture and since its been around for a while (.net world), its proven itself with a ton of best practices and guidlines. On the other hand, I(I spoke for myself and only myself) dislike it because it tends to create what i call “robot developers”. Run an http test against a decent webform dev and you will actual find out what he knows about the underlying technology. Sure, they dont “need” to know it because they just have to drag and drop control but… you(assuming you agree) and i know that in order to build great application, you almost have to go beyond drag&drop and property setting. Another issues I have with webforms is the inability to control the html rended by the controls. The author asserts that its hard to stay compliant with the statement- “One of the other main criticisms of controls is that they generate HTML for you that is hard to style, and often unchangable. But think about what they are trying to generate, a standard design cross-browser. Try having a floating layout which can be dropped anywhere and look the same?”, but that’s only useful, again, to the “robot develper” because instead of learning how to do it using the right technology(thml,css,js), they end up relying on the control to do it. To add to injury, even though they are designed to generate standard cross-browser html ,they don’t. There are too many browsers to think your webform control will work flawlessly in everyone of them. In conclusion, controls in asp.net webforms hurts the framework to some extent. I will advocate controles but only when the engineer has the ability to make modification when need be. That’s why I love asp.net mvc. It takes sometime to get up to speed and yes it has its own problem but in the end, I believe as a designer/developer, asp.net mvc is more rewarding that asp.net webforms. Hopefully, asp.net mvp will bring these two together.
Credits: Post image by ksomero at odosketch.com