3 ms·
Denormalization is often a practical answer; the order service keeps an (immutable) copy of the customer's name and delivery address. If the customer changes t
by perlgeek 11y ago
Denormalization is often a practical answer; the order service keeps an (immutable) copy of the customer's name and delivery address.
If the customer changes the address, it will only matter for new orders.
One can argue that this is actually a sensible behavior, because there's a point after which you can't change the delivery address anyway (once it has been handed over to the delivery service, for example), and this behavior of copying the address just moves the point a bit.
Likewise, when a customer buys a product, a copy of the product description and price is included in the order; if the price changes between the checkout and the delivery, it's good if that isn't reflect in the amount that is invoiced. After all, the checkout established a contract that cannot be easily changed retroactively.
- kisstheblade 11y agoGood point. In this case at least it is actually preferable to copy the customer data over to the order.
- Terr_ 11y agoRight, I think this is an example of the importance of good requirements and scenarios before coding. While programmers may prefer to create denormalized "model of everything at once", some business processes require copies and snapshots. Not as implementation details, but directly.
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]