Monday, March 26, 2007

The .NET Framework Architecture Part 1

The .NET framework is a software technology that is directed towards connecting information, people, systems and devices seamlessly. The high level of software integration that has been attempted through use of XML web services enables the creation of small, discrete, building block types of applications. These applications are connected to other applications over the Internet.
Central to the .NET framework architecture is the effort to provide support to for the next generation solutions. The direction of change is to ensure that software deployment and versioning conflicts are avoided or minimized in the .NET Framework. User defined codes are released from the confines of the local storage systems and can be stored anywhere on a network and executed from any point in the network. Performance problems associated with scripted and interpreted environments are removed. Codes can be safely executed and the developer experience is consistent across widely varying types of applications, such as Windows based applications and web based applications. The thrust of design is towards creating a standard communication facility that is standardized so that .NET codes can be integrated with other codes easily and seamlessly.
At the core of the .NET infrastructure is the Common Language Runtime (CLR) and the .NET Framework class library.
The runtime functions, like an agent, managing code at execution time. It provides core services such as memory management, thread management and ‘remoting’. It enforces strict type safety and ensures code accuracy. This makes for security and robustness and provides a platform for running managed code.
The .NET Framework provides several runtime hosts. It also supports the development of third-party runtime hosts. For example, ASP.NET hosts the runtime to provide a scalable, server-side environment for managed code. ASP.NET works directly with the runtime to enable ASP.NET applications and XML Web services.
The .NET Framework can be hosted by unmanaged components such as the Internet Explorer. These load the common language runtime into their processes and initiate the execution of managed code. This creates a software environment that can exploit both managed and unmanaged features. This makes for mobility of the code.
Common Language Runtime (CLR)
The common language runtime (CLR) is the foundation upon which developers construct various kinds of applications. The benefits of the CLR are many. It makes for a vastly simplified development. It enables a seamless integration of code written in different languages. It provides evidence-based security with code identity. The assembly based deployment eliminates the problems of DLL. The versioning of reusable components makes for ease of usage. The implementation inheritance feature enables the reuse of code. The automatic object lifetime management makes the application- development comfortable. The self descriptive nature of objects makes for ease of programming and debugging.

CLR includes both private and shared components. It provides for incremental download of code and caching; native platform interoperability and seamless integration with COM. It offers dynamic inspection capabilities, administration and configuration options. The developer is not required to know all the runtime supported infrastructure. The tools and frameworks are designed to expose a subset of the functionality in accordance with the kind of application being built.
The common language runtime is a virtual execution system that provides important services such as memory management, security and also has a Just-in-Time compiler (JIT) which converts the intermediate language (IL) into native code that can be executed by the physical machine। The infrastructure provides a machine independent environment for application execution.
Tight security is maintained in implementing common language runtime. Managed components are awarded varying degrees of trust. Access rights are determined by factors such as origin of the component (Internet, enterprise network, or local computer). On the flip side this restricts access to file and registry operations, even if the file being operated upon is on within the same active application.
The managed environment of the runtime eliminates many common software issues. For example, the runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used. This automatic memory management resolves the two most common application errors--memory leaks and invalid memory references.
The futuristic design of the infrastructure is takes into consideration the need to integrate with the legacy applications that are still in operation.
Interoperability between managed and unmanaged code enables developers to continue to use necessary COM components and DLLs.
The use of ‘Common type’ system implements the features of the .NET infrastructure. The common data types shared by multiple languages such as VB.NET, C#, ASP.NET eases the import of a class created in one language into another. A common error handling facility makes for tighter integration between languages and allows developers the freedom of working in the language of their choice.
.NET Framework Class Library
The .NET framework class library, as the name suggests, is a library of classes, interfaces and value types. The applications, components and controls for applications are built on this framework and it provides the developer the access to the system functionality. In other words, the classes and structures can be leveraged as base building blocks for application development. These classes are often described as an API and form a boundary interface between the application and the operating system. Though the concept is not new to Visual basic Developers who have been using the ADO library, the Win 32 API and COM + services, it forms a massive code base on which the application can be built. The .NET Framework class Library is organized into namespaces. The namespace is a container for functionality. Similar classes and constructs are grouped together in a namespace to define parent-child relationships. Namespaces can be nested into namespaces.
All namespaces stem from the root namespace called System Namespace. It contains all data types including the Object data type. Though all namespaces are subordinated to the System namespace, User defined libraries can also coexist with the System namespace. They can have their own root namespace which can be language focused namespaces such as Microsoft.Csharp, Microsoft.VisualBasic.
The most significant feature of the .NET framework is the class Library collection of reusable types can be integrated with CLR. The programmer can accomplish a range of common programming tasks, such as string management; data collection; data base connectivity and file access using the .NET framework class library. The developer can create console applications, Windows GUI applications, ASP.NET applications, XML Web services or Windows services.
Microsoft Intermediate Language (MSIL)
MSIL are simple binary structures that are similar to the instruction sets of the CPU. Like the instruction set, it encodes a wide spectrum of operations such as loading, storing, arithmetic and logical operations and control flow. The similarity to the machine code enables the code to be compiled quickly in the Just in time compiler. The type verification also becomes simpler because the DotNet binary contains tables of metadata. The metadata defines each type and its signatures and also the other data that the runtime locates and extracts from the file at the time of execution. The presence of the metadata makes the module self descriptive and eliminates the need for IDL files and header files. However, unlike the CPU instruction set, MSIL expresses object oriented concepts such as object creation, method invocation, property access and exception handling.

It is the Microsoft Intermediate Language (MSIL) which makes applications language independent. Applications may be created by programmers in any language of their choice—ASP.NET or VB.NET—in a machine on which the .NET framework has been installed. The compiler then, gives an output in the Microsoft Intermediate language. This language can be defined as a kind of assembly language at a higher level of abstraction. The language is designed in a manner that makes it possible to convert it into any kind of native machine code with ease. The CLR detects the Intermediate language and invokes the Just-in-time compiler to convert the language into machine code.

No comments: