whateverblog.
Essential ASP.NET
Tuesday, June 10, 2003 06:35 PM

I thumbed through most of Essential ASP.NET by Fritz Onion this weekend. It's a great read; not at all dumbed down in the way that many Microsoft-technology books seem to be (e.g. ones with "Step by Step" or "Teach Yourself... In 24 Hours" in the title). I'm really impressed with Addison Wesley in general; I think almost all of my favorite tech books are AW.

I really had ASP.NET pegged wrong; it's quite a different beast than I thought. You're not at all tied into the Web Forms model, though they push you very hard in that direction (especially if you use VS.NET). Design-wise, ASP.NET probably owes more to servlets/JSP/JSF than to "classic" ASP.

JSP pages compile to Java classes; ASP.NET pages compile to .NET classes. Servlets let you change configuration/deployment properties via web.xml; ASP.NET lets you do the same with web.config. Servlet containers automatically expose Java classes stored in /WEB-INF/lib and /WEB-INF/classes; ASP.NET exposes .NET DLLs stored in /bin. More recent versions of the Servlet API allow you to pre- and post-process requests with HttpFilters; ASP.NET gives you HttpModules. Contrast this to ASP which (to my limited knowledge) was fully interpreted, had most settings stored in IIS, and interoperated mostly with COM.

ASP.NET's code-behind feature is rather nice; I don't think there is anything quite like it in JSP just yet. It gives you a very clean physical separation between the presentation and UI logic, yet keeps them very tightly coupled--so tightly coupled that the compiler can do a decent job of detecting when the page and the code are out of whack. Every aspx page compiles to a subclass of System.Web.UI.Page; by enabling code-behind for a page, you are basically directing that page to extend a specific subclass of Page instead of extending the generic Page class. So any code that you write in the code-behind class is available in the aspx page, and (through some reflection) your code also has direct access to the controls in the aspx page.

Boy, I did a really poor job of explaining that. That's why Fritz Onion is an author and I'm not...

The bottom line is, ASP.NET looks like it can go toe-to-toe with Servlets/JSP on most fronts--they've basically "copied" most of the ideas from the Java camp, and then added Web Forms. Not that the Java camp won't be there soon; the JSF spec is in public review and there has been a reference implementation available for a while now. Now that I fully grok Web Forms, I'll have to take a second look at JSF...