ONDotNet.com    
 Published on ONDotNet.com (http://www.ondotnet.com/)
 See this if you're having trouble printing code examples


Embracing the Web Part 2: Componentization and Enterprise Services

by Thuan L. Thai
07/18/2001

In Part 1 of this series, I briefly revisited distributed computing and discussed its goals, problems, and solutions--most importantly RPC (remote procedure calls). In this article, I'll examine componentization, which allows easy and rapid software integration, and enterprise services, which allow developers to build software that scales to massive numbers of users.

Related Reading

.Net Framework Essentials
By Thuan L. Thai, Hoang Lam

Componentization

RPC commences a journey that leads into many other technologies, one of which is componentization. Because RPC supports only remote procedure calls, software vendors create their own homegrown wrappers that layer on top of RPC to support remote object-oriented programming. This allows the software vendors to develop rich C++ class libraries and still attain the benefits of RPC for distributed computing.

Additionally, some people realize that the concept of separating interface from implementation can help build software that supports plug-n-play. In the hardware world, you can plug a few boards together to assemble a complete computer. This works because these boards expose a specific interface that another board knows how to use. Hardware plug-n-play has been around for years, but the commercial software industry has never seen software plug-n-play or componentization until the realized success of RPC. Like plug-n-play hardware components, plug-n-play software components fit together like Lego blocks. Commercially introduced in the early 1990s, software plug-n-play has only been around for the last six to ten years.


O'Reilly recently released Programming Web Services with XML-RPC, which covers five XML-RPC implementations: Java, Perl, Python, ASP, and PHP.

There are many different component software infrastructures, all of which are object-oriented. These include the Component Object Model (COM), System Object Model (SOM), Common Object Request Broker Architecture (CORBA), and Java Beans. Each of these component technologies has similar principles, supports similar features, and exhibits similar applicable realities.

Principles

While there are many principles in a component technology, I'll review just the important ones that, if missing, would render componentization useless. These principles include interface contract, binary standard, wire protocol, and bridges.


For more in-depth coverage of Microsoft's .NET Framework, visit the O'Reilly Network's .NET DevCenter.

A wire protocol serves as an infrastructure that supports distributed component interoperation. It can be extremely complex, but once specified and implemented, no one will need to write this type of infrastructure again. Microsoft did this part so that developers wouldn't have to invent their own wire protocols.

Features

Besides the important principles mentioned in the previous sections, a component technology must support a number of popular features, including location transparency, dynamic activation, dynamic invocation, security, and connection management.
For more on maintaining, monitoring, and updating the registry, check out O'Reilly's Managing the Windows 2000 Registry.

Practicality

Componentization brought many benefits. Not too long after its introduction, everyone was creating and reusing components, not only within the confines of a single machine but throughout the network, with the help of the DCOM wire protocol.

But developers didn't stop there, especially because they wanted to share their valuable components across the Internet. The problem they faced was that DCOM embeds the IP address within the Network Data Representation (NDR) buffer, preventing DCOM from working across the Internet through firewalls and Network Address Translation (NAT) software. Microsoft quickly came up with a solution for this, called COM over the Internet. However, a more open and standard mechanism, called the Simple Object Access Protocol (SOAP), was introduced and immediately accepted widely. SOAP is entirely based on XML.

An additional problem with COM is that it relies too much on the system registry, making COM programming and component setup and configuration a nightmare for both developers and administrators. COM is not hard, but ramping up to the COM learning curve is painful, specifically because novices spent most of the time deciphering the meanings of each COM-related registry hive and entry. It would be more appropriate if all of the registry-related information were built into the component itself, so that there would be no need for the system registry. See .NET Framework Essentials for details on how .NET solves this problem.

Enterprise services

As mentioned earlier, componentization permits the plug-n-play of software components and revolutionizes the way people develop software. It's so popular that people build large-scale, enterprise-wide systems based on this concept. Building these kinds of systems poses a number of constraints. Because large-scale systems tend to support a massive number of users, architects must design these systems to scale over time and to support the sharing of resources. That means that they require their developers to develop services like thread pooling, resource pooling, security checking, and others.

These enterprise services are being crafted left and right for each enterprise system that people build. Similar to the marshaling problem found in distributed programming (see Part 1: Distributed Computing), the development of these services is not rocket science. Once you have built a component to support resource pooling for your database, it won't be hard to create another one for your next enterprise application. However, these services are complex enough to introduce defects and bugs that will give you nightmares. In addition, developing these services is tedious, error prone, and outright redundant. Moreover, these services conform to no standards, making them useless to other enterprise systems.

To solve this, component infrastructures, such as Microsoft Transaction Server (MTS), COM+ Services, CORBA Services, and Enterprise Java Beans (EJB), provide the support for these enterprise services. With such support, you don't have to write this type of code ever again when you develop an enterprise application. It is important to understand the principles behind enterprise services and the features that these enterprise services provide.


O'Reilly will soon release (September 2001) COM and .NET Component Services, which provides both traditional COM programmers and new .NET component developers with the information they need to begin developing applications that take full advantage of COM+ services.

Aspect-Oriented Programming

Enterprise services are built on the notion of aspect-oriented programming (AOP), a paradigm that is often overlooked but extremely essential in systems that support configuration or runtime changes. Under this paradigm, you develop your software once, but it behaves differently depending upon how it is configured. A simple example of this is a program that obtains information from a Windows initialization (INI) file. Unlike the use of an INI file in which your program would have to decipher and provide the necessary feature, AOP provides the feature, such as connection pooling, at the system level, where you don't have to write a single line of code.

In AOP, you tell the runtime or the system the features you need either at programming time or at configuration time. At programming time, you simply add special keywords or attributes in your methods or classes, but you don't write any custom code to support these features. At runtime, the system will intercept all calls to your methods or classes, inspect these attributes, and inject the necessary features into your component for you.

Instead of specifying these attributes at programming time, you can also delay these declarations until configuration time. Should you do this, you will have the opportunity at configuration and setup time to declare the services that you need. With this ability, the same system can be configured to run in different ways, supporting different features. In other words, two different companies can use the same system by simply declaring different configurations. Although there is only one system, the AOP paradigm allows us to instantiate different instances of this system at configuration time. Looking at this from another conceptual angle, you can instantiate a class in C++, but you can instantiate an entire system under the AOP paradigm.

MTS and COM+ Services use the notion of aspect-oriented programming to provide enterprise services for COM components. You set (at programming time) or declare (at configuration time using the MTS or COM+ Explorer) certain attributes to indicate the kinds of services you want you use, and MTS or COM+ will intercept all calls at runtime and execute the services you've specified.

Typical Enterprise Services

Enterprise services exist to support sharing, scalability, robustness, quick response time, and other features. To support these features, a component technology provides a number of common enterprise services, including thread pooling, object pooling, connection pooling, security management, transaction management, and disconnected processing.


Check out O'Reilly's new .NET Resource Center for the latest articles and books covering Microsoft's .NET technology.

Coming Up Next

In this article, I've briefly reviewed componentization and enterprise services, two of the most important concepts that enable software integration and large-scale systems. Since some of largest scalable software systems are Web-based, I will address Web-based concepts and maturity factors next week, in Part 3 of this series.

Footnotes

  1. If you are interested in the details of the COM binary standard, check out Chapter 3, "Objects," of Learning DCOM, published by O'Reilly.

  2. Dealing with the registry can be a nightmare for COM programmers. To mitigate this pain and suffering, .NET has abolished the use of the registry for component discovery and plug-n-play.


Thuan L. Thai is the author of Learning DCOM and coauthor of .NET Framework Essentials. He has been giving technical presentations on the .NET platform to clients since announcement of the initiative in August 2000.


O'Reilly & Associates recently released (June 2001) .NET Framework Essentials.

Copyright © 2009 O'Reilly Media, Inc.