Evolution of Component Services



Evolution of Component Services

Historically, enterprise applications were written as large monolithic programs that ran on powerful but expensive mainframe computers. Over time, with experience developing monolithic applications and with the modern advancements in the personal computer technology, system architects were able to make some observations:

  • It would be much better to write code as reusable components instead of monolithic tomes. Assembling an application from reusable components would be 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 would be much more useful to have integrated applications working together than closed applications that could not understand each other.

  • With the increasing power of personal computers, it would be a good idea to break down the application in multiple layers, each running on one or more personal computers. This way, the complete application could run on a set of inexpensive computers networked with each other, rather than 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.

Component Object Model (COM)

COM was one of the first technologies to address component-based development on the Windows platform. COM allows 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 the components written by one developer can interoperate with components written by other developers without requiring users to have any knowledge of the inner workings of a component.

COM became immensely popular for developing enterprise applications. There was soon a large collection of libraries 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 that is divided in discrete logical parts called tiers. Tiers enable an application to be developed and deployed in modular fashion. Applications that have multiple tiers are commonly known as n-tier applications. One of the common approaches to tiered development is the three-tier approach, in which the application is divided into three parts, as shown in Figure.

A Typical 3-tier Approach to Developing Applications

Tier Name

Implementation Choice

Presentation

Active Server Pages (ASP)

Business Logic

COM components

Data

Database Management Systems (DBMS), such as SQL Server

Programmers prefer to write business logic in COM components instead of ASP and SQL Server stored procedures because the COM components provide better performance and are easy to develop and debug.

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. In an online bookstore, for example, when a customer orders a book, a transaction needs to be performed. This transaction may involve several tasks, such as verifying and charging the customer's credit card, updating the inventory, and shipping the book to the customer. A business object may perform each of these tasks. Sometimes business objects may 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 its tasks should succeed. If even one of these tasks fails then it is important to undo all the changes made to the system in its attempt to perform this transaction (also referred to as rollback of the transaction). Rollback is important to maintain the integrity of a system. Maintaining the system's integrity becomes increasingly difficult when you have a distributed application where each of these tasks is performed on a different computer.

With lack of any special support from the operating system, many efforts of enterprise developers were spent in writing code to coordinate transactions in each application that they developed. Microsoft realized the need to provide this infrastructure as part of Windows to position Windows as a platform for enterprise applications. The result came in the form of Microsoft Transaction Server (MTS).

Microsoft Transaction Server (MTS)

MTS represented a complete paradigm shift in how programmers looked at the application server. With MTS, the application server does not merely host the components but also provides useful services to them. One of the most important services provided by MTS is automatic transaction management.

NOTE

ACID Properties A well-designed transaction has ACID properties. ACID is an acronym that stands for the following:

  • Atomicity— Ensures that the entire transaction is either committed or rolled back.

  • Consistency— Ensures that the system is always left at the correct state in case of the failure or success of a transaction.

  • Isolation— Ensures data integrity by protecting concurrent transactions from seeing or being adversely affected by 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 the automatic transaction 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 it individually performs. If all the business objects vote for the success of the transaction then the system changes are finalized or committed. On the other hand, if any of the business objects votes for a failure, any changes made to the system during the transaction are undone or rolled back and the system is 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 providingall these services, the work of an enterprise application developer is simplified. The developer can now focus on writing the business logic instead of developing an application development framework on her own.

The success of MTS encouraged Microsoft to consolidate other common services that an enterprise application developer may need and make them a part of the platform. The result of this initiative came with the launch of Windows 2000 in the form of COM+.

COM+ 1.0 and COM+ 1.5

Microsoft has positioned COM+ as a unified platform for developing component-oriented distributed applications. Although from its name the technology looks more like a new version of COM, COM+ is instead a new version of MTS. It is important to understand this distinction because COM+ is not a new standard for developing components but instead COM+ is a platform that provides application services to the 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 the following:

  • 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 the 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 creates the object only 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 enables 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 members of a Windows domain are allowed to work with what components, methods, or interfaces.

  • Queued Components— The queued components service enables you to create components that can execute asynchronously or in disconnected mode. Queued components ensure availability of a system even when one or more sub-systems are temporarily unavailable. Consider a scenario where salespeople take their laptop computers to the field and enter orders on the go. Because they are in disconnected mode, these orders can be queued up in a message queue. When salespeople connect back to the network, the orders can be retrieved from the message queue and processed by the order processing components on the server.

  • Loosely Coupled Events— Loosely coupled events enable an object (publisher) to publish an event. Other objects (subscribers) can subscribe to an event. COM+ does not require publishers or subscribers to know about each other. Therefore, loosely coupled events greatly simplify the programming model for distributed applications.

NOTE

Key Requirements for an Enterprise Application The following list describes some of the key requirements that any enterprise application must include:

  • Scalability— To ensure that an application meets its requirement for efficiency even if the number of users 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 application's functioning 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+ 1.0 features, including the following:

  • Ability 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, rather than wait 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, but you must have IIS running on the Windows XP machine.

COM+ 2.0 (The .NET Framework)

In fact, the .NET Framework, in the initial phase of its development, was known as COM+ 2.0. However, later Microsoft renamed it because the first release of the .NET Framework is actually more of an upgrade of COM than of COM+.

The .NET Framework provides a new approach to creating components that replaces the need for COM. 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 enables 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 and uses COM+ 1.5 for Windows XP and Windows Server 2003.

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 collectively known as enterprise services.