Microsoft .NET has been considered a paradigm shift in the world of Web application development and deployment. Web services are being envisioned as the next big step in Internet and Internet technology. Microsoft .NET simplifies the development of Web services; in fact, development of Web services has been one of the major design goals behind .NET. Let's understand what Microsoft .NET Framework is and what benefits it gives to the application developer in terms of development efforts and platforms. This chapter gives an introduction to the .NET Framework, and it gives the reader an overview of the Common Language Runtime (CLR), Common Type System (CTS), and Common Language Specification (CLS). The chapter also gives an overview of the .NET Framework class library.
There are many books that highlight the importance of .NET over earlier technologies. Hence, in this chapter rather than listing all the features of .NET in detail, we emphasize those key aspects of .NET that need to be considered while planning for migration of existing applications to .NET. In this book we have included as many code snippets as possible, highlighting the syntactical differences between the languages being discussed and then supplying workarounds wherever feasible.
One of the main objectives of this chapter is to make the reader aware of the steps that must be followed while migrating any application from one technology to another.
Need for .NET Framework
Before understanding the Microsoft .NET Framework, it is important to understand the current limitations of Microsoft technologies as well other technologies such as Java.
In the current Internet scenario, various applications run on multiple networks. These applications could have been written using different languages provided by various vendors. Microsoft provides different programming languages such as Visual Basic and Visual C++ for application development. For example, a manufacturing organization would have different systems, such as an inventory management system, a bill of material systems, and a general ledger system, all implemented using various technologies available for application development. These systems need to be integrated to form a higher-level enterprise information system for an organization. To do so, application developers had to use technologies such as Microsoft Distributed Component Object Model (DCOM), Component Object Request Broker Architecture (CORBA), Java Remote Method Invocation (RMI), and so on. However, these distributed technologies are very tightly coupled to the programming languages in which these applications have been developed. This leads to problems in application integration if the applications have been developed using disparate technologies.
The other limitation with earlier technologies was that cross-language interoperability was very limited. For example, if classes had been developed in Visual C++, it was not possible to develop new classes in Visual Basic that extended from those developed in Visual C++. Therefore, developers would have to rewrite the same logic for the classes in all the languages that were supported in their organization. Functional reusability was supported, but true code reusability was not available in earlier technologies; therefore, a developer was forced to learn all languages that were being used for application development in the organization.
Developers who have developed applications using Microsoft technologies have extensively used Component Object Model (COM) technology to develop components. These components were used mainly to encapsulate the business logic of the application. COM technology suffered from the following limitations:
Registration of COM components. COM components had to be registered on the target machine before they could be used by the application. The application had to look up the Windows registry to locate and load the COM components.
Unloading COM components. COM objects also required a special logic for freeing up the objects from memory. This method is known as reference counting of COM objects. It is used to keep track of the number of active references. When an object's reference count reaches zero, the object is removed from memory. The major problem that arises out of this situation is that of circular reference. If circular references exist between two COM components, they would not be freed from memory.
Data link library (DLL) hell. Whenever applications that use COM components were installed on a machine, the installation process would update the registry with the COM components information. Thus, there was a chance that these DLLs would be overwritten when some other applications were installed on the same computer. Therefore, an application that had been referring to one particular DLL would refer to the wrong DLL. This caused a major problem when an application was referring to particular version of a DLL.
Microsoft .NET has been developed keeping the above limitations in mind and making Web services development one of its major goals.