Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Embrace Events and let CRUD die

378 views

Published on

Talk delivered in Warsaw during 4Developer Conference 2016

Published in: Engineering
  • Be the first to comment

Embrace Events and let CRUD die

  1. 1. Embrace Events and let CRUD die @cakper
  2. 2. Goal
  3. 3. CRUD
  4. 4. Who knows what CRUD is?
  5. 5. Clients Database DTO’s/DomainObjects Data Presentation Service Business Logic
  6. 6. Well known
  7. 7. Easy to sell
  8. 8. Tooling
  9. 9. Who never had problems with it?
  10. 10. Soft Delete
  11. 11. Audit
  12. 12. Calculating changes
  13. 13. Scaling
  14. 14. 3rd Normal Form
  15. 15. Optimised for write
  16. 16. Large & slow queries
  17. 17. But that’s good!
  18. 18. In the WRITE context
  19. 19. What is your write:read ratio?
  20. 20. Some of the applications are read heavy
  21. 21. Joins are expensive
  22. 22. Can’t we all become join vegans? Alberto Brandolini
  23. 23. Denormalisation
  24. 24. Read models
  25. 25. You have to maintain two models now
  26. 26. What if we treat change as a first class citizen?
  27. 27. Event Sourcing
  28. 28. Book added to library Book lent to reader Book extended Book returned
  29. 29. Event 1. something that happens or is regarded as happening; an occurrence, especially one of some importance.
  30. 30. Current state is a left-fold over past events Greg Young
  31. 31. Aggregate
  32. 32. Consistency boundary
  33. 33. Consuming commands
  34. 34. Producing events
  35. 35. Reconstituting from history
  36. 36. Snapshotting
  37. 37. Testing
  38. 38. State-based testing
  39. 39. We test what changed
  40. 40. What about things that didn’t?
  41. 41. Behaviour-based testing
  42. 42. Given: Book “DDD” was added to library When: Reader lends “DDD” book Then: Book “DDD” was lent to reader
  43. 43. Given: Book “DDD” was added to library Book “DDD” was lent to reader When: Reader lends “DDD” book Then: Exception: Book “DDD” already lent
  44. 44. Event Store
  45. 45. Append-only
  46. 46. Scaling
  47. 47. Optimistic locking
  48. 48. Retries
  49. 49. Integration
  50. 50. MQ
  51. 51. REST
  52. 52. 2PC
  53. 53. Eventual consistency
  54. 54. Projections
  55. 55. Query optimised storage
  56. 56. Task-based UI
  57. 57. Business Value 
 of Events
  58. 58. Insight into past data
  59. 59. Business Intelligence
  60. 60. Legal compliance
  61. 61. Debugging
  62. 62. How do we get there?
  63. 63. Event Storming
  64. 64. odd-looking workshop that has a massive consumption of orange sticky notes Alberto Brandolini
  65. 65. How does it work?
  66. 66. Start by capturing Domain Events
  67. 67. Domain Event
  68. 68. Book added to library Book extended Book added to inventory Reader identity confirmed Reader registered Book reservation placed Book lent to reader Book recalled Book returned
  69. 69. Behavioural mindset
  70. 70. Timeline
  71. 71. Book added to library Book extended Book added to inventory Reader identity confirmed Reader registered Book reservation placed Book lent to reader Book recalled Book returned
  72. 72. Naming
  73. 73. Book added to library Book extended Book added to inventory Reader identity confirmed Reader registered Book reservation placed Book lent to reader Book recalled Book returned
  74. 74. Complexity
  75. 75. Reader registered Reader identity confirmed Identity Confirmed by Carer Deposit paid Deposit Not Paid Reader Account Activated
  76. 76. Pin point risks
  77. 77. Risk
  78. 78. Reader registered Reader identity confirmed Identity Confirmed by Carer Deposit paid Deposit Not Paid Reader Account Activated Registration
  79. 79. Right People
  80. 80. Event sources
  81. 81. Users
  82. 82. Command
  83. 83. Book Lent Lend Book Reader Book Already Lent
  84. 84. Other events
  85. 85. Policy
  86. 86. Book Returned Late Penalize Lock Account
  87. 87. Time
  88. 88. Book reserved for the user Release book
  89. 89. External systems
  90. 90. External System
  91. 91. Payment Gate Money Received
  92. 92. Grouping commands
  93. 93. Aggregates
  94. 94. Book Lent Book Returned Book Book Extended Return Lend Extend
  95. 95. Making decision
  96. 96. Read Model
  97. 97. Book Returned Book Added Book Lent Available Books
  98. 98. Making it work
  99. 99. Available Books Reader Lend Book Book Lent
  100. 100. User Command Aggregate External System Domain Event Read Model Policy Command UI Picture that explains everything by Alberto Brandolini
  101. 101. Want to facilitate it?
  102. 102. Unlimited modelling surface
  103. 103. No chairs
  104. 104. Loads of sticky notes & sharpies
  105. 105. People with questions
  106. 106. People with answers!
  107. 107. Final words
  108. 108. Tools
  109. 109. Event Store
  110. 110. Messaging
  111. 111. Projections
  112. 112. Right problems
  113. 113. Make models useful but not perfect
  114. 114. Explicit Complexity
  115. 115. Intention-revealing interfaces
  116. 116. Writing software is about learning
  117. 117. Technical excellence
  118. 118. Thanks! @cakper

×