O'Reilly logo

SOA in Practice by Nicolai M. Josuttis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Versioning of Data Types

When different versions of services exist, different versions of data types are also involved (at least, if the services use structured data types). Dealing with this issue can become a lot more difficult than just dealing with different service versions.

Say, for example, that a new attribute for a Post Office box is added to a service that returns data including an address. That is, the existing address type, which has the following attributes:

String street
String zipcode
String city

gets this new attribute:

String postbox

Because older versions of the service use the older address type and newer versions of the service use the newer address type, two different address types are in use in the same runtime environment (see Figure 12-2.

Two different versions of an address type

Figure 12-2. Two different versions of an address type

The question is how to deal with this fact. In principle, there are three possible options:

  • Use different types for typed interfaces.

  • Use the same types for typed interfaces.

  • Use generic code so that type differences don't matter.

I will discuss these options now in detail.

Using Different Types for Different Versions of a Data Type

When using different types for different versions of a type, you might be tempted to simply apply the same rule I suggested in Trivial Domain-Driven Versioning for naming and distinguishing between the types. However, this situation is more complex, for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required