Tuesday, 10 September 2013

Microsoft's .NET Framework

Microsoft's .NET Framework is comprised of two main components - the Common Language Runtime (CLR) and the .NET Framework class libraries. The CLR is the real foundation of the .NET Framework. It is the execution engine (runtime environment) for all .NET applications. Every target computer requires the CLR to successfully run a .NET application that uses the .NET Framework. The main features of CLR include:
1.    Automatic Memory Management.
2.    Thread Management.
3.    Code Compilation & Execution.
4.    Code Verification.
5.    High level of security.
6.    Remoting.
7.    Structured Exception Handling.
8.    Interoperability between Managed and Unmanaged code.
9.    Integration with Microsoft Office System

All .NET applications are compiled into
Intermediate Language code (MSIL). When executed on the CLR, MSIL is converted into native machine code specific to the operating platform. This process is done by a Just In Time (JIT) compiler. The code executed by the CLR is called as Managed Code. This code is type safe and thoroughly checked by the CLR before being deployed.

The .NET runtime also provides a facility to incorporate existing COM components and DLL's into a .NET application. Code that is not controlled by the CLR is called Unmanaged Code.

One of the interesting points to note is that the CLR itself manages the life of objects. This is the effect of the Automatic Garbage Collection system built into it. When the CLR finds an object that is not being used, it destroys them and thus frees their memory allocation.

The .NET Framework is further comprised of
Common Type System (CTS) and Common Language Specification (CLS). The CTS defines the common data types used by .NET programming languages. The CTS tells you how to represent characters and numbers in a program.
The CLS represents the guidelines defined by for the .NET Framework. These specifications are normally used by the compiler developers and are available for all languages, which target the .NET Framework.

Explain CLS and CTS?
CLS: Common Language specification is a set of rules that are to be followed by a language in order to be .NET complaint. This facilitates cross-language integration. Programs written in one .NET language can interoperate with programs written in another .NET language.

Common language specification defines the common types that are supported by the languages which are compatible with the .net framework. For example if u develop a web service with functions which are accepting unsigned integer values as parameter and u want to use that service in a language that won't supports unsigned integers then u will get a problem .So the languages which wants to be compatible with .net must support the types that are specified by CLS.

CTS: Common Type System
Common Type System (CTS) describes how types are declared, used and managed. CTS facilitate cross-language integration, type safety, and high performance code execution.

CTS are the service which is used by the CLR to manage the code. CTS can express the semantics of any programming language. CTS define a standard set of types and rules to create new types. The runtime understands how to create and execute these types. Compilers and interpreters use the runtime (CLR) services like CTS to define types, manage objects and make method calls instead of using tool or language specific methods. CTS goal is to enable multi language integration.

No comments :

Post a Comment