Wednesday, April 30, 2008

Some basics of Microsoft .NET - Part 02

Features of .Net explained…

· Object Oriented Development Environment.
· Automatic Garbage collection
· Interoperability
· No COM Required
· Simplified Deployment
· Type Safety

Object Oriented Development Environment.


Basic Components of .Net ( CLR, BCL, and Programming Languages like C# or VB) all are perfectly designed to work in a well integrated Object oriented environment. One of the keen feature of .Net framework is its consistent Object oriented programming model.

What surprised me is that, it even provide a wide range of platform target. You can write a web application or windows application which can work from high end servers to a Cell phone.
Who else will give such a broad range ?? :)

Automatic Garbage collection

If you are C++ or C programmer you will feel relief now… CLR has a tool called Garbage Collector which automatically manages memory. Well its like a memory watcher but does more.

Garbage collector deletes all objects from memory which is no longer accessed in the program. ( means less effort in memory management of your application)

As I told earlier, if you are traditional programmer, you will be hunting for all kinds of memory leaks and will be reallocating those memories. Well this is not a small feature, believe me it’s a time taking task to find out the memory leak issues… In these cases Garbage collector is a great pain reliever .. :D


Interoperability


Interoperability, I guess this will be one among the most good feature that attracted many programmers. .Net Framework is designed to work with different .Net languages , different OS and different COM components.

Recently I read a whitepaper from Microsoft, it says .Net framework will soon support programming languages like Python and Ruby. Means it will become DLR ( dynamic Language Runtime environment).

.Net even allows to inherit from a class written in another . Net language ( as long as certain rules are followed ).

Platform invoke feature ( managed code) allows code written in .Net to call and use code which were not written for .Net , such as win32 system calls.

Are you a MFC coder ? or does your current programs uses lot of COM components ?
No worries… .Net framework allows interoperability with COM. Means .Net components can call a COM component and COM component can call .NET components.


No COM Required
.Net framework will free you from the bondage of COM legacy. Since you will not need any of the following as in COM programming ( following are familiar for COM programmers… others just pass on J )

o IUnknown interface :
§ In COM all objects must implement the interface IUnknown.
§ All .Net objects are derived from a single class known as Object. Interface programming is never a central theme any more.
o Reference Counting :
§ Programmer no longer has to keep count of references to objects. Garbage collector keeps track of all references and it removes the inappropriate objects.

o HRESULT :
§ Atleast some of you might have seen this word. It shows up when errors occur in COM. HRESULT data type is used for returning runtime error codes.
§ In .Net its no longer used, instead all runtime errors produces exceptions. And of course, we can handle all these exceptions in the code.

o Registry settings:
§ If you have developed any application and deployed using any other .Net languages, you knows the headache that comes with registry.
§ .Net simplifies the deployment ( both installation and removal) of programs , not using operating system configurations or application configurations in the registry.
Simplified Deployment


Oops.. I have to tell the same thing here.. “.Net simplifies deployment because it seldom uses registry settings. ”
One good advantage is the side-by-side execution of different versions of a DLL. Earlier DLLs were used based on their names. But .Net applications uses only that DLL for which it was built.
Type Safety


Its CLR again.. CLR checks for type safety of parameters and data objects used in .NET


An overview:
Well, I will give you an overview of Compilation and Execution process in .Net.



Compilation and Execution process is same regardless of the Language of the original Source file.

Hmmm… two type of compilations.. CIL and Native code compilations… will explain more later…

No comments: