Friday 6 January 2012

Understanding the .NET Platform and its layers

Here in this section we will be covering what the .NET Platform is made up of and we will define its layers. To start, .NET is a framework that covers all the layers of software development above the Operating System. It provides the richest level of integration among presentation technologies, component technologies, and data technologies ever seen on Microsoft, or perhaps any, platform. Secondly, the entire architecture has been created to make it easy to develop Internet applications, as it is to develop for the desktop.

Constituents of .NET Platform
The .NET consists of the following three main parts
• .NET Framework – a completely re-engineered development environment.
• .NET Products – applications from MS based on the .NET platform, including Office and Visual Studio.
• .NET Services – facilitates 3rd party developers to create services on the .NET Platform.

   The above diagram gives you an overview of the .NET architecture. At the bottom of the diagram is your Operating System above that sits the .NET framework that acts as an interface to it. The .NET wraps the operating system, insulating software developed with .NET from most operating system specifics such as file handling and memory allocation.

The Common Language Runtime (CLR)
     At the base is the CLR. It is considered as the heart of the .NET framework. .NET applications are compiled to a common language known as Microsoft Intermediate Language or “IL”. The CLR, then, handles the compiling the IL to machine language, at which point the program is executed.
     The CLR environment is also referred to as a managed environment, in which common services, such as garbage collection and security, are automatically provided.
More information on CLR is available at
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconthecommonlanguageruntime.asp

The .NET Class Framework
The next layer up in the framework is called the .NET Class Framework also referred as .NET base class library. The .NET Class Framework consists of several thousand type definitions, where each type exposes some functionality. All in all, the CLR and the .NET Class Framework allow developers to build the following kinds of applications:
• Web Services. Components that can be accessed over the Internet very easily.
• Web Forms. HTML based applications (Web Sites).
• Windows Forms. Rich Windows GUI applications. Windows form applications can take advantage of controls, mouse and keyboard events and can talk directly to the underlying OS.
• Windows Console Applications. Compilers, utilities and tools are typically implemented as console applications.
• Windows Services. It is possible to build service applications controllable via the Windows Service Control Manager (SCM) using the .NET Framework.
• Component Library. .NET Framework allows you to build stand-alone components (types) that may be easily incorporated into any of the above mentioned application types.

ADO.NET: Data and XML
     ADO.NET is the next generation of Microsoft ActiveX Data Object (ADO) technology. ADO.NET is heavily dependent on XML for representation of data. It also provides an improved support for the disconnected programming model.
    ADO.NET’s DataSet object, is the core component of the disconnected architecture of ADO.NET. The DataSet can also be populated with data from an XML source, whether it is a file or an XML stream.
For more details on ADO.NET, check out
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconaccessingdatawithadonet.asp

User Interface
The next layer consists of the user and programming interface that allows .NET to interact with the outside world. The following are the types of interaction interfaces that are supported by the .NET framework:
• Web Forms
• Windows Forms
• Web Services
Now let me tell you about Windows Forms and ASP.NET. WinForms (Windows Forms) is simply the name used to describe the creation of a standard Win32 kind of GUI applications.
The Active Server Pages web development framework has undergone extensive changes in ASP.NET. The programming language of choice is now full-blown VB.NET or C# (or any supported .NET language for that matter). Other changes include:
• New support for HTML Server Controls (session state supported on the server).
• It is now possible for the server to process client-side events.
• New control families including enhanced Intrinsics, Rich controls, List controls, DataGrid control, Repeater control, Data list control, and validation controls.
• New support for developing Web Services—application logic programmatically accessible via the Internet that can be integrated into .NET applications using the Simple Object Access Protocol (SOAP).

Languages
     The CLR allows objects created in one language be treated as equal citizens by code written in a completely different language. To make this possible, Microsoft has defined a Common Language Specification (CLS) that details for compiler vendors the minimum set of features that their compilers must support if they are to target the runtime.
Any language that conforms to the CLS can run on the CLR. In the .NET framework, Microsoft provides Visual Basic, Visual C++, Visual C#, and JScript support.

.NET Products
Microsoft Visual Studio .NET
Microsoft Visual Studio .NET represents the best development environment for the .NET platform.
   Integrations is the key in the new VS.NET IDE, thus a single IDE can be used to program in a variety of managed languages from VB.NET to Visual C++ with Managed extensions. Advance features in VS.NET truly propel development in to the highest gear.

.NET Services:
XML Web Services
XML is turning the way we build and use software inside out. The Web revolutionized how users talk to applications. XML is revolutionizing how applications talk to other applications—or more broadly, how computers talk to other computers—by providing a universal data format that lets data be easily adapted or transformed:
• XML Web services allow applications to share data.
• XML Web services are discrete units of code; each handles a limited set of tasks.
• They are based on XML, the universal language of Internet data exchange, and can be called across platforms and operating systems, regardless of programming language.
• .NET is a set of Microsoft software technologies for connecting your world of information, people, systems, and devices through the use of XML Web services.
For more details refer:
http://msdn.microsoft.com/nhp/default.asp?contentid=28000442

.NET Runtime:
Let’s now discuss about the .NET Runtime.

   The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime's functionality and enable you to write code that benefits from this managed execution environment. Code developed with a language compiler that targets the runtime is
called managed code.
To enable the runtime to provide services to managed code, language compilers must emit metadata, which the runtime uses to locate and load classes, lay out instances in memory, resolve method invocations, generate native code, enforce security, and set run-time context boundaries.
The runtime automatically handles objects, releasing them when they are no longer being used. Objects whose lifetimes are managed in this way are called managed data. Automatic memory management eliminates memory leaks as well as many other common programming errors.
The CLR makes it easy to design components and applications whose objects interact across languages. For example, you can define a class and then use a different language to derive a class from your original class, or call a method on the original class. You can also pass an instance of a class to a method on a class written in a
different language. This cross-language integration is possible because of the common type system defined by the runtime, and they follow the runtime's rules for defining new types, as well as for creating, using, persisting, and binding to types. Language compilers and tools expose the runtime's functionality in ways that are intended to be useful and intuitive to their developers. This means that some features of the runtime might be more noticeable in one environment than in another. How you experience the runtime depends on which language compilers or tools you use. The following benefits of the runtime might be particularly interesting
to you:
• Performance improvements.
• The ability to easily use components developed in other languages.
• Extensible types provided by a class library.
• A broad set of language features.