Suppose we wish to develop an Internet application that allows businesses to communicate vital information with each other across existing communication lines. Let�s look at typical solution that can be offered to this problem using Microsoft technologies. If the application is an n-tier application then we would need HTML, DHTML & Java Script in the front-tier; VBScript, ASP, MTS, C++, VB, COM in the middle-tier and SQL, ADO in the back-tier. Developers possessing sufficient skill in all of these areas are few and costly. In short, a perfect recipe for development nightmare.Even if the developers are able to successfully develop the applications, they would be required to spend hours battling component version conflicts (popularly known as DLL Hell) when the time comes to install their products. Assured distribution nightmare, in short.
Sun�s solution to this problem could be to use Java applets and servlets in the front-tier, Enterprises Java Bean (EJB) or CORBA or RMI in the middle-tier, and JDBC and a suitable database in the back-tier. The common theme here is every developer should learn Java language. This is a far-fetched dream. Though an attempt to make every programmer a Java programmer has met with more than a lukewarm success, the ground reality is that there would be several languages in existence, each camp having its own faithful band of programmers.
.Net is an attempt to bring order to this chaos. .Net is a development platform that makes it easier for programmers using different languages to quickly create robust internet applications. Let�s now see how .Net makes Internet development easier.
Language Of Choice
A developer can pick the .Net language that he likes most, write components in it, and share the compiled binary version of his component with other developers using other .Net languages. As on date there are 22 languages including VB, C++, C#, COBOL, etc. from which the programmer can choose. Microsoft has made the specifications for .Net development platform freely available to compiler vendors in the form of Common Language Specification (CLS). Vendors can develop compilers that produce standard binary code confirming to the CLS.
Easy DeploymentDeployment in a .Net environment involves a mere file copy. There are no versioning problems as all the version information is included in the metadata (data about data) that is distributed with the component. Even different versions of the same component can run side by side on the same machine.
Less Plumbing Code
VS.Net development environment eliminates a lot of hand coding by providing wizards and liberal use of drag & drop functionality. .Net also provides standard classes that developers can use to create powerful applications quickly.]
.Net is actually wrapper around the operating system. Software developed with .Net doesn�t have to worry about operating system tasks like File Handling and Memory Allocation. Even though Microsoft doesn�t say so, this appears to be a silent preparation for the future where the software developed for .Net would be portable to a wide variety of Hardware and OS. Beta version of VS.Net supports all versions of Win2000, Windows NT4, Win9X and Windows ME. .Net makes development of Internet applications as easy as Desktop applications. Secondly, it provides a very high level of integration of front, middle and back-tier. The following figure shows major components of .Net framework.
Figure 1.1: .Net Framework
Let�s now understand these three components.
The Common Language Runtime
A runtime is an environment in which programs are executed. For example, to execute a program written in VB6, the machine must have a VB runtime (msvbvm.dll) installed. Similarly VC++ programs and Java programs too require unique runtime components. Since different languages require different runtime the developer�s life becomes more difficult. Imagine a situation where an ActiveX control has been developed in VB. While downloading this component a user may also have to download the VB runtime if it is not already installed on the machine. And imagine what would be the solution if Windows weren�t installed on the machine.
To avoid such problems .Net introduces a single Common Language Runtime (CLR) that all .Net languages share. The following figure shows how CLR works
Figure 1.2: Execution Process Under .Net Framework
Once our code is written, we compile it, and the compiler translates it to Microsoft Intermediate Language (MSIL). MSIL is a CPU-independent set of instructions that can be efficiently converted to native (CPU dependent) code. MSIL code is a language independent code. The Linker then links the IL code converted by one language compiler with the IL code compiled by another language compiler. The result is an EXE or DLL, containing the IL code, which is saved to disk. VS.Net comes with different language compilers to generate IL code. Then on execution, the IL code and any requested functionality from the .Net base classes is brought together. The JIT compiler process the combined code creating managed native code (Code that targets the runtime is called managed code. The runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used.), which is passed to the CLR.
Net Base Classes
.Net supplies a library of base classes that developers can use to implement applications quickly. Developers can either use them by building objects from these classes and invoking the class methods. Alternately they can derive new classes from these standard classes.
These classes include:
Classes and types related to basic database management.
Classes to debug an application and to trace the execution.
Types that allow reading/writing to files and other data streams.
Members to calculate common mathematical quantities.
Capability to inspect metadata.
Types, which enable security capabilities.
User and Program Interfaces
This forms the top layer in the .Net architecture. This includes Windows Forms, Windows Application Services, Web Forms and Web Services. Windows forms (often called as WinForms) offer a new way to create standard Win32 desktop applications. Web Forms provide a powerful, form-based user-interface for the web. Web Services provide a mechanism for programs to communicate over the Internet using SOAP (Simple Object Access Protocol). These services are similar to COM/DCOM services that were used for object brokering & interfacing. However, Web Services allow integration with non-Microsoft platform as well.
The potential of Web Services is unlimited. For example, a software company may provide a Web Service to calculate income tax. Any company that wants to calculate income tax can subscribe to this Web Service. The customer company need not deploy the income tax calculator. It simply needs to access the Web Service. The company offering the service can dynamically update it to accommodate new taxation rates. The subscribers won�t have to do anything to get the new updates. In future a collection of such Web Services may replace packaged software. Other Web Services that can be developed include weather information, stock quotes, shipping status, news items, etc. I think you get the picture now.