Historically, enterprise applications were written as large monolithic programs that run on powerful but expensive mainframe computers. Over a period of time, with the experiences from the development of monolithic applications and with the modern advancements in the personal computer technology, system architects observed that
It would be much better to write code as reusable components instead of monolithic applications. Assembling an application from reusable components is usually faster and cheaper because of the time saved in coding and testing.
It would be much better if applications could talk to each other. It is much more useful to have integrated applications working together instead of closed applications that cannot understand each other.
With the increasing power of personal computers, it is a good idea to break down the application into multiple layers ‚ each running on one or more personal computers. This way, the complete application can run on a set of inexpensive computers networked with each other, instead of expensive mainframes.
These observations were the foundation of the component-based distributed application development systems that would evolve over the next several years on the Windows platforms. I'll briefly summarize this evolution in the next few sections.
COM was one of the first technologies to address component-based development on the Windows platform. COM enables applications to be built from components supplied by different software vendors . In addition to this, COM also defines a binary standard for component interoperability. This ensures that components written by one developer can interoperate with components written by other developers without either having any knowledge of the inner working of the other component.
COM became immensely popular for developing enterprise applications. A large collection of libraries was soon available from third-party software vendors to perform various common tasks . Programmers could now quickly design a large program by assembling various COM components that were readily available.
Many enterprise application developers started developing software divided into discrete logical parts called tiers . Tiers enable an application to be developed and deployed in modular fashion. An application having multiple tiers is commonly known as an n- tier application. One of the common approaches to tiered development is the three-tier approach in which the application is divided in three parts, as shown in Table 7.1.
Active Server Pages (ASP)
Database Management Systems (DBMS), such as SQL Server
Programmers preferred writing business logic in COM components instead of ASP or in SQL Server stored procedures because COM components are easy to develop, debug, and maintain.
COM components that encapsulate business rules and logic to perform a specific task are also called business objects . In an enterprise application, several business objects interoperate with each other to perform a business transaction. For example, in an online bookstore, when a customer orders a book, a transaction needs to be performed. This transaction might involve several tasks such as verifying and charging the credit card of customer, updating the inventory, and shipping the book to the customer. A business object can perform each of these tasks. Sometimes business objects can interoperate with each other while residing on different computers.
However, there is more to enterprise development than just components. As an example, for a successful transaction, all of its tasks should succeed. If even one of these tasks fails, it is important to undo all the changes made to the system in an attempt to perform this transaction (also referred to as a rollback of the transaction). Rollback is important to maintain the integrity of a system. Maintaining the integrity of the system becomes increasingly difficult in the case of a distributed application in which each of these tasks is performed on a different computer.
With a lack of any special support from the operating system, much effort was expended by enterprise developers in writing code to coordinate transactions in each application that they developed. Microsoft realized the need to provide this infrastructure as part of Windows in order to position Windows as a platform for enterprise applications. The result came in the form of Microsoft Transaction Server (MTS).
MTS represents a shift in how programmers looked at the Windows application server. With MTS, the application server not only merely hosts the components, but also provides useful services to them. One of the most important services provided by MTS is automatic transaction management.
ACID Properties A well-designed transaction has ACID properties. ACID is an acronym that stands for the following:
Atomicity ‚ Ensures that the entire transaction either is committed or rolled back.
Consistency ‚ Ensures that the system is always left at the correct state in case of failure or success of a transaction.
Isolation ‚ Ensures data integrity by protecting concurrent transactions from seeing each other's partial and uncommitted results.
Durability ‚ Ensures that the system can return to its original state in case of a failure.
To provide this automatic transactions service, MTS coordinates a set of business objects to perform an operation. Each of these objects then votes for the success or failure of the transaction based on the task that they perform individually. If all the business objects voted for the success of the transaction, the system changes would be finalized or committed. On the other hand, if any of the business objects voted for a failure, any changes made to the system during the transaction would be undone or rolled back, and the system would be restored to its original state as if nothing had happened .
In addition to transactions, MTS also provides other services such as concurrency management and component-based security.
With MTS providing all these services, the work of an enterprise application developer is simplified. She can now focus on writing the business logic instead of building an application development frame work on her own.
The success of MTS encouraged Microsoft to consolidate other common services that an enterprise application developer might need and make them part of the platform. The result of this initiative came with the launch of Windows 2000 in the form of COM+.
COM+ is positioned by Microsoft as a unified platform for developing component-oriented distributed applications. Although from its name the technology looks like a new version of COM, in fact COM+ is a new version of MTS. It is important to understand this distinction because COM+ is not a new standard for developing components. Instead, COM+ is a platform that provides application services to COM components.
The initial release of COM+ (that is, COM+ 1.0), which comes with Windows 2000, upgrades MTS and provides a new set of services in addition to automatic transaction processing. These services include
Object Pooling ‚ With object pooling, COM+ creates objects and keeps them in a pool where they are ready to be used when the next client makes a request. This improves the performance of a server application that hosts objects that are frequently used but are expensive to create.
Just-In-Time ( JIT ) Activation ‚ The objective of JIT activation is to minimize the amount of time for which an object lives and consumes resources on the server. With JIT activation, the client can hold a reference to an object on the server for a long time, but the server only creates the object just in time when the client calls a method on the object. After the method call is completed, the object is freed and its memory is reclaimed. JIT activation allows applications to scale up as the number of users increases .
Role-based Security ‚ In the role-based security model, access to parts of an application are granted or denied based on the role to which the callers belong. A role defines which users or groups in a Windows domain are allowed to work with what components, methods , or interfaces.
Queued Components ‚ The queued components service allows you to create components that can execute asynchronously or in disconnected mode. Consider a scenario in which the salespersons take their laptop computers to the field and enter the orders on the go. Because they are in disconnected mode, these orders can be queued up in a message queue. When the salesperson connects back to the network, the orders can be retrieved from the message queue and processed by the order processing components on the server. Queued components ensure availability of a system even when one or more sub-systems are temporarily unavailable.
Loosely Coupled Events ‚ Loosely coupled events enable an object (publisher) to publish an event. Other objects (subscriber) can subscribe to an event. COM+ does not require the publisher or subscriber to know about each other. Therefore, loosely coupled events greatly simplify the programming model for distributed applications.
Key Requirements for an Enterprise Application Some of the key requirements that any enterprise application must meet include
Scalability ‚ To ensure that an application meets its requirement of efficiency even if the demands on application increases.
Reliability ‚ To ensure that the application generates correct and consistent information all the time.
Availability ‚ To ensure that users can depend on using the application when needed.
Security ‚ To ensure that the functioning of the application is never disrupted or compromised by the efforts of malicious or ignorant users.
Manageability ‚ To ensure that the deployment and maintenance of the application is as efficient and painless as possible.
Microsoft introduced an update of COM+ ‚ COM+ 1.5, with the release of Windows XP. COM+ 1.5 has several enhancements over the COM+ features, including the following:
Capability to Run a COM+ Application As a Windows Service ‚ COM+ 1.5 allows you to configure a COM+ application to run as a Windows service. This enables an application to start as soon as Windows starts instead of waiting for an explicit request from the client. Starting an application as a Windows service enables the application to run under the system identity account. This is especially useful if an application needs to have high privilege on a given machine.
Ability to Run a COM+ Application As a Web Service ‚ COM+ 1.5 can expose any COM+ component as an XML Web service as long as the component complies with Web services design guidelines. COM+ installs the Web service with IIS and generates the proper Web service configuration and information files. Doing this involves no extra coding; however, you must have IIS running on the Windows XP machine.
COM+ 1.5 on the Server COM+ 1.5 won't be available on the Windows Server platform until the release of Windows .NET Server in mid-2003.
In the initial phase of its development, the .NET Framework was known as COM+ 2.0. However, Microsoft later renamed it for good because the first release of the .NET Framework is more of an upgrade of COM instead of COM+.
The .NET Framework provides a new approach to creating components that replaces the need for COM. As you know, these components execute in a managed execution environment known as the Common Language Runtime (CLR), which provides low-level services such as memory management, versioning, and security to the components. In addition, the .NET Framework also provides a new set of object-oriented libraries that allows programmers to develop applications in a better and faster way.
The task of developing the .NET Framework was so huge in itself that instead of developing a new platform for component services for the .NET Framework, Microsoft relies on COM+. The .NET Framework uses COM+ 1.0 for component services on Windows 2000 or COM+ 1.5 for Windows XP and Windows .NET servers.
In the .NET Framework, the System.EnterpriseServices namespace contains the types that allow you to use COM+ services in the .NET Framework. These types are also collectively called enterprise services.