Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

CSharp.NET Tutorial - Day 1


In this article, we will discuss what is platform dependent, what is platform independent, independency in Java, independency in .NET, and finally the most beautiful feature of .NET is Language Independency (or) Interoperability.

OS (or) Platform Dependency
In this case whenever the source Code is compile, it generates Machine code (Executable or Native), which will be generated targeting the OS on which the compilation is made because the responsibility of executing Machine code is on the hands of Operating system. So Machine code generated for one OS can't execute on others OS.

Eg: - CPP (Windows)
Source code ---> Compile ---> Machine code (exe)

In the above case because the source code is compile on windows Operating system, the generated Machine code can execute only on Windows Operating System.



Platform Independency (or) OS Independency
In this approach when we compile the Source code it gets converted into Intermediate code (Semi finished), which can be carried to any OS for execution, where a special software takes the responsibility of converting intermediate code into Machine code according to the OS.

Independency is available under both JAVA and .NET languages.

Independency in Java

Java language (Windows)
Source code ---> Compile ---> Byte Code ---> JVM ---> Machine code

In java the semi finished code is known as "Byte code" and the software which converts byte code into Machine code is JVM (Java Virtual Machine). JVM is capable of converting byte code into Machine code according to the OS on which the execution takes the place.




Independency in .NET

.NET Lang’s (Windows)
Source code--->Compile--->CIL Code--->CLR--->Machine Code

.NET is a collection of languages which allows to write the source code in any .NET language, but once we compile it, it gets convert into CIL (Common Intermediate Language). CIL code can be executed on any Machine with the help of CLR (Common Language Runtime) which takes the responsibility of converting IL code into Machine code, specific to the OS.



Both JVM and CLR are dependent on the OS where we require them separately for each OS.

Compilation and execution of .NET languages takes place as following.



As .NET is a collection of languages, Programmers have a flexibility of writing the code in any designed language. But each language uses a specific compiler for compilation of the program, where all compilers will generate similar IL code.

Note: - Because the IL is similar for all languages we call it as Common IL.

Language Independency (or) Interoperability
All .NET languages are Object Oriented like CPP and Java providing re-usability of the code. But reusability of Java and CPP is restricted to that language only, whereas in case of .NET reusability is between all .NET languages, which is possible because after compilation all languages are generating the IL code that is CIL.

CPP--->M.C--->Re-used from CPP

Java--->B.C--->Re-used from Java

C#--->CIL--->Re-used from .NET language

VB--->CIL--->Re-used from .NET language

CSharp.NET Tutorial - Day 2


This post first appeared on Dot Net Programming (C#, Asp.Net, ADO.Net, WCF, WPF, Ajax, LINQ), please read the originial post: here

Share the post

CSharp.NET Tutorial - Day 1

×

Subscribe to Dot Net Programming (c#, Asp.net, Ado.net, Wcf, Wpf, Ajax, Linq)

Get updates delivered right to your inbox!

Thank you for your subscription

×