A good workman is known by his tools.
Originally posted by Marc Peabody:
As good OOAD folks would do, we're hoping to share this Item xsd definition across the two services.
The problem now is that if one service needs an extra field added to Item and we change the shared definition for Item, it would effect all dependent services because they all share the same xsd type. Should we allow that? Or should Item not be changed and we instead create a different ItemWithNewField or DeepItem or similar type to be used by only the service that needs it? If we go that route, would it make more sense to name the new version of type Item something else or simply give it a different namespace?
Based on my own experience (and others), I recommend that you have a basic set of fundamental types that you can compose to other types (structures, records) and sequences (arrays). Be careful with enumerations (an anachronism from the time when each byte did count - use strings instead), inheritance and polymorphism (even when XML supports it).
Originally posted by Remote Reference:
The ideal situation will be to achieve a single canonical representation for the entity (within a distinct business domain) on which general consensus can be agreed to by multiple systems requesting that entity.
... In fact, when object-orientation became mainstream, having a common business object model (BOM) became a general goal. But, it turned out that this approach was a recipe for disaster for large systems.
The first reason for the disaster was an organizational one: it was simply not possible to come to an agreement for harmonized types ... Either you didn't fulfill all interests, or your model became became far too complicated, or it simply was never finished. This is a perfect example of "analysis paralysis": if you try to achieve perfection when analyzing all requirements, you'll never finish the job.
... different systems enhance differently. Say you create a harmonized data type for customers. Later, a billing system might need two new customer attributes to deal with different tax rates, while a CRM system might introduce new forms of electronic addresses, and an offering system might need attributes to deal with privacy protection. If a customer data type is shared among all your systems (including systems not interested in any one of these extensions), all the systems will have to be updated accordingly to reflect each change, and the customer data type will become more and more complicated.
Sooner or later, the price of harmonization becomes too high. Keeping all the systems in sync is simply too expensive in terms of time and money. ...
Common BOMs do not scale because they lead to a coupling of systems that is too tight. As a consequence, you have to accept the fact that data types on large distributed systems will not be harmonized. In decoupled large systems, data types differ.
... if data types are not harmonized, you need data type mappings (which include technical and semantic aspects). Although mapping adds complexity, it is a good sign in a large systems because it demonstrates that components are decoupled.
... Note that a service consumer should avoid using the provider's data types in it's own source code. Instead the consumer should have a thin mapping layer to map the provider's data types to its own data types. ...
... Having no common business data model has pros and cons:
The advantage is that systems can modify their data types without directly affecting other systems (modified service interfaces affect only corresponding consumers) The drawback is that you have to map data types from one sytems to another.
... To promote loose coupling, fundamental datatype harmonized for all services should usually be very basic. The most complicated common data type I've seen a phone company introduce in a SOA landscape was a data type for a phone number (a structure/record of country code, area code, and local number). The trial to harmonize a common type of address (customer address, invoice addresses, etc.) failed {how to deal with titles of nobility? disparate constraints of different systems and tool to process and print addresses}.
... If you are able to harmonize, do it. Harmonization helps. However don't fall into the trap of requiring that data types be harmonized. This approach doesn't scale.
{To deal with differences between multiple related types (e.g. addresses) for consumers} ... introduce a composed service that allows you to query and modify addresses. The service then deals with the differences between the backend systems by mapping the data appropriately.
...
I would be very interested to know the various alternative ways how the web service stack can be made to tolerate the extra elements. I perceive this as a transformation layer between the canonical and the special message at the service end point for that specific client.
A good workman is known by his tools.
Originally posted by Marc Peabody:
The only major negative consequence I can see with this approach is that potential service clients who discover a service endpoint see the types defined in the request or response and assume that all of these "optional" elements are relevant to the endpoint.
What about just forgetting harmonization altogether? I imagine it would be tremendously frustrating for a client to call two difference services with similar data but in one service a tag is organization while in the other service it is organisation or org or company. It would be terrific to at least keep tag names in harmony.
Originally posted by Marc Peabody:
I believe I picked up from both of you that adding optional elements to a type can be a nice way of using the same type across multiple endpoints that communicate with slightly different versions of essentially the same data type.
The only major negative consequence I can see with this approach is that potential service clients who discover a service endpoint see the types defined in the request or response and assume that all of these "optional" elements are relevant to the endpoint.
What about just forgetting harmonization altogether? I imagine it would be tremendously frustrating for a client to call two difference services with similar data but in one service a tag is organization while in the other service it is organisation or org or company. It would be terrific to at least keep tag names in harmony.
These two xsd design strategies, when contrasted, present a major tradeoff between xsd reusability and (human) clarity.
It would be great to have the best of both worlds:
1) An enterprise-wide harmony type that defines all possible elements, most of which are optional. This helps to standardize naming.
2) A service-specific type that adheres to the naming of its harmony type but lists only the elements that the service supports. This helps to communicate to the client exactly what the service supports.
Originally posted by Bob Jake:
Forgetting harmonization will be at antithesis to the SOA philosophy.
Using multiple schema however poses an interesting problem.
Willie Smits can speak 40 languages. This tiny ad can speak only one:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|