Loose Coupling

“An XML document is loosley coupled with it’s schema… This means that programs that extract data directly from the XML structure using standard XML expressions such as XPath are idependant of the schema and loosley coupled with the structure itself”


That quote is from David A. Chappell’s Enterprise Service Bus, which is my current lunchtime reading, and it serves to illustrate a point which is often overlooked in discssing XML as a message format. I can write a simple, ten line, piece of Progress code which can read this XML file and work out what the customer number is.


<br />
<customer id="123"><br />
<address>.....</address><br />
</customer><br />


Now, that exact same program should give me exactly the same result if I throw this input file at it instead –


<br />
<customer id="123"><br />
<billingaddress>....<billingaddress><br />
<deliveryaddress>....<deliveryaddress><br />
<outstandingorders>.....<outstandingorders><br />
</customer><br />


Despite the fairly significant changes to the structure of the file, my program will continue to function exactly as intended. If I was writing Progress code to read temp-table parameters rather than XML documents and I changed the structure this radically, I’d almost definitely have to visit every routine which made use of the temp-table and at least re-compile. XML gives loose coupling with the data structure.


Why’s this cool? Well I wouldn’t want to switch to start using XML documents as parameters throughout my application. In a lot of cases it’s pretty important that Progress does run-time parameter type checking, but there are times when it can be extremely useful to be able to enhance and extend the schema without having to visit everyplace it’s being used. I’m thinking particularly about the integration where there are often many, large, complex applications involved in processes. Changing the definitions of inter-application messages can be extremely costly involving a number of different development teams and complex testing processes. The ability to simply extend the schema without impacting all of the existing services could make a real difference to the feasability of a project.


Part of the whole SOA concept is about loosely coupling your applications / services. Using XML messages gives you a loose coupling with your data structures.