Consistency

So far in this chapter we’ve looked at ways to enforce the integrity of the data in the domain, so now let’s finish up by taking a look at the related concept of consistency.

We saw some examples of consistency requirements at the beginning of the chapter:

  • The total amount for an order should be the sum of the individual lines. If the total differs, the data is inconsistent.

  • When an order is placed, a corresponding invoice must be created. If the order exists but the invoice doesn’t, the data is inconsistent.

  • If a discount voucher code is used with an order, the voucher code must be marked as used so it can’t be used again. If the order references that voucher but the voucher is not marked as used, the data is inconsistent.

As described ...

Get Domain Modeling Made Functional now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.