One of the things I don’t like about ASP.NET is [runat=”server”]. Why can’t we set [runat=”server”] to be the default for certain tags? After all, isn’t every tag that starts with “<asp:” run at the server? Why make me bloat code? Why put something there I might forget to type and then waste my time figuring out while debugging?
I understand your point, but the importance of [runat="server"] is more for consistancy and extensibility. If the developer has to mark some tags some ways (ie an "asp:" prefix) and in other cases using runat, then it creates more confusion. Also, this simplifies what is sent directly to the user agent as a Response.Write and what needs to be parsed by the ASP.NET engine. What if some user agent of the future has a name collision with one of the ASP.NET tags, it would be difficult otherwise to tell ASP.NET to ignore a tag.
See discussion continued here:
http://mikeschinkel.com/blog/whyrunatserverforaspnetpart2/
Mike, I’m so glad you wrote this entry, I completely agree, it makes no sense to me, surely would make more sense as besides the runtime errors, it’s really hard to skim a page and see what server-side tag is typoed when runat=”server” makes them NOT LOOK LIKE SERVER-SIDE TAGS.
Ahem. I’m a little frustrated as you can tell.
Coming from PHP and JSP land, this mixed-metaphor concept is utterly ill-conceived (and I thought JSP was quirky!).
Thanks again for sharing.
-Barnaby
Barnaby: You are absolutely welcome. It’s that kind of pedantic purity that was a major reason I eventually gave up on the Microsoft web platform and finally embraced the pragmatic expediency of the LAMPhp platform. Know what? I’m now only bothered that I didn’t embrace it a lot sooner.
Since crossing over the fence, I’ve come to realize more and more what a huge architectural mistake the ASP.NET platform was. You don’t build web apps with ASP.NET, you build ASP.NET apps that happen to live on the web, and that’s not good enough.
At this the point the only thing that the MS web platform has that interests me at all is PowerShell and IronPython, and the DLR. Shame, because PowerShell rocks, but MS’ web platform offerings are too bogged down by legacy bad decisions.
For your sake Barnaby, hope you can make it back to PHP soon.