pcah/python-clean-architecture

Application: Command-based Application pattern

lhaze opened this issue · 0 comments

lhaze commented

Command-based Application is a synchronous application design that follows CQRS principles. It splits all interactions on two separate kinds:

  • query interactions that return data but don't mutate any fragment of application state
  • command ones that can change the state and don't return anything but the status of their execution.

Query & command interactions might be served by separate component stacks (and therefore may differ on entity compositions, normalization of DAOs or locking strategies).

Command-based Application is one of the simplest in terms of web or CLI application design. Application is always the initiator of the execution and the query interactions are always pulled and commands are always pushed. The design assumes that once the request is served, almost everything(*) has been executed and there's nothing more to do.

(*) "Almost" because some of the execution might have been deferred and the consistency of the application state may be "only" eventual (i.e. it will happen any time soon, but not in the exact moment of serving the response).