The seven levels of loose coupling

Ronald Schmelzer discusses the spectrum of layers in SOA and loose coupling.

This Content Component encountered an error
This Content Component encountered an error

When ZapThink talks about service-oriented architecture (SOA), we generally try to avoid semantic arguments about what is and what isn't SOA, but rather try to focus on specific characteristics that identify service-oriented systems and the benefits they provide organizations that adopt the architectural approach. In particular, we like to focus on three core tenets: loose coupling of service consumers and providers, composability at...

a variety of levels of granularity, and event-driven, asynchronous styles of interaction that allow for a wide range of usage scenarios.

While these characteristics might seem distinct, they are in fact related to each other. The ability to compose arbitrary services in environments of long-running transactions requires a certain measure of loose coupling. However, architects seem to grapple with the term "loose coupling". Some erroneously think that systems are either loosely coupled or tightly coupled as if the determination of coupling is a binary evaluation. The reality is that the concept of coupling, like that of granularity, is a relative term. Something is more loosely coupled than something else if it allows for a greater degree of variability and freedom for that particular aspect. Simply put, coupling is a measure of dependency and commonality required by a service consumer and provider to be able to achieve a result.

In that light, loose coupling is a spectrum. A system can be tightly coupled in one aspect while being loosely coupled in another. Many architects say that they want complete decoupling of systems so that any variation in the system can be handled without having to reimplement any of the service consumers or providers. As we've discussed in past ZapFlashes, complete decoupling is incredibly difficult and expensive, if not impossible. So, what architects should be aiming for is achieving the right level of loose coupling to facilitate business agility without imposing huge costs.

As such, what ZapThink has seen is that there are really seven levels, or perhaps aspects, of loose coupling that architects should consider in their SOA initiatives. The more degrees and levels of loose coupling they add to their SOA efforts, the greater those systems can deal with change.

Loose coupling the implementation

One of the most fundamental promises of SOA is that service consumers are blind to the implementation technology used by the service providers, and vice-versa. Indeed, the whole idea of the service abstraction is that technology implementations are hidden. This most basic of SOA characteristics is realized using standards-based, interoperable specifications or protocols that provide a contract-based interaction between service consumers and providers. Web services certainly fits the bill as does REST and other styles of service implementation. Indeed, it's not the choice of interoperable specification (whether XML based or not) that enables this level of loose coupling, but rather the service contract. A properly written service contract will allow service consumers to bind to a wide range of service provider implementations without have to know at all whether the service implementation is done in Java, .NET, PHP, C++, or Basic. All SOA implementations must be at least loose! ly coupled at the implementation level, but clearly this is not enough to guarantee the sort of complete loose coupling so desired by the business.

Loose coupling the service contract

XML, Web services, REST, and other specifications hide the implementation of the service such that when the service implementation changes, the service consumer does not need to be the wiser about it. However, what happens when the service contract itself changes? A simple change to acceptable inputs or functional behavior of the system can have profound impact on service consumers. As such, architects that want to progress their SOA initiatives beyond simply Web service integration need to address service contract change management in such a way that contract changes don't cause service consumer breakage.

This might seem to be a difficult proposition, but there are plenty of best practices, architectural approaches, and technologies to facilitate this level of loose coupling. First, a proper service contract that is interface-neutral will alleviate much of the problem of service contract change management. The Service Description Framework (SDF) shared by ZapThink in our Licensed ZapThink Architect (LZA) boot camps is one of those technology-neutral service contract templates. In those approaches, new service contracts don't simply replace old ones. Old contracts are never deprecated unless a transition path is provided for service consumers. This can be as simple as a transformation or as complex as a service-oriented process that is triggered when service consumers request old (and deprecated) versions of the service contract. As such, contract change must be handled as a matter of policy. Who gets what version of a service should be controlled via metadata, not programmatically or via configuration of tightly-coupled infrastructure.

Active management and service intermediaries further simplify the service contract change management issue by providing exception management and handling of service contract differences. And of course, SOA Governance plays a huge role here in helping to manage the sort of change and versioning issues that arise. But probably the best practice in this arena is the use of late-binding approaches that leverage run-time registries and contract-based binding to abstract the binding specifics of service consumers and keep service contract changes from propagating. The topic of late binding is itself a deep conversation that requires rethinking the way that service consumers bind to service providers, and one too long for this ZapFlash.

Loose coupling the service policy

So, putting into play service contracts that abstract implementations and late-binding, intermediary-enabled, registry-based systems that allow for service contract change without breakage enables a great degree of variability in the system, but we're still far from done. Indeed, even if the service contract stays stable, a small change to a service policy can have tremendous repercussions, as discussed in our Butterfly Effect ZapFlash.

Companies looking to address service variability should handle changes to policy the same way they handle changes to service contract: late-binding, service intermediary-enabled, registry-based, and governed. A policy is a form of metadata, as are contracts, and in fact, the only difference between a service policy and a contract is that a policy can apply to any number of services. Because policies control many aspects of the non-functional parts of a service, architects need to include in their architectural plans methods and practices for dealing with service policy versioning and deprecation as well as policy versioning that leverages the technologies and practices established for service contracts. Companies need to test policies just as they test service implementations, and manage policies as rigorously as they manage services. Doing so not only makes the system as a whole more reliable, but enables one more level of loose coupling.

Loose coupling the process

Of course, loosely coupling the service consumer from a service provider only provides agility if the services aren't composed together. Once you have a business process that composes a bunch of services together, we have another area of potential tight coupling. What happens when the process changes? Ideally, a service consumer should not have to know at all when a process is reconfigured. Fortunately, achieving that level of loose coupling is fairly straightforward.

