Hacker News new | ask | show | jobs
by cwalv 502 days ago
You write the 'add item' event regardless, and when building the 'cart' view you handle the limit.
4 comments

add_item is not an event, rather a command/ request that is yet to be validated. item_added is the event = a fact that was 'allowed to happen' by the system.

Keeping commands in a persistent store is a matter of choice but not necessary. I've seen people doing command sourcing and calling it event sourcing.

Alternatively "invalid cart" could itself become an event.
Well, assume the non-overdraftable bank account example instead then, what do you do then?
Sounds like an easy way to run out of storage space