31 January 2013

What is .Net Framework ?

The .NET Framework is an environment for building, deploying, and running Web Services and other applications. It consists of three main parts: the Common Language Runtime, the Framework classes, and ASP.NET.
.Net Frame work is platform where developer develops web application,windows service,web services ,WCF services,Remote servics and also deploy the applications.
It has two components
1.CLR :Common language Runtime
2. Class Liberary.
Common Language Runtime :
The Common Language Runtime (CLR) Environment provides a rich set of features for cross-language development and deployment. CLR supports both object-oriented languages and procedural languages. CLR manages the execution of code and provides various services such as security, garbage collection, cross-language exception handling, cross-language inheritance, support for the Base Class Library (BCL), and so on. These are the main constituents of the CLR:
  • The Common Type System (CTS) supports object-oriented programming languages as well as procedural languages. Basically CTS provides a rich type system that's intended to support a wide range of languages.
  • The Common Language Specification (CLS) is a subset of the Common Type System, to which all language compilers targeting CLR must adhere.
  • All compilers under .NET will generate a uniform, common language called Intermediate Language (IL), no matter what language is used to develop the application. In fact, CLR will not be aware of the language used to develop an application. For this reason, IL can be considered the language of CLR—a platform for cross-language development.
  • The Just in Time (JIT) compiler converts the Intermediate Language code back to a platform/device-specific code. In .NET you have three types of JIT compilers:
  • Pre-JIT (compiles entire code into native code at one stretch)
  • Ecno-JIT (compiles code part by part, freeing when required)
  • Normal-JIT (compiles only that part of the code when called, and places it in the cache)
  • Type safety is ensured in this phase. In all, the role of a JIT compiler is to bring higher performance by placing the once-compiled code in cache, so that when the next call is made to the same method/procedure, it's executed at a faster speed.
  • The Virtual Execution System (VES) implements the Common Type System. VES loads links and runs Portable Executable (PE) files. VES also ensures loading of the information contained in metadata.
  • Metadata describes and references the datatypes defined by the VOS type system, lays out instances of classes in memory, resolves method invocation, and solves versioning problems (DLL hell).
Figure 1 depicts the .NET architecture.
Figure 1 .NET architecture.
The Windows operating systems run on the Intel family of microprocessor chips. To generate platform-neutral code, two things should happen:
  • Elimination of hardware dependencies such as microprocessor instruction sets, etc.
  • Elimination of software dependencies such as operating-system-naïve API, etc.
Once the code is compiled using any of the .NET-compliant language compilers, it gets converted to IL (Intermediate Language), as shown in Figure 1. This code is not compiled to machine-native code, but to an intermediate form that doesn't contain any specific information about hardware or software dependencies. When you run this code, since it's not in machine-specific form, it fails to execute. A runtime environment is required that understands and converts the IL code to machine-specific code. This is the role played by CLR (along with the many other functions discussed earlier). I won't talk about these issues in detail here, but will instead concentrate on implementation of cross-language capabilities of the .NET Framework.

Common Language Features

  • All languages use the same library, the Base Class Library (BCL). However, the syntax used by these languages remains the same as that of the original language.
  • No language under .NET has its own library.
  • Garbage collection is the responsibility of the CLR environment and not a language.