Programming Before 1970
Before 1970, computer programming was done with languages like FORTRAN and COBOL and to an extent provided a good amount of assistance to programmers in their specific fields.
But there was always a need for a general purpose language that can help programmers to effectively write programs for literally an infinite range of fields. This very need created a challenge for many computer scientists and had compelled them to create solutions in this interest.
Denis Richie, the famous computer Scientist of AT & T Bell Laboratories and many other workers worked together seriously to create a new language of computer popularly known as the "C" language. that was regarded as a pioneering work in the field of computer science.
The C language was and is still regarded as the mother of all modern computing languages and it has various good features that assisted the programmers at that time to create efficient programs. It continued to be a language of programmers until the recent 90's before it succumbed to big challenges of modern programming.
It was recognized that the C language lacks modular and object oriented approaches of programming due to which redundancy in effort couldn't be minimized and debugging an application's problem was a very hectic and tedious task. These anomalies of language has raised eyebrows of various scientists and it was thought to re-shape it with new approaches and functionalities.
This need became the precursor for another language of C lineage known as "C++". This language has virtually all the sets of features needed in modern programming languages like a "modular design framework" and most notably "Object Orientation".
At this time, programmers thought that this was the final programming language since it has all the features that are required from a programmer's perspective.
But later that was proven wrong when the new need for "Platform Independency" was realized that was very quickly acknowledged by Sun MicroSystem Inc and they started creating the new language that has all those features that C & C++ has plus some additional features like platform independence and memory management and so on.
Although C++ can be platform independent, specific drivers would be needed for various platforms to execute the same code on multiple machines, that was again not a favorable choice of action from the programmer's point of view.
Hence Sun MicroSystem won the competition by launching their new language formerly known as "Oak" but later renamed "Java".
Java has completely redefined the programming paradigm and style by incorporating various innovative features into its framework. It was a robust, platform independent, object-oriented and scalar language.
By this time another computing giant corporation who has earlier bargained the great opportunity from IBM Inc. by carefully and cleverly replacing their market products with their technology and product. Yes! You got that right!
It was none other than Microsoft Corporation led by Bill Gates
and this decision IBM made Bill Gate became the richest man in the world. (http://en.wikipedia.org/wiki/Bill_Gates)
) ; they also took interest in programming language competition and was struggling with their offerings like BASIC. Later they produced other technologies into their operating system frameworks viz. COM/DCOM (Distributed/Component Object Model).
On the other hand Java has completely revolutionized the computer programming world and until 1999 they were the only first choice of selection for programmers.
But when Microsoft released their first public release of ".NET Framework" in 2000 then it created a great amount of competition. They carefully analyzed the weaknesses of the Java Language (that was not visible to most programmers) and has created a need in the mind of programmer by creating their framework and languages that has their own runtime environment and has a complete Integrated Development Environment (IDE).
Java lacked the IDE and it was obviously very difficult to remember thousands of library names and their functions because of which programmers need to encounter big difficulty in spite of promising and good features in the language. This led to the downfall of Java's success and has raised the flag of victory for the .NET Framework and languages!
Programming Now
Here we will discuss the various parts of the CLR. At the end of this section we will understand the first component of the .Net Framework Architecture. The next article will be based on the second component, the Common Type System (CTS).
The .NET Framework is an internal Windows component that supports the execution of applications created using various programming languages like C#, Visual Basic, F# and C++ .
The .NET Framework consists of a virtual execution system that provides a runtime environment called the Common Language Runtime (CLR) or a runtime to follow International Standards and it's the basic foundations for creating execution in various languages. It runs our code and provides services that make the development process easier and secure.
The .NET Framework comes with a single class library. And that's all that programmers need to learn!! Whether they write the code in C# or VB.NET or J#, it doesn't matter; you just use the .NET class library. There are no classes specific to any language. There is nothing more you can do in a language, that you can't do in any other .NET language. You can write code in C# or VB.NET with the same number of lines of code, the same performance and the same efficiency, because everyone uses the same .NET class library.
Note: Whether you write code in C# or VB.NET, you are actually calling methods in the same .NET class libraries. The same .NET Framework executes the C# and VB.NET applications. So, there won't be any performance difference based on the language you write the code in.
The CLR is one of the most important components of .the NET Framework architecture, also known as the runtime, because it provides various significant functionalities like Memory Management, Exception Handling, debugging, Security, Thread Execution, Code Execution, verification and compilation.
The CLR is the one who can host the a variety of languages and ensures interoperability among their code.
The CLR also supports the services that the applications use to access various resources like Collections, Arrays and so on and Operating System Folders too.
The runtime automatically releases the resources when they are no in longer use and this automatic memory management resolves the memory leaks and invalid memory references issues.
The runtime imposes code access security that is known as CAS on the code in our application.
CASCAS is nothing but a Security System of the CLR that prevents unauthorized access to the use of resources and operations that help to make our code more robust, in other words makes our code extensible and reusable.
The following are the versions of the language runtime:
Managed and Unmanaged Code and Memory Management in CLR
Managed code is the code that is executed directly by the CLR, and therefore, the application created using managed code automatically has CLR services such as type checking, security and an automatic garbage collector.
In contrast to managed code, unmanaged code is code that directly compiles to the machine code and runs on the machine it has been compiled for, it does not have such services as managed code used like security and memory management that are the part of the runtime.
It is also should be noted that the CLR compiles the application to Intermediate Language (IL) code, not machine code and this IL code includes metadata (data about data) that describe the attributes, classes, and methods of the code that resides in an assembly.
The CLR performs the following procedure to execute a piece of managed code:
- Selection of a language compiler
- Compiling the code to IL code
- Compiling the IL code to Native Code
- Executing the Code
Let's dig into each.
Selecting a language specific compiler
Refers to the process of selecting a relevant compiler on the basis of the programming language in which the application is created.
Compiling the code to IL code
This is the process of converting the source code into IL code, which is CPU independent.
When we compile any source code into the IL code, the required metadata is generated. This metadata contains the definition of types, member signature, data members in the code and other significant details that the code uses at the time of execution.
Note: The CLR locates and extracts the metadata from the file during the execution of an application's code.
Compiling IL code to Native Code
Refers to the process of converting the IL code into Native Code (machine code) by the Just-In-Time (JIT) compiler, the process of compiling and execution is done and repeated by the JIT compiler. After compiling, the code is passed through a verification process that examines the IL code and metadata to check whether the code is type safe or not. The code should be able to access only those memory allocations that it it is authorized to access. The following diagrams depict the complete process.
Executing the Code
Refers to the process of executing the machine code.
Memory Management
It is one of the most significant services that the CLR provides during managed execution, automatic memory management. The CLR uses the garbage collector to manage the allocations and release the memory for an application. This CLR features proves the overall benefits to the developer since it reduces the extra burden of writing the codes to manage memory while deploying managed applications. Automatic memory management removes many common issues such as failure to free an object that results in a memory leak or attempting to access memory for an object that is already free.
Greets!!!!
Thank you geeks.