Several of my college-mates ask me where exactly to start learning .NET. So I thought I would actually include some .NET tutorials in my blog. As promised earlier, Iam starting with my series for tutorial articles on .NET. I shall categorise them into various levels. Iam starting off with level-beginer. The first one can be found here.
Level: Beginer
So what is this .NET???
Let's take the definition from the creators themselves.
....NET is the Microsoft Web services strategy to connect information, people, systems, and devices through software. Integrated across the Microsoft platform, .NET technology provides the ability to quickly build, deploy, manage, and use connected, security-enhanced solutions with Web services. .NET-connected solutions enable businesses to integrate their systems more rapidly and in a more agile manner and help them realize the promise of information anytime, anywhere, on any device...
Understood??? Let me elaborate it.
People ask me "Is .NET a programming Language??", "Is .NET an Operating System?", "Is .NET a specification?" and so forth
The answer is NO.
.NET is a Software Development Platform to develop applications that span across multiple devices and multiple architectures.
Code execution in .NET is somewhat similar to the concept involved in Java Virtual Machine. I am using the word Java here because many of us would be familiar with this.
There are actually many many languages which support .NET. What does this mean?? Consider JVM.
What does JVM execute? Answer: The Class File.
What creates the Class file? Answer: The JAVA Compiler.
What is given as input to the JAVA compiler? Answer: A Java Program.
Java World .NET
JVM: CLR (Common Language Runtime)
Class Code: MSIL (Microsoft Intermediate Language)
JAVA Program: ANY .NET supported Language
In .NET, you first write your code in your favorite .NET language. ( C#, VB.NET, J#, VC++.NET, APL, C, COBOL, lcc, Python, Perl..).
Your input code would be compiled into an intermediate architecture independent representation [a complete language in itself] called MSIL. (Microsoft Intermediate Language)
Naturally the next step would be to convert this MSIL code into the native machine code.
Some key differences between the two environments..
Source Programming Languages:
In JAVA environment the only input language available is Java.
In .NET you have many many languages supported. Infact you yourself can create a language, call it yourname.NET (remove the .NET if u don't like it) and write a compiler for it, which converts the code written in that language into the MSIL. You are free to do so. [There are some factors/standards/specifications to be considered]
Now since, one major advantage of this .NET is interoperability there has to be some standard to be followed by these languages. That's standard is defined in CLS-Common Language Specification.
Now talk about MSIL.
This too is very different from Class code in Java.
That is, when you see the Java class code can you understand anything??
I bet you cannot. It is just some junk code. But that's not the case in MSIL. MSIL is itself a language. You can code in MSIL. It has all the features that exist in any .NET supported language. Infact there are some really superb books on MSIL itself.. You can master .NET if you read those.
Since many of these languages get converted to MSIL, there would certainly exist some datatype conflict. To resolve this there is something called Common Type System. In fact that defines the datatypes available in MSIL. The Common Type System defines how types are declared, used, and managed in the runtime, and is also an important part of the runtime's support for cross-language integration. The Common Type System performs the following functions:
-Establishes a framework that enables 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
The MSIL is independent of architecture.
Native Code Generation
Now this MSIL is converted into native code by the execution engine. These days people call this kind of Execution Engines as Virtual Machines. Actually it's not a Virtual Machine. Remember what's exactly a Virtual Machine? You would know if you have studied an OS course before the evolution of JVM (IBM's VM). To be simple the term Virtual Machine is used for a software/hardware emulation of the underlying machine.
Hence it is technically incorrect to call the Java Execution Engine (JVM) as a Virtual Machine. So I will call JVM an Execution Engine.
[Any Java Programmer will kick me if I say there is no Virtual Machine involved in Java Program Execution].
In .NET this Execution Engine is called CLR (Common Language Runtime).
Hence the job of CLR is to execute the MSIL. So the CLR has to be architecture/OS dependent.
Another question that I have come across is "How do I install .NET?"/ "Can you get me .NET CD?"
Technically there is no answer for this. There is nothing called .NET CD.
To develop applications in .NET, the .NET framework has to be installed first.
.NET Framework??: What does this contain?
Everything needed to develop and deploy a .NET application. It includes compliers for Microsoft Languages like VB, C#, etc.. It contains a large set of built-in Classes neatly organized into namespaces. It also contains the CLR.
So to write a program and execute it on a Windows Machine you just need the .NET framework. Version1.1 is the stable version currently available. It is FREE to download on Microsoft's Site. It is a 23 MB download. It can be installed on Windows 98 or higher Operating Systems.
How to execute a program using .NET framework alone?
Type-in your HelloWorld program in your favorite editor.
Compile it in command line. Eg. If it's a C# program, the compiler to be used in csc.exe. So compile it as csc filename.cs . It compiles and you see the exe file generated. The Visual Basic compiler is vbc.exe . (Files vbc, csc, jsc etc are present in the .NET framework).
Now run the exe file and you get your output.
The .NET framework is installed in your OS directory.
23 MB??? My Maam said .NET it's a 5CD software???
hmmm.. Your maam is an idiot. To be specific she is talking of Microsoft Visual Studio package. Microsoft Visual Studio package was very well available even before this .NET came. But previously you compulsorily needed VS to develop applications in those languages. The VS had the compiler. Now it's not so. They give out the compilers for FREE.
The Visual Studio versions after Visual Studio 6 were called Visual Studio.NET.
Visual Studio.NET is very much needed for Visual Programming.
Some features of Visual Studio.NET Software:
Increased programming productivity, Easier to write code: drag and drop Web App and Services Development, Fully supports the .NET Framework, Simplified development, Multi-language support,Improved debugging, Unified IDE, Powerful design tools, Windows Forms, Web Forms, XML and component designers, Consistent set of tools across languages..
It also contains excellent debugging tools. It also has editors for VB, VC++, C#, J# etc and some plug-ins can be installed to support many others. It also has emulators for Windows based mobile devices. [This is the situation where the term Virtual Machine should be used. Windows CE.NET or Windows Pocket PC is emulated]
Visual Studio.NET 2003 is the most recent stable version. It consists of 2 CD's. The remaining 3 CD's your Maam is talking about are actually MSDN. It's a library with tones of tutorials, code, books, articles,...
And it COSTS.
So was this sufficient?? NO, NO, NO.
This tutorial article will be continued. I have not yet discussed about the real Power and real Need of .NET- Interoperability, Component based Development, Web Services, minimized software deployment and versioning conflicts, managed code, garbage Collection, ASP.NET, Globalization/Localization support….and the list goes on.
to be continued..
Bharath Ganesh
Microsoft Student Champ
Chennai, India
bharathganesh@gmail.com
Can also read from: http://dotnetjunkies.com/WebLog/bharath/articles/44112.aspx