DJ commented on my post addressing the problem Raimond raised with my versioning strategy. He wondered if he'd missed an earlier post where I argued that you not use XSD to validate your data because if you make content optional, you can't use it to check what has to be there. Since I haven't written about that yet, I figured I'd start to address it now.
When people build a schema for a single service, they tend to make it reflect the precise requirements of that system at that moment in time. Then, when those requirements change, they revise the schema. The result is a system that tends to be very brittle. If you take the same approach when you design a schema for use by multiple systems, describing a corporate level model for customer data for instance, things are even worse. Some systems won't have all the required data. They have to decide whether to (a) collect the data, (b) make up bogus data, or (c) not adopt the common model. None of these are good approaches.
To solve both these problems, I've started thinking about my schema not as the definition of what this system needs right now but as the definition of what the data should look like if it's present instead. I move the actual checking for what has to be present inside the system (either client or service) and implement it using either code or a narrowed schema that is duplicate of the contract schema with more constraints in place.
The advantage of this model is that I can change the “has” requirements without changing the shape of the data. Yes, I'm changing my contract and I need to make sure that clients test against the new version before it all goes live. There's a chance, though, that some or even many clients won't have to change. If I revise the schema itself in a way that forces a namespace change, then I have to support parallel contracts or migrate all clients at the same time. Neither is a good option. In other words, I'm trying to minimize schema changes and use testing to pinpoint required code changes.
Posted
Apr 20 2006, 02:51 PM
by
tim-ewald