Saturday, August 04, 2007

Introduction to Microsoft Dot Net Framework

What the heck is Dot Net ?
Dotnet is the latest software development framework from Microsoft. Software Development can be written in any dotnet language like c#, VB, c++, Cobol. Compiler converts the syntax to a Portable Executable (PE). PE contains a mixture of Header tables, MetaData and Intermediate Language (IL). IL is somewhat similar to Assembly Language.
Once you execute the PE, the Common Language Runtime (CLR) compiles IL into Machine Code caches it in the system and executes the code. Recompiling of the IL is done by CLR only if there are changes to the source Code.
Any code which targets the CLR is said to execute in a Managed Environment. All other code like MFC/ Windows SDK all run under unmanaged environment.

Most Important advantages Dot Net-
* Automatic Memory Management, you don't need to worry about Memory Allocation and De Allocation in your programs. Garbage Collector takes care of it.
* Programming in a Type Safe Environment. You cannot Cast one Type to another Type without any relation and getaway with it. So you don't have worry about naming your variable hungarian notation.
* Unified exception handling, All the errors are trapped using try/catch/finally blocks.
* Full blown support for Object Oriented Programming and XML.
* Single Database access methodology using
* Finally a rich framework classes though Framework Class Library (FCL). Which can solve close to 90% of the real world problems.
* provides a powerful way to create web applications.
* Support for Webservice is built in.

Back to Top

What language should I use C# or VB.Net ?
Microsoft development environment was very messy with so many programming models. There was VB, C++, MFC,Win32, ISAPI, ASP, COM etc. Every programming environment had its own look and feel. Dot Net was a real unifying factor.
There was a perception in programming community that VB programmers are not real programmers. Plus VB increased productivity but was not powerful. You need to tap into the raw win32 calls if you needed anything extra.
.Net framework has now made it a level playing field. All languages are compiled to a common IL. Speed wise developing in VB will have the same impact as c# . Important features of Dot Net will be shared by both these languages.
But there are differences which need to be taken into account-
* You can call unsafe code in c#. (Not a big deal, for newer developments, there are 99% chance you will never use this feature).
* You can generate documentation in XML from c# through comments. (Very important if you are developing APIs, if documentation is added in the development phase then from VS you can generate automatic documentation).
* If you are developing Custom controls, then c# is the way to go. The Event Handling model in C# is optimized compared to VB if your control handles hundreds of Events. For more information look into my Server Controls section.
I would strongly recommend using c# over VB. Just because of the fact Microsoft is investing heavily on c#. Lot of Redmond's new development is currently done using C#. Eventually generics will be added to c#. Eventually VB will catch up with c#, but the question is when? c# will always be a trend setter.

No comments: