A Pattern Language for Loose Coupling
|
|
Common consensus is that to build systems that scale, in both performance and complexity, that the attribute of being Loosely Coupled is essential and even mandatory. Loose Coupling is ubiquitous in successful systems, unfortunately it is equally elusive in that we have difficulty finding a good definition for it. One can look at almost every definition of SOA and you will find Loose Coupling as part of that definition.
That's one reason why the term SOA is so vacuous, it's defined on something we don't have a good definition of. I would even go out on a limb to say that Loose Coupling is what defines and enables SOA. That is, if you want to successful in identifying structures that support the agile enterprise then you best be familiar with Loose Coupling rather than subscribing to a set of SOA principles.
In the absence of a succinct definition for Loose Coupling, I've decided to define it by enumeration. That is using design patterns. A design pattern is "a named nugget of insight that conveys the essence of a proven solution to a recurring problem within a certain context amidst competing concerns". Here's the collection of named nuggets of insights that I've stubled upon in my travels:
- Publish and Subscribe - When a server does not care to know who the clients are.
- Pull Messaging - When the capabilities of clients are not known in advance. Clients own control flow.
- Reactive Behavior - When one can’t predict the order of messages that are received by a server. Servers react to events.
- Explicit Conversational State - When a server isn't required to remember a previous invocation.
- Cloned State Machine - When concurrent states are required without the use of a central controller.
- Crash Only - When simple recovery is easier than complex prevention
- Non-Blocking Promise - Respond with a provisional response.
- Store and Forward - When we care only that a message is sent.
- Recruiter - When you need to find a server that can best fulfill a task.
- Rendezvous Point - When you need a starting point for finding services.
- Idempotent Endpoints - How do you ensure that the work done by one server does not conflict with others?
- Sturdy References - How do you make resources that survive the lifetime of processes?
- Coarse Grained Invocation - When you need to minimize conversation. That is, communicate everything in a single round trip.
- Delayed Commitement - When options are kept as long as practical and a commitment is made at the last possible moment.
- Explicit Contracts - When information on how to use a service is required to prior to communication.
- Self Describing Messages - When the structure of a message is discovered on demand.
- Semantic Markup - How does one define formats that is both human readable and machine readable?
- Peer Discovery - When maintaining a global directory of information may be prohibitively expensive or time consuming.
- Trampoline - How do you maintain the context of a conversation without reserving a centralized resource to maintain conversational state.
- Integration at the Glass - Services should be composable at the edge.
- Reputation Based Governance - Distributed governance by identifying a currency that is valuable for all participants.
- Prototype Based - When its unclear as to how to classify the objects in the system.
- Queried References - Decouple location in space by providing attribute based searches rather than direct naming.
- Uniform Interfaces - Allow parties to start a conversation without needing to first negotiate how to converse.
- Extension Points - When new functionality needs to be added to an existing system without breaking future additions.
- Behavioral Acquisition - Allow servers to augment existing services by acquiring functionality from other services.
- Behavioral Injection - When an object graph is annotated to allow for it to augmented with additional behavior and structure at a future time.
- Provisional Knowledge - How does one ensure that one can correct mistakes in the future?
- Decentralized Indexing - One can't assume the indices or references to entities can be update atomically
- Federated Administration - Global rules sometimes are suboptimal for a local context.
- Lazy Evaluation - Decouple the problem definition from problem solver.
- Optimistic Transactions - Delayed resource commitment and lazy reconciliation of inconsistencies leads to more flexible coordination of resources access.
- Versioning - Allow clients to continue to be served by deprecated services.
- Paper Trail - A new participant in a conversation needs to discover the current context of a conversation to be able to participate.
- Object Remodularization - When the representation of an object is selected based on the needs of a consuming agent.
- Dynamic Typing - When the messages that an object can respond to is determine only at the time of invocation of that object.
- Pattern Matching - When an agent's execution requires only a subset of the requested communicated data.
- Market Driven Distribution - Use a form of currency to control resource allocation.
- Over Booking - When it is difficult to accurately forecast the demand for a limited resource.
- Leased Resources - How do you ensure that unused distributed resources are garbage collected?
- Roaming Agreements - How do you provide seamless interconnectivity across multiple systems?
- Proposals - Documents to encapsulate negotiations.
- Render Executable Markup - How do you ensure protection simultaneously with flexibility?
- Verb as Proper Nouns - Employ names as a conduit for a proposed action.
It definitely is a long and exhaustive list, but I'm still on the look out for more of them. I'm also in the process of consolidating the list and identifying some overarching structure. In future posts I'll document these patterns in more detail. However, please do let me know other patterns that you may have encountered.


This remind me of a very insightful passage in the book "Mirror Worlds" by David H. Gelernter that briefly and sharply explains the central issues of "communication":
"We might describe communication as, in general, a matter of three separate questions: where, when and who. The answers to any one of them may be, broadly speaking, THIS, ANY, EVERY. When you mail a letter or send a software message, you're sending it to THIS PLACE (the place to which it's addressed), at THIS TIME, to THIS PERSON or THIS COMPUTER - i.e., the specified one. When I say THIS TIME I don't mean instantaneously, of course.
[...]
The problem is that, THIS, THIS and THIS aren't the only useful answers to our Big Three questions. You might want to send a letter to THIS person, ANY place: You don't know where the guy us, or you don't care; [...] Or let's say you have a message for ANY one, ANY place, ANY time. This is a vital species of communication when you're building software ensembles: you constantly confront the need to communicate with ANYONE WHO'S WILLING TO DO THIS NEW TASK."
http://www.amazon.com/gp/reader/019507906X/ref=sib_dp_srch_pop?v=search-inside&keywords=is+a+matter+of+who+when+and+where&go.x=0&go.y=0&go=Go!#
The three dimensions (who, where, when) can be useful in organizing and analyzing loose coupling patterns.
Marco Fabbri
- http://questionmark.blogsome.com -
Replies to this comment