Java Reference
In-Depth Information
</xsd:element>
<xsd:element name="title"/>
<xsd:element name="price"/>
<xsd:element name="category"/>
<xsd:element name="author"/>
</xsd:schema>
The advantage to this pattern is that because the elements are declared globally, the schema
is reusable. But because changing an element affects the composing elements, Salami Slice
schemas are considered tightly coupled.
Schemas that follow this pattern are verbose. Things are clearly arranged and flat.
Note too that schema reuse can often mean tight coupling for your services. See the discussion
at the end of this recipe for more on that matter.
The Russian Doll and the Salami Slice operate at opposite ends of the spectrum. Because of
their purity in insisting on either total rigidity or total flexibility, they have clear advantages
and clear disadvantages. The next pattern, Venetian Blind, meets in the middle and offers the
best of both worlds.
Venetian Blind
Venetian Blind is an extension of Russian Doll. It contains only one single global root element.
It departs from Russian Doll in that it allows for reuse of all types as well as the global root
element.
Using Venetian Blind means that you define a single global root element for instantiation, and
compose it with externally defined types. This has the benefit of maximizing reuse.
Venetian Blind has the following characteristics:
▪ It has a single global root element.
▪ It mixes global and local declarations. Contrast this with Russian Doll, in which all types
are local, and Salami Slice, in which all types are global.
▪ It has high cohesion but also high coupling. Because its components are coupled and not
self-contained, it can occasion coupling with other schemas.
▪ It maximizes reuse. All types and the root element can be recombined.
▪ Because types are exposed, encapsulation is limited.
▪ It allows you to use multiple files to define your schema.
Search WWH ::




Custom Search