Monday, July 16, 2007

dotNet Framework basics

Components of .NET framework :
1. Common Language Runtime ( CLR )
2. .NET framework base classes
3. User and Program interfaces

CLR Services :
1.Code compilation
2.memory allocation
3.Garbage collection

Converts Source code to IL, IL to JIT compiler.
IL language to machine language conversion takes place at runtime.

Two stages of compilation
1. Source code to IL ( During the process of compilation, compiler also produces meta data about code... )
2.IL to machine code ( Done at Runtime by JIT compiler... )
Meta Data contains the description of code such as classes, interfaces, dependencies and versions of the components.
IL and Meta data constitute an assembly. ( Assembly contains both IL and meta data ).
Meta data describes the assembly's internal version number and details of all the data and object types they contain.
In .NET, Assembly is a single file with the extension .exe or .dll . Assemblies can also contain one or more modules.

During Execution, CLR performs the following steps :
1.Loading assemblies and identifying namespaces :
Assemblies are loaded in the memory. After loading assemblies, CLR identifies namespaces for code in assemblies.
Namespaces are collection of classes. The .NET framework uses namespaces to organise its classes hierarchy.
(Namespaces implicitly have public access and this cannot be changed)

2.JIT compilation :
Before Execution, IL is converted in to machine language by the JIT compiler. Next during the verification process,
the IL code is examined to confirm the following points :
i. Memory allocations for code
ii. Methods are called only thru properly defined types
iii. IL has been correctly generated

3.Garbage Collection :
Garbage Collection process begins after the JIT compilation and manages all the memory allocation and deallocation of an application.
whenever u create an object , the CLR allocates memory for the object from the managed heap.
A managed heap is a region of memory that is available for program execution.if sufficient memory is not available on the managed heap,
the garbage collection process is invoked.

CLR manages the compilation and execution of the managed code to ensure proper functioning of a code.

For Example, CLR take care of
1.Garbage collection
2.Exception Handling
3. Type Safety for managed code.

The unit of execution in the CLR is an assembly. Assembly contains IL and metadata. All assemblies contains manifest which contains information such as assembly name, version and the list of files that form the assembly. The IL code can not be executed if it doesnt have an associted assembly.
Meta data :
describes the assembly's internal version number and details of all the data and object types they contain.
Manifest :
contains assembly name, version and the list of files that form the assembly
.NET framework base class library :
this library provide classes that can be used to accomplish programming tasks such as data base connectivity,string management, data collection
and file access.

Namespaces :
Namespaces help us to create a logical group of classes. Namespaces can be used to avoid naming conflicts between classes which have same names.

the .NET framework uses a dot delimiter between namespaces and classes. System .Console
System is namespace and Console is a class.

Assembly :
An assembly is a single deployable unit that contains all the information about the implementation of classes, structures and interfaces.
the assembly stores all the information about itself. This information is called metadata and includes the
1.name and version number of the assembly
2.security information
3.information about the dependencies and the list of files that constitute an assembly.
Assembly and meta data provide the CLR with the information required for executing an application.
For Example if an application uses a component, the assembly keep track of version number of the component used in the application.


User and program interfaces :
.NET framework provides three types of user interfaces .
1.Windows Forms
2.Web forms
3.Console applications

Advantages of .NET framework ;
1. Multi platform applications
2.Multi language integration
3.Automatica resource management
while creating an application, a programmer may be required to write code for managing resources such as files, memory, network connections and database connectivity. if the programmer does not free those resources, application may not execute properly. The CLR automatically tracks resource usage and relieves a programmer of the task of manual resource management.
4.Ease of deployment

Labels:

0 Comments:

Post a Comment

<< Home