Tim P (9) [Avatar] Offline
#1
Hi
Your example (2 instructions to reduce by 2000ft) is not good because it's a relative instruction based on internal state. But why not simply issue an instruction to reduce altitude to 3000ft. Then your commands become unambiguous.

Also - automatic rejection based on aggregate version number can lead to queuing problems. Let us suppose that I open booking for a show at 10am and there is huge demand.
Immediately I get 30 requests all based on version 0.
One gets through.
The other 29 are rejected and have to be re-submitted. I send all those validation failures and the users resubmit based on the current state - now version 1. So this time someone else gets accepted, but 28 get rejected. Eventually I have to deal with a total of O(n2) requests. Also the position in the queue no longer depends on the original request ordering - and quite possibly people booking in positions 31+ sneak in first.

To take another example from your airplane aggregate - I tell them to reduce to 3000ft because there's a collision risk but in the meantime they've served a meal and the kitchen stock of chicken chasseur has been decreased by 1, so the request is rejected ...

Versioning may work in some cases but you can't present it as a panacea to conflict resolution.