Best Blogger Tips

Wednesday 13 June 2012

.NET Tutorial: 1

Firstly with some general terms:

What is Website.?
A website is a collection of web pages (documents that are accessed through the Internet), such as the one you're looking at now. A web page is what you see on the screen when you type in a web address, click on a link, or put a query in a search engine. A web page can contain any type of information, and can include text, color, graphics, animation and sound.
What is Webpage?

A web page or webpage is a document commonly written in HyperText Markup Language (HTML) that is accessible through the Internet or other network using a browser. A web page is accessed by entering a URL addresses and may contain text, graphics, and hyperlinks to other web pages and files. The page you're reading now is an example of a web page
  •  Website always run at web server and it views in html form at the client site.

[Client - it is a user who access the website from its home by writing the web address of website in its web browser.]

In the case of a website created by .NET technology the web server MUST be of Microsoft.

.NET Framework:- Collection of tools, technologies and languages which work together to communicate on MULTIPLE PLATE FORM.

NOTE- .NET Framework DON’T install on Non-Microsoft operating system.

.NET Framework Architecture:

*      CLR (Common Language Runtime):- It is an environment which manage the execution of code.
  • Memory management.
  •  Garbage collection.
  • Support multiple languages. (more than 45 language).
Now you all know what is memory management , but the question arise what is Garbage collection ??

.Net Framework's- Memory Management Garbage Collector which manages allocation and release of memory from application. Now developers no need to worry about memory allocated for each object which is created on application. garbage collector automatically manages memory on application.

Garbage Collection
The heap memory is divided into number of generations. Normally it is three generations. The Generation 0 is for short live objects, Generation 1 is for medium live objects which are moved from Generation 0. Generation 3 is mostly stable objects.

When an object is created then it will allocate the memory space which will be higher. It will be in the Generation 0 and the memory allocation will be continuous without any space between the generations of garbage collectors.

How it works

Implicit Garbage Collection should be handled by the .Net framework. When object is created then it will be placed in the Generation 0. The garbage collection uses an algorithm which checks the objects in the generation, the objects life time get over then it will be removed from the memory. The two kinds of objects. One is Live Objects and Dead Objects. The Garbage collection algorithm collects all unused objects that are dead objects in the generation. If the live objects running for long time then based on that life time it will be moved to next generation.

The object cleaning in the generation will not take place exactly after the life time over of the particular objects. It takes own time to implement the sweeping algorithm to free the spaces to the process.

Implementation of automatic and forcefully garbage collection:

Memory Allocation of object:
XYZ x;                                      (memory allocation in STACK)
XYZ x= New XYZ;                     (memory allocation in HEAP)

[Where XYZ is class and x is its object.]

The memory of object created by second method in heap need to destroy forcefully. So garbage collection is not only an automated process it can also be used forcefully.

*      CTS (Common Type System)-
Common Type System (CTS) describes a set of types that can be used in different .Net languages in common . That is , the Common Type System (CTS) ensure that objects written in different .Net languages can interact with each other. For Communicating between programs written in any .NET complaint language, the types have to be compatible on the basic level .

  • What functions does the Common Type System perform?
    • Establishes a framework that helps enable cross-language integration, type safety, and high performance code execution.
    • Provides an object-oriented model that supports the complete implementation of many programming languages.
    • Defines rules that languages must follow, which helps ensure that objects written in different languages can interact with each other.


  • What types does the Common Type System support?
    • Value types

      Value types directly contain their data, and instances of value types are either allocated on the stack or allocated inline in a structure. Value types can be built-in (implemented by the runtime), user-defined, or enumerations. For a list of built-in value types, see the .NET Framework Class Library.
    • Reference types

      Reference types store a reference to the value's memory address, and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. The type of a reference type can be determined from values of self-describing types. Self-describing types are further split into arrays and class types. The class types are user-defined classes, boxed value types, and delegates.
*      CLS (Common Language Specification)-
This is a subset of the CTS which all .NET languages are expected to support. It was always a dream of Microsoft to unite all different languages in to one umbrella and CLS is one step towards that. Microsoft has defined CLS which are nothing but guidelines that language to follow so that it can communicate with other .NET languages in a seamless manner.

*      Base Class Library:
Collections of standard classes ( common classes) which we can use in .net supportive languages.

To be continued in next part of tutorial….

No comments:

Post a Comment