Microsoft .NET platform includes the following components that would help develop a new generation of smart Internet services:
- .NET infrastructure and tools
- .NET user experience
- .NET building block
- .NET device software
Origin of .NET
Before going to discuss about .NET, we should discuss about the origin of .NET and its features.
- OLE technology
- COM technology
- .NET technology
OLE (Object Linking and Embedding) technology was developed by Microsoft in the early of 90s to enable easy interprocess communications. OLE provided support to achieve the following:
- To embed documents from one application into another application
- To enable one application to manipulate objects located in another application. This enabled users to develop applications which required inter-operability between various products such as Microsoft Word and Microsoft Excel
At first of COM technology, the monolithic approach had been used for developing software. But when programs become too large and complex, the monolithic approach leads to a number of problems in terms of maintainability and testing of software. To overcome the problem, Microsoft came up with component based model for development software. In this approach, the software is broken up in number of modules (independent components) where each one offers a particular service. Each component can tested and developed independently and then integrated with the main system. This technique is called Component Object Model (COM) and the software built using COM is referred to as componentware.
It provides great flexibility to developers:
- Reduce overall complexity of the software
- Enable distributed development across multiple organizations or departments
- Enhance software maintainability
.NET technology is a third generation component model. This provides a new level of inter-operability compared to COM technology. COM provides a standard binary mechanism for inter module communication. This mechanism is replaced by an intermediate language called Microsoft Intermediate Language (MSIL) or IL. Various .NET compilers enforce interoperability by complying code into IL, which is automatically compatible with other IL modules. An inherent characteristic of IL code is metadata. Metadata is data about the data and describes its characteristic, including data types and locations. IL allows for true cross language integration. In addition to IL, .NET includes a host of other technologies and tools that will enable us to develop and implement Web based applications easily.
The .NET Framework
In short, .NET Framework provides an environment for building, developing and running web services and other applications. It consists of three distinct technologies:
- Common Language Runtime (CLR)
- Framework Based Classes
- User interface program (ASP.NET and Winforms)
We can say CLR is the heart and soul of the .NET Framework. As the name suggests, CLR provides run time environment in which the program written in C# and other .NET languages are executed. It also supports cross language interoperability.
CLR supports a number of services as follows:
- Loading and execution of the program
- Memory isolation for application
- Verification of type safety
- Compilation of IL into native executable code
- Providing metadata
- Memory management (automatic garbage collection)
- Enforcement of security
- Managing errors and exceptions
- Support for tasks such as debugging and profiling
- Interoperability with other systems
Common Type System (CTS)
The .NET Framework provides multiple language support using the features known as Common Type System that build into the CLR. The CTS supports a variety of types and operations found in most programming languages and therefore calling one language from another does not require type conversions. We can build .NET program in a number of other languages including C++ and Visual Basic .
Common Language Specification (CLS)
The CLS specification defines a set of rules that enables interoperability on the .NET platform. These rules guide the third party compiler designers and library builders. The CLS is a subset of CTS and therefore the language supporting the CLS can use each others' class libraries as if they are their own.
Microsoft Intermediate Language (MSIL)
MSIL simply called IL, is an instruction set into which all the .NET programs are compiled. It is akin to assembly language and contains instructions for loading, storing, initializing and calling methods. When we compile a C# program or any program written in a CLS compliant language, the code is compiled into MSIL.
CLR is responsible for managing the execution of code compiled for the .NET platform. The code that satisfies the CLR runtime in order to execute is referred to as managed code. Compiler that is compatible to the .NET platform generates managed code. The managed code generated by C# is IL code.