Introducing Microsoft .NET, Page 2
.NET Framework Process in Detail
Every programming language has its own processes for compiling and executing its source code. This article will look into these aspects of C#. You have to be thorough with this process, without which it's not possible to move ahead to other sessions.
The whole process is elaborated below and Figure 1 explains this process in a diagrammatic manner:
- The programmer writes the source code using C# language conventions.
- The source code is compiled using a C# Compiler (csc.exe).
- The compiler converts the source code into an Intermediate Language, much like byte codes in Java. The IL can be either an executable (exe) or a Dynamic Link Library (DLL). Because the IL is generated by the C# compiler, it is called Managed Code. Managed Code can be executed only on a .NET-aware platform.
- The compiled file unit is executed using the C# Interpreter. Upon execution, the code is checked for type safety. Moreover, the Just In Time (JIT) compiler compiles the unit into Managed Native Code and finally Common Language Runtime (CLR) produces the final output.
The final unit can be executed on any system that has Common Language Runtime installed on it. The C# compiler and interpreter will be installed at the time of installing the .NET Framework Software Development Kit (SDK). The SDK can be downloaded from Microsoft's Web site or can be obtained on a CD-ROM. You can find a list of related links at the end of this article.
The above-mentioned steps are applicable to all .NET languages. For instance, Visual Basic .NET also follows the same steps for its source code. It is due to this reason that .NET technology has become popular while still in the beta stage.
The above-mentioned steps are outlined in Figure 1 for better understanding of the topic.
Figure 1—.NET framework Process
Terms Associated with Microsoft .NET
Common language runtime
Common Language Runtime, also called CLR, provides a universal execution engine for developers' code. It generates Simple Object Access Protocol (SOAP) when it makes remote procedure calls. SOAP is a protocol used to access .NET Web Services. CLR is independent and is provided as part of the .NET Framework. The main features of CLR are as follows:
- Managed code
- Automatic application installation
- Effective memory management
- Automatic garbage collection
- Very high level of security while executing the programs
.NET framework class libraries
The .NET Framework class libraries work with any language under the Common Language Runtime environment. These libraries will be automatically installed at the time of running the .NET SDK Setup program. Therefore, if you are familiar with one .NET language, you can easily migrate to other .NET languages without spending much time learning new syntaxes and conventions.
You can develop three kinds of tasks using these class libraries. They are Windows Forms Programming (popularly called WinForms), Web Forms Programming, and Web Service Programming. Windows Forms are used to develop Windows-based graphical user interface applications. They are like standard exe applications in Visual Basic 6.0. All .NET languages use this concept of WinForms for developing Windows-based applications. Web Forms are used to design and develop Web-based applications. WebForms are used to create GUIs for ASP.NET applications. They can perform event handling and Validate Fields; they also can perform a lot of other functions. On the other hand, Web Services are components, which have no user interfaces and are consumed by Web applications. Web Services combine the power of HTTP and XML to generate SOAP, which is termed as a lightweight XML-based protocol. SOAP stands for Simple Object Access Protocol. A complete discussion on Web Services is beyond the scope of this article.
Figure 2 shows an outline of the .NET Framework hierarchy.
Figure 2—.NET framework Hierarchy