Random responses to MVC comments
Some pretty good comments in my most recent post on (re-)learning HTML in order to work with MVC. A few worth expanding upon.
Will Shaver says:
Actually... I'd counter that Javascript is the hardest tool in the box to use correctly. Harder than c#, sql, asp.net, webforms, html etc. It has several KEY differences to all other object oriented languages in the standard toolbox. Prototypal inheritance, functions are objects, objects are containers.
Even worse is the massive amount of BAD information out there for javascript. For example the || is the "default" operator and has different meanings in Javascript than in c#!
For more, read your crockford....
The Hillbilly says:
Yeah, I did kind of gloss over the intricacies of Javascript. If you use it to its full capacity, it can be pretty tough to understand. I have only vague notions of its inheritance mechanism. But the Javascript libraries available today make it easy to use without having to delve crazy deep into the more advanced concepts. I'm dancing around the line between encouraging you to look into its inner workings and encouraging you to use a library so you don't have to. Not sure where the trade-off is because I don't think I've found it yet. But Javascript still isn't too bad.
Helen says:
For me the lack of server controls is a big reason that MVC doesn't look too appealing to me because they're a big help in reusing repeated elements on different pages. WebForms is definitely a framework that's showing it's age but I kind of feel like Microsoft threw the baby out with the bath water when they designed MVC.
The Hillbilly says:
To be clear, and you probably already know this, WebForms isn't going away by any stretch. And MVC is not the next evolution of WebForms. It's a framework for building apps on the web, just like WebForms is.
But the nature of MVC as it applies to the web is such that server controls don't make a whole lot of sense. Server controls are all about managing state. The web is stateless. MVC doesn't throw away server controls. It just doesn't accommodate them because of environmental restrictions.
Also, user controls are still supported in MVC, though again, you can't really use server controls in them. Only standard HTML elements. Which means you need to manage the state yourself. And in my experience, that's a good thing because user controls are traditionally where I've had to become, shall we say, "familiar" with the ASP.NET life cycle.
Ćukasz Podolak says:
Could you explain :
"Or at the very least, that it's never been easier to add rounded corners to a DIV." ?
The Hillbilly says:
I was being flippant actually but just the same, I haven't had too much trouble. I'm using jQuery and this plug-in. I did have a problem with it working in IE because it uses excanvas which apparently IE doesn't support natively. But this library helped solve that issue. There are other plug-ins for jQuery and I'm sure you've tried some non-jQuery ones but I like this one because it doesn't add a bunch of nested DIVs to your elements to achieve roundedness.
Charlie Barker says:
The problem they have failed to come up with a solution for (as far as i know) is the 3rd party controls issue. 3rd party control developers need a way to plug their controls into the MVC framework. Without this small in-house dev teams that rely heavily on these controls will have to stick with webforms.
The Hillbilly says:
That question came up as well. As yet, I haven't found any companies offering third-party controls though I admit I haven't looked too hard. It'll be interesting to see what comes out because they'll be "limited" to what can be done in HTML. I don't foresee this being a big deal though because everything that's possible in WebForms should be possible in regular HTML, mostly because WebForms controls *are* HTML when you get right down to it. Besides which many of the vendors already offer AJAX versions of their controls. It will be a matter of getting their hands dirty and scaling back to the basics.
Keep the comments coming. This was one of the easier blog posts to write.
Kyle the Verbal