The movement in the SOA and BPM markets has been towards separating the process definition layer from the underlying implementation. By defining processes in metadata and exposing those processes using service contracts (the recursive vision of process compose of service and exposed as service) abstracts the implementation of the process from the service consumer. In fact, in such a scenario, a business process is really a form of service implementation. And just as service contracts provide loose coupling of service implementations, they provide loose coupling of service-oriented processes.

Loose coupling the data schema

If we've enabled all the loose coupling levels defined above, companies should be able to make arbitrary changes to their service implementations, contracts, policies, and processes without breaking a thing (or a sweat). Yet, that's not sufficient to handle the changing needs of the business. What happens when the underlying data schema changes? If a service consumer and provider need to have a common understanding about that in order to have a conversation, we have tight coupling as defined above. Therefore, organizations need to further their loose coupling goals by enabling dynamic and heterogeneous change to the data schema shared between service consumers and providers.

To some, this might seem to be a very complicated task. Computers aren't people, after all, and so they can't process any changes to the format or definition of data. Yet, not all hope is lost here. First, services aren't really interoperable unless they can understand and process data in common. This means that while there might be semantic dependencies between them (which we will address shortly), there does not need to be structural data dependencies between them. Schemas are key to service data interoperability. However, what happens when Schemas change? One key approach is to address information and schema management in the same way you approach service metadata management. Data schema can be treated as a form of metadata and the use of exception management, transformations, service intermediaries, and Data Services (described in more detail here) are all key to enabling loose coupling of data structure. Implementing a Data Services layer introduces loose coupling in a way that provides a separation of concerns, so that underlying data infrastructure changes are insulated from the business services above.

Furthermore, companies need to align the efforts of those maintaining the data schema with those maintaining the service metadata. Why is it that the folks who maintain the schema are not part of the architectural team? Schema are no different than service contracts. They represent a form of metadata that encodes business requirements. As such, we frequently admonish companies to bring their data and information architect teams into their enterprise architect fold. The simple act of this alignment and the establishment of metadata-enabled change management will allow for loose coupling of data schema and structure.

Loose coupling the infrastructure

Before we try to slay the last dragon of loose coupling, it's important to note that all these levels of loose coupling doesn't matter a whit if it all depends on a single vendor's implementation. Too many times we interact with architects who claim that their systems are loosely coupled, but if they move their implementation from one Enterprise Service Bus (ESB) or service infrastructure to another then all hell will break loose. How can they truly say their implementations are loosely coupled with such a huge dependency in mind? Enterprise architects worth a grain of salt will demand that their service implementations be infrastructure neutral. That means that at any time, the company can change their infrastructure without having to rebuild all the service consumers and providers.

Many vendors promise this sort of interchangeability, but few deliver. In fact, the industry as a whole seems to be moving towards single-vendor SOA platforms that will keep many SOA initiatives tightly coupled at this layer. This ZapFlash serves as warning to firms that want to achieve high degrees of loose coupling: keep your implementation infrastructure neutral and you will be successful. Otherwise, your SOA initiatives will only enable partial business agility.

Loose coupling at the semantic layer

The final level of loose coupling is the most challenging of all. Even if a company is enabled to make all the changes it wants to service implementation, contract, policy, process, infrastructure, and data structure, problems still arise whenever there is change to semantics. As we detailed in our Semantic Integration: Loosely Coupling the Meaning of Data ZapFlash, if we impose the data structures of Service providers on service requesters, the result is every bit as tightly coupled as previous architectural approaches. In order to provide the promise of seamless data integration, we must transcend simply loosely coupling the application interface and in addition provide loose coupling at the semantic level.

As we detailed those ZapFlashes, in order to achieve the sort of semantic data integration we are seeking, we must implement dynamic service definitions. In essence, the definition of the service interface must change based on the context of the service requester. As a result, a service can change its contract between invocations. For example, the fact that a service provider requires first names to be no longer than 40 characters should not require the requester to know that fact. The contracted service interface is supposed to provide that isolation. Service interfaces must therefore become much smarter. Instead of having to know ahead of time what specific data requirements are needed by a service, the service requester should be able to dynamically discover a service interface that can not only provide the needed functionality, but also understand the information payload.

The ZapThink take

SOA as a whole is an exercise in loosening the coupling of heterogeneous systems that have to cooperate to meet the needs of the business. As such, as companies seek to mature their SOA initiatives, they should be seeking to iteratively loosen the coupling of their systems at the various levels described above. The most amazing part of this loose coupling exercise is that the greater the degree of variability that can be tolerated by the system, the greater agility that you've enabled for the business. Even more so, if companies can manage to address all seven layers of loose coupling while maintaining a flat cost of architecture, then we've reached the desired state of the IT-Business relationship: IT can implement every requirement and desired outcome expressed by the business without imposing any additional time or cost impedance.

To be specific, in a system that is enabled with all seven layers of loose coupling, changes to service implementations, business processes, service contracts, service policies, runtime infrastructure, data schema, and semantics won't break the system. Can you think of any requirement by business not addressed in those levels of loose coupling? This vision of agility is precisely the aim of SOA, and it clearly requires much broader understanding of SOA than simply loose coupling of the implementation, which is the only capability provided by Web services.


This was first published in December 2007

Dig deeper on Enterprise Services Bus (ESB)

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchSoftwareQuality

SearchCloudApplications

SearchAWS

TheServerSide

SearchWinDevelopment

Close