Random Screen Shots: The New Songhay System ASP.NET Design Pattern

Songhay System ASP.NET Design PatternThe 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:

  • The ServerApp.cs file contains the definition of the Server Application. This .NET class connects plain old .NET objects with ASP.NET platform.
  • The DataActivityAssemblyInfoElements.xml file 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.
  • The \Bin folder contains my plain old assemblies and ASP.NET glue Scott Guthrie knows about.
  • The \css folder contains CSS files.
  • The \js folder contains JavaScript files featuring the latest YUI build.
  • The \xslt folder 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.cs code takes XML from plain old .NET objects and transforms it with files in the \xslt folder.
  • The Client.aspx file hooks into the CSS and JavaScript like any plain old HTML file. It ‘injects’ user interface elements using minimal direct calls to ServerApp.cs and a whole boat load of YUI-based AJAX.
  • The Global.asax file 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.
  • The ServerHandler.ashx file 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.HandlePostBack() method in ServerApp.cs where 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…

It must also be mentioned that it is possible to debug ASP.NET clients with Firefox 2.0, Firebug and Web Developer. This makes developing JavaScript clients in Visual Studio much easier… and, yes, you can debug JavaScript using Visual Studio but somehow this is not presented here as a viable option…