Advertisement

More Related Content

Advertisement

State, when state?

  1. State, when state? answering the (some/mes) unanswerable
  2. The “default” layered architecture (simplified) API Applicationservices Repository/ORM DomainModels Client
  3. The “default” layered architecture CQRSified Client QueryAPI Queryservices Repository/ORM CommandAPI Commandservices DomainModels
  4. – Bertrand Meyer / Object-oriented So5ware Construc:on (1988) “Every method should either be a command that performs an ac7on, or a query that returns data to the caller, but not both. In other words, asking a ques7on should not change the answer.”
  5. “One ques7on that has been hiAng me is whether or not this is something that may work as a paBern at the object granularity as opposed to the endpoint as many of these types of paBerns are relevant to both scopes.” – Greg Young / hDp://codebeDer.com/gregyoung/2009/08/13/command-query-separa:on/
  6. The “default” layered architecture CQRSified Client Repository/ORM CommandAPI Commandservices Command Model QueryAPI Queryservices QueryModel QueryAPI Queryservices QueryModel QueryAPI Queryservices QueryModel QueryAPI Queryservices QueryModel
  7. What is in fact “current state”?
  8. Eventual consistency
  9. Distributed architectureDistributed architecture QueryAPI Queryservices QueryModel QueryAPI Queryservices QueryModel QueryAPI Queryservices QueryModel QueryAPI Queryservices QueryModel ORM/Repository customerOnboarded: { aggregate_id: “b766f9d2”, payload: [name, email] } Client Cursor Cursor ORM/RepositoryORM/Repository customerEmailChanged: { aggregate_id: “b766f9d2”, payload: [email] } AggregateAggregateAggregate CommandAPI Commandservices Command Model CommandAPI Commandservices Command Model CommandAPI Commandservices Command Model
  10. –Mar:n Fowler hDps://mar:nfowler.com/eaaDev/EventSourcing.html “Event Sourcing ensures that all changes to applica7on state are stored as a sequence of events. Not just can we query these events, we can also use the event log to reconstruct past states, and as a founda7on to automa7cally adjust the state to cope with retroac7ve changes.”
  11. What have we gained? (1) System can be put it any prior state (2) Temporal queries (3) Future needs (4) TesDng is easier as there is no update and delete (5) Distributed transacDons possible (6) Complete state reconstrucDon at any Dme! (7) Easier replicaDon/backups (8) Regulatory compliance
  12. Thank you! Armin Pašalić / @krule
  13. ! Ques=ons?
Advertisement