SetStatus(itemId, Deactivated) tells an application what a field should contain. DeactivateInventoryItem(itemId, reason) tells it what the user wants to do.
That difference matters when the action has rules. A deactivation may require a reason, permission, a valid state transition, and a transaction that saves the result. With a behavior-focused command, those concerns have one natural home instead of being inferred from changed fields or scattered between the UI and a generic update handler.
The UI can still help by explaining obvious failures early. It cannot be the final authority because another client, a retry, or a concurrent request can reach the same operation.
A command is also not an event. A command asks for work and may be rejected. An event describes something that already happened after the command succeeded.
Top comments (0)