The image at right summarizes an ASP.NET pattern Microsoft does not recommend. Before my smart-ass remarks about why this way is not promoted by Microsoft, let’s look at each file/folder shown and make brief comments for each:
ServerApp.csfile contains the definition of the Server Application. This .NET class connects plain old .NET objects with ASP.NET platform.
DataActivityAssemblyInfoElements.xmlfile stores the connection strings used by the plain old .NET objects. Our Data Activity concept is used extensively for command-line-based data management solutions so storing connection information in the usual ASP.NET configuration file is not my choice.
\Binfolder contains my plain old assemblies and ASP.NET glue Scott Guthrie knows about.
\cssfolder contains CSS files.
\xsltfolder contains almost all of the user interface declarations—this would be the central reason why you would think my solution sucks and “nobody else” can work with this code. The
ServerApp.cscode takes XML from plain old .NET objects and transforms it with files in the
ServerApp.csand a whole boat load of YUI-based AJAX.
Global.asaxfile has nothing in it but an Application directive that makes all of the ASP.NET files become aware of the existence of
ServerApp.cs. Since this feature is considered “backwards compatible,” Microsoft may break this in the near future for the benefit of mankind.
ServerHandler.ashxfile handles REST calls and streams XML over HTTP. This is the part that should impress Paul Prescod. This file is completely generic. It calls the
ServerApp.cswhere the specific Web Application code resides.
So, now, the smart-ass remarks:
- My decision to pour whatever creativity in me into this design is not guaranteed to win friends and influence winners in the world of .NET (translation: no sexy, high-dollar consulting gigs for ASP.NET). My ‘discovery’ of this design was only possible (for me) by building something similar (simpler) in PHP 5 in a Linux environment.
- This design depends on XSLT, which seems like a big joke to most .NET authority figures. But with XSLT you write the UI once and run it everywhere. And this is one reason why Microsoft will not shoot itself in the foot and promote this technology. The other reason is that Windows Presentation Foundation does so much more than XSLT—yes, a four-hundred-foot concrete pillar does so much more than a thumbtack (but oftentimes we just need a thumbtack). Some .NET luminaries have even suggested that XSLT is “hard” and building with ASP.NET server controls is “easy.” I agree and as little as two years ago I would envy the privilege they have to work in a Microsoft-dominant IT shop. My envy is gone.
- This design uses YUI instead of Atlas—even though Atlas is platform-independent. YUI is open source, proven and mature while Atlas is a “free” release candidate. Atlas, by design, favors sending SOAP calls from the client over primal REST calls. This is because Microsoft favors SOAP over REST. For our details about this issue see the kintespace.com interview with Paul Prescod. Dino Esposito of MSDN fame has more details about Atlas in “Perspectives on ASP.NET AJAX.”
- This design takes no advantage of almost all of the new features in ASP.NET 2.0. This is why I resent studying for a certification from Microsoft. Browse through my .NET notes and you will see extensive certification coverage back in late 2004, early 2005. By making this choice, I leave myself open to legitimate criticism of my technical skills. The certified mechanics who work for Pep Boys are not trained to fix your car—they are trained to fix your car and make a profit for Pep Boys. Mastering ASP.NET server controls is supposed to be easy so I can get to that later—when I need to… right now I have real problems to respond to…