- Conceptech Limited - http://blog.conceptech.co.uk -
Practical Loose Coupling - Part 2
Posted By Jon On 12/03/2008 @ 09:06 am In How to Architect | No Comments
Following on from my previous [1] post about Practical Loose Coupling
So what is going on? What has happened to wreck havoc on what was probably a perfectly good set of systems? Let’s try a little exercise to see if we can simulate the effect.
First let us start with two nicely designed systems; System A and System B. System A needs to get some information from System B, for example the price of a product. Now the implementer of System A decides to play by the rules and use the interface already provided by System B. The designer of System B had realised that the price information they held would someday be useful to someone. They included in their design an interface which given a product code would return the corresponding price.
Now not wanting to state the obvious, but are we clear what an interface actually is? Sure it is some method or call you can make but is there a more fundamental point here? The interface is a contract. A contract is a way of saying, if you do this for me, I will do that for you. If you pay me some money then I will design a system for you; or give you a car; or fly you to the other side of the world. An interface contract is no different. If you send me some data formatted in this way, and you send it using this technology protocol, and you provide this type of security credential, then I will give you some data back; or update a database; or whatever. I may also insist that you take another action first, or follow-up with another action, such as a commit, before I will promise to do what you ask. The point is that the interface is far more than the specific call you make; there may be a whole set of activities that we both have to do in order for the desired result. At this point I get a mental image of of two tropical birds taking part in an intricate courtship dance. Wheeling and twirling in just the right way. Ensuring that no foot is put wrong. Unfortunately most interfaces are far less interesting and much less productive.
So back to our example. Our two systems are busy with their courtship dance. System A understands, by way of the interface contract of System B, what it needs to do. It creates a request in just the right format, it invokes the right type of communication technology and presents it credentials. System B takes the request from the communication stack, checks out the credentials and looks at the request. Assuming all is well it will find the price information and put it back on the communications stack and send it on its way back to System A. All is well in the world.
Article printed from Conceptech Limited: http://blog.conceptech.co.uk
URL to article: http://blog.conceptech.co.uk/2008/03/12/practical-loose-coupling-part-2/
URLs in this post:
[1] post: http://blog.conceptech.co.uk/2008/03/10/practical-loose-coupling/
Click here to print.