'Event Storming | Command | Validation | Rules | Make it visible

I'm practicing event-storming, with sticky notes and stuffs.

But one thing is missing: command validation (rules to be satisfied for a command to be accepted / succeed).

How to make it visible in the whiteboard? (not just as comments sprinkled here and there). Event-storming only mentions "events" (yellow), "command" (blue), "aggregate" (pale yellow), etc. I don't see "command validation" as first-class citizen.

Any thoughts?



Solution 1:[1]

I would consider command validation as policies in event storming. Those are business rules that must be satisfied for a command to be accepted.

They will go on pink "policy" sticky note - https://eventnotes.io/pdf/cheatsheet-big-picture-exploration.pdf

I consider policies as:

  • Control how the action plays out
  • Business rules
  • Decisions
  • When an event occurs, you apply policy and decide what the next action is
  • Reactive logic
  • External decision
  • Time based
  • Trigger based
  • Reacts on events
  • Triggers commands
  • Often at domain boundary

Solution 2:[2]

I had this same trouble and worked through it like this.... First understand there are different types of validation. What is the type of validation you want to do?

Do you want to validate a model to ensure the order address is correctly formatted? This would only extend to "schematic" validation and could be done synchronously as part of your command, and would be what I would call Command Validation. I would make a note somewhere with the language as this will be taken through to build the contract.

Do you want to validate that "if there isn't enough stock to complete the order the order should fail"? It is not the commands responsibility to validate business logic, it is the aggregate; and I would call this Domain Validation. I use negative events to indicate some form of validation has taken place in the aggregate.

I hope this helps

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shaunak Sontakke
Solution 2 Kieran