A short word of warning - tooltwist/xdata GitHub Wiki

XData is intrinsically a loosely-bound interface. It does not provide any verification of data values or structure. It is intended for use in environments where components are pulled in from different teams and vendors, and it is expected that there will be rough alignment of data.

Since the Java compiler won't be verifying data types and object definitions, you need yourself to ensure that compatible data is being passed around your application. To traditional programmers this might seem like a big deal, but to put it into perspective, this problem is exactly the same problem as the "on the fly" created data types passed around in Javascript and Ruby applications.

Your approach may vary, but the following can be helpful.

Document your Data

The lack of Java interfaces to define data formats is not an excuse for not writing documentation.

  • define the output of code that returns XData objects (database access, web services, etc).
  • define the expected input of code that takes XData as input (widgets, etc).

Write error resistant code

  • the consumer of data should verify the data.

Consider future changes to your application

Some people like to include version numbers in their XData data. The code that consumes the data can access the data differently if the protocol changes.

Testing

Write adequate test cases to detect incompatible data. If you are using the XDS (Cross Data Service) package to intermediate your data producing and data consuming code, you'll find that it's test harnesses are invaluable for this.

We've seen various approaches used successfully, and find that the only important factor is that you take the time to consider that the compiler wont be picking up missing parameters and data type mismatches for you, and adjust your development practices accordingly.

If you take a few precautions, as you would with Javascript or Ruby, you should have no problems.

--