Computer programs were written using procedural languages .(C, Cobol, Pascal, etc.)
Code was written around functions; i.e., logic is built around the functions to be performed.
Object Oriented Programming (OOP) era ( C++ and Smalltalk).
Code was written around data; i.e., logic is built by identifying the data in the system and performing functions around this data.
The resources (like memory) were managed by the progra mmer and there was no runtime support provided by the programming language.
This caused a lot of problems by assigning programmers a lot of responsibilities, the mishandling of which could easily crash the whole application (and sometimes the Operating System (OS) itself).
Introduction of Java
The first commercially successful language to provide such runtime support was Java by Sun Microsystems (although runtime support was present in languages like Smalltalk).
Java comes with a runtime environment, called Java Virtual Machine (JVM) which performs memory management, garbage collection, checking of runtime data types and memory access.
Java also presented the idea of 'Platform independence' by providing their JVM implementation for several OS and different hardware. This meant that a compiled java program can run on multiple OS and hardware without any change or re-compilation (at least in theory).
Drastic changes in other popular concepts-
Eliminating Pointers, Multiple inheritance, Operator overloading and Templates.
Java a very popular language
For both academic and development environments, especially web applications.
Java provides this ease and simplification at the penalty of performance by introducing interpreter at runtime.
Disadvantage: Also, because of the platform independence of Java, it lacks in some Platform specific features such as GUI and event handling.
History of .NET
In the beginning of 1998, a team of developers at Microsoft had just finished work on a new version of IIS 4.0 including several new features in ASP
While developers were pleased to see new capabilities for internet development on WinNT they developed a new architecture called NGWS (next Generation windows services)
In July 2000 ,Microsoft held a professional Developers conference (PDC) in Orlando, Florida.
Next Generation Platform for windows and Internet Software Development (.NET)
In the year 2000, Microsoft launched its new development environment called Microsoft Visual Studio .Net.
Microsoft .Net, at its core, is very similar to J2EE (Java 2 Enterprise Edition).
But, .Net is a compromise between traditional 'un-managed' and 'managed' style of programming.
It allows a programmer to run both managed (code managed by .Net Runtime) and un-managed code (not managed by .Net runtime).
In managed code, .Net does memory management, run-time type checking, memory access checking and exception handling on behalf of your program.
It’s the framework for the .Net platform.
Its a common environment for building, deploying, and running Web applications and Web Services.
It consists of the following
CLR (Common Language Runtime)
CTS (Common Type System)
Common Class Libraries.
The .Net Framework provides the following.
Rich Application Environment
The .Net is language neutral.
Microsoft Visual Studio.NET is the common development environment for the .NET Framework.
Its for providing powerful, reliable enterprise Web Solutions.
It’s a framework designed by Microsoft.
It has been written so that applications on other platforms will be able to access these services.
Its built upon open standard technologies like XML and SOAP
Microsoft .NET was originally called NGWS
It is a new Internet and web based architecture
.Net delivers software as Web Services
It is a Framework for universal services
It will run in any browser on any platform
It Contains Common Class Libraries like ADO.NET and ASP.NET and windows forms to provide advanced std services that can be integrated on variety of computer systems
.Net uses Just In Time (JIT) compilers to translate your intermediate compiled code to native executable code, which significantly improves the performance.
.Net also provides 'Platform independence' and 'Language Independence'. However, the concept of 'Platform independence' is somewhat different from Java.
In .Net, your compiled program can run on any hardware running any variant of the Windows OS (except for Windows 95).
.Net also provides cross language support. This means that modules written in different .Net compliant languages can call/use each others modules. Hence, it is possible to write your class in C#, inherit it in VB.Net and finally use it in VC++.Net
There are as many as 22 languages supporting the .Net Platform (including C#, VB, C++, J#, Cobol, Eiffel, Pascal, Fortran, RPG, Smalltalk and others) and enjoying full use of the .Net runtime and huge Framework class library (FCL).
.Net is useful for building a variety of Windows applications, web applications and services, database and embedded applications (using .Net compact version).
On the marketing and commercial side, Microsoft is apparently putting 80% of its development resources and investment on .Net by providing a number of .Net enabled/supported applications like SQL server.Net and Windows Server 2003
Internet Standards Of .NET
HTTP – used as a Communication protocol between Internet Applications
XML – used to exchange the data between internet applications
SOAP – Used to request web services
UDDI – Used to search and discover Web
These are small units of code built to handle a limited task
These are XML based communicating protocols
These are independent of OS
These are independent of Programming Languages
These connect people , system and devices
.Net Architecture and .Net Framework
In the .Net Architecture and the .Net Framework there are different important terms and concepts which we will discuss one by one:-
1) Common Language Runtime (CLR): 2) MSIL (Microsoft Intermediate Language)
3) Just In Time Compilers (JITers)
4) Framework Class Library (FCL)
5) Common Language Specification (CLS)
6) Common Type System (CTS)
7) Garbage Collector (GC)
Common Language Runtime (CLR):
The most important concept of the .Net Framework is the existence and functionality of the .Net Common Language Runtime (CLR), also called .Net Runtime in short.
It is a framework layer that resides above the OS and handles the execution of all the .Net applications.
Our programs don't directly communicate with the OS but go through the CLR.
MSIL (Microsoft Intermediate Language) Code:
When we compile our .Net Program using any .Net compliant language (like C#, VB.Net, C++.Net) it does not get converted into the executable binary code but to an intermediate code, called MSIL or IL, understandable by CLR.
MSIL is OS and hardware independent code.
When the program needs to be executed, this MSIL, or intermediate code, is converted to binary executable code (native code).
The presence of IL makes possible the Cross Language Relationship as all the .Net compliant languages produce similar, standard IL code.
Working of CLR Code in any .net Language MSIL Code Executable Native Code Language Compiler At Compile Time Just In Time Compiler At Run Time
Just In Time Compilers (JITers)
When our IL compiled code needs to be executed, CLR invokes the JIT compilers which compile the IL code to native executable code (.exe or .dll) that is designed for the specific machine and OS
JITers in many ways are different from traditional compilers as they compile the IL to native code only when desired; e.g., when a function is called, the IL of the function's body is converted to native code just in time .
So, the part of code that is not used by that particular run is never converted to native code.
If some IL code is converted to native code, then the next time it's needed, the CLR reuses the same (already compiled) copy without re-compiling.
So, if a program runs for sometime (assuming that all or most of the functions get called), then it won't have any just-in-time performance penalty.
As JITers are aware of the specific processor and OS at runtime, they can optimize the code extremely efficiently resulting in very robust applications.
Just In Time Compilers (JITers)
Also, since a JIT compiler knows the exact current state of executable code, they can also optimize the code by in-lining small function calls (like replacing body of small function when its called in a loop, saving the function call time).
Although Microsoft stated that C# and .Net are not competing with languages like C++ in efficiency and speed of execution, JITers can make your code even faster than C++ code in some cases when the program is run over an extended period of time (like web-servers).
Just In Time Compilers (JITers)
Types of JIT
This the default JIT compiler of the NGWS runtime.
It can cope up with unrestricted sets of IL instructions.
Its main constraint is the time it takes to perform the optimizations.
It performs high speed conversion of IL to Managed native code.
It allows caching for generated native code.
It isn’t optimized as the code produced by the main JIT.
It works like the traditional compiler.
Its based on the main JIT Compiler.
It has faster loading time and faster application start time.
Framework Class Library (FCL)
The .Net Framework provides a huge Framework (or Base) Class Library (FCL) for common, usual tasks
FCL contains thousands of classes to provide access to Windows API and common functions like String Manipulation, Common Data Structures, IO, Streams, Threads, Security, Network Programming, Windows Programming, Web Programming, Data Access, etc.
It is simply the largest standard library ever shipped with any development environment or programming language.
The best part of this library is they follow extremely efficient OO design (design patterns) making their access and use very simple and predictable
You can use the classes in FCL in your program just as you would use any other class. You can even apply inheritance and polymorphism to these classes.
Framework Class Library (FCL)
Common Language Specification (CLS)
Microsoft has released a small set of specifications that each language should meet to qualify as a .Net Compliant Language
As IL is a very rich language, it is not necessary for a language to implement all the IL functionality; rather, it merely needs to meet a small subset of CLS to qualify as a .Net compliant language.
This is the reason why so many languages (procedural and OO) are now running under the .Net umbrella.
CLS basically addresses language design issues and lays down certain standards.
For instance, there shouldn't be any global function declarations, no pointers, no multiple inheritance and things like that.
The important point to note here is that if you keep your code within the CLS boundary, your code is guaranteed to be usable in any other .Net language.
Common Language Specification (CLS)
Common Type System (CTS)
.Net also defines a Common Type System (CTS).
Like CLS, CTS is also a set of standards.
CTS defines the basic data types that IL understands.
Each .Net com language should map its data types to these standard data types. This makes it possible for the 2 languages to communicate with each other by passing/receiving parameters to/from each other.
For example, CTS defines a type, Int32 an integral data type of 32 bits (4 bytes) which is mapped by C# through int and VB.Net through its Integer data type.
It has the ability to use any language to write applications
The Component Object Model (COM) already
Allows reuse of COM components in any COM aware language and allows for COM components to be written in languages such as VB and c++.
But the superior capabilities of the .NET framework was very easy than COM Interoperatability
With COM Interoperatability in possible only when the components adhere to a binary standard for interaction. That is every component has to follow rules for communication established for sending information to compiled components
The .NET CLR takes this Interoperatability a step further by allowing cross –language inheritance and standardized exception handling
Garbage Collector (GC)
CLR also contains the Garbage Collector (GC), which runs in a low-priority thread and checks for un-referenced, dynamically allocated memory space.
If it finds some data that is no longer referenced by any variable/reference, it re-claims it and returns it to the OS so it can be used by other programs as needed.
The presence of a standard Garbage Collector frees the programmer from keeping track of dangling data.
.NET Architecture ASP.NET Web services Web Forms Controls Windows Forms Drawing ASP.NET application Services Windows Application Services .NET Framework Base Classes Common Type System Memory Management Common Language Runtime ADO.NET NET XML SECURITY THREADING DIAGNOSTICS ETC IO Life Cycle Monitoring
CLR Common Type System (Datatypes etc) IL to Native code Compilers Execution Support (Runtime Functions) Security Garbage Collections , Stack ,Code Manager Class Loader and Memory Layout
In Team environments ,developers can be free to use whatever language they choose to develop objects .whenever it comes time to integrate the Team members components, we can be sure that they can talk to each other seamlessly on the runtime as well as on the source-code level
It allows enhancements to existing objects coded In one language to be added using a different language