Thursday, October 18, 2007
Common misconceptions in ASP.Net
Misconception: "ASP.NET is interpreted or semi-interpreted" Fact: ASP.NET (and indeed, .NET as such) applications executes fully compiled. The misconception stems from the fact that this compilation is a two-step process, where ASP.NET is first compiled into intermediate language (IL). This can be done using a compiler such as the C# compiler. Only just before actual execution on the target machine does the .NET CLR take over and compile the IL into machine instructions optimized for the target architecture. The developer has no control of this process. The ASP.NET runtime will then cache the compiled code for subsequent executions. Misconception: "ASP.NET relies heavily on code generation" Fact: ASP.NET is a highly abstracted framework for web development with feature rich components (widgets). Visual Studio will assist in configuring properties for these widgets, but in general they come with good defaults. Hence, VS has editors for special file formats, but no code generation in the sense that it spews out C# or VB.NET code which must be manually edited to suit different needs afterwards with the risk of losing custom changes when the code needs to be once again generated. In a number of places ASP.NET relies on metaprogramming, examples of this are: Compiling an .aspx markup file into a partial class, compiling a XML schema (representing a dataset) into .NET classes. One exception where code generation could be said to take place is when you define a dataset from an existing database by dragging and dropping tables from the database schema to the XML schema file. Misconception: "ASP.NET relies heavily on Visual Studio" Fact: An ASP.NET web site/application can easily be created using any text editor. Since compilation is handled by the server the markup files can be uploaded as source code to the server. Documentation (or experience) will be required to use the web controls/widgets in this way. For example, no vendor has implemented Intellisense.