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.

All our aggregates are wrong @ NDC Copenhagen 2019

195 views

Published on

It always starts well. At first glance the requirements seem straightforward, and implementation proceeds without hiccups. Then the requirements start to get more complex, and you find yourself in a predicament, introducing technical shortcuts that smell for the sake of delivering the new feature on schedule.

In this talk, we’ll analyze what appears to be a straightforward e-commerce shopping cart. We’ll then go ahead and add a few more use-cases that make it more complex and see how it can negatively impact the overall design. Finally, we’ll focus our attention to the business needs of these requirements and see how it can shed light on the correct approach to designing the feature. Walk away with a new understanding on how to take requirements apart to build the right software.

Published in: Software
  • DOWNLOAD FULL BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

All our aggregates are wrong @ NDC Copenhagen 2019

  1. 1. @mauroservienti | NDC Copenhagen all our aggregates are wrong Mauro Servienti @mauroservienti
  2. 2. @mauroservienti | NDC Copenhagen All I wanna do when I wake up in the morning is… Rosanna, Toto. Toto IV
  3. 3. @mauroservienti | NDC Copenhagen Buy a "Banana Protector"
  4. 4. @mauroservienti | NDC Copenhagen Buy a "Banana Protector"
  5. 5. @mauroservienti | NDC Copenhagen Sounds like a nice looking aggregate [ list-of ] - Item ID - Price - Quantity - Inventory - Name - Description Shopping Cart
  6. 6. @mauroservienti | NDC Copenhagen It even has behaviors
  7. 7. @mauroservienti | NDC Copenhagen please, welcome the business
  8. 8. @mauroservienti | NDC Copenhagen Business requirements (#1)
  9. 9. @mauroservienti | NDC Copenhagen Straightforward, isn’t it? [ list-of ] - Item ID - Price - Quantity - Inventory - Name - Description Shopping Cart - Item ID - Price Sales
  10. 10. @mauroservienti | NDC Copenhagen Straightforward, isn’t it? [ list-of ] - Item ID - Price - Quantity - Inventory - Name - Description Shopping Cart - Item ID - Price Sales copy
  11. 11. @mauroservienti | NDC Copenhagen Business requirements (#2)
  12. 12. @mauroservienti | NDC Copenhagen Still not a big deal… - Item ID - Price Sales [ list-of ] - Item ID - Price - Quantity - Inventory - Name - Description Shopping Cart copy - Item ID - Inventory Warehouse copy
  13. 13. @mauroservienti | NDC Copenhagen - Item ID - Price Sales [ list-of ] - Item ID - Price - Quantity - Inventory - Name - Description Shopping Cart - Item ID - Inventory Warehouse However, availability changes over time Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory copy
  14. 14. @mauroservienti | NDC Copenhagen Business requirements (#3)
  15. 15. @mauroservienti | NDC Copenhagen - Item ID - Inventory Warehouse …uhm… Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory - Item ID - Price Sales [ list-of ] - Item ID - Price - Quantity - Inventory - Name - Description Shopping Cart
  16. 16. @mauroservienti | NDC Copenhagen - Item ID - Inventory Warehouse …uhm… Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory - Item ID - Price Sales [ list-of ] - Item ID - Price - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description Shopping Cart
  17. 17. @mauroservienti | NDC Copenhagen - Item ID - Inventory Warehouse …uhm… Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory - Item ID - Price Sales [ list-of ] - Item ID - Price - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description Shopping Cart Is item XYZ in a cart? Swap & Insert Prices
  18. 18. @mauroservienti | NDC Copenhagen - Item ID - Inventory Warehouse …uhm… Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory - Item ID - Price Sales [ list-of ] - Item ID - Price - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description Shopping Cart Is item XYZ in a cart? Swap & Insert Prices Move to Saved for…
  19. 19. @mauroservienti | NDC Copenhagen - Item ID - Inventory Warehouse It’s becoming messy, isn’t it? - Item ID - Price Sales [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description Shopping Cart Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Update XYZ inventory Is item XYZ in a cart? Swap & Insert Prices Move to Saved for… Is item XYZ in a cart? Swap & Insert Prices Move to Saved for…
  20. 20. @mauroservienti | NDC Copenhagen The big picture is even messier! [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description Shopping Cart - Item ID - Inventory Warehouse Is item XYZ in a cart? Update XYZ inventory - Item ID - Price Sales - Item ID - Name - Description Marketing copy Is item XYZ in a cart? Swap & Insert Prices Move to Saved for…
  21. 21. @mauroservienti | NDC Copenhagen …and messier! [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description - Estimated Delivery Shopping Cart - Item ID - Inventory Warehouse Is item XYZ in a cart? Update XYZ inventory - Item ID - Price Sales Is item XYZ in a cart? Swap & Insert Prices - Item ID - Name - Description Marketing copy - Item ID - Delivery Type Shipping Is item XYZ in a cart? Update XYZ delivery Move to Saved for…
  22. 22. @mauroservienti | NDC Copenhagen autonomy? poof, it’s gone
  23. 23. @mauroservienti | NDC Copenhagen Can we get rid of all this coupling? [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description - Estimated Delivery Shopping Cart - Item ID - Inventory Warehouse Is item XYZ in a cart? Update XYZ inventory - Item ID - Price Sales - Item ID - Name - Description Marketing copy - Item ID - Delivery Type Shipping Is item XYZ in a cart? Update XYZ delivery Is item XYZ in a cart? Swap & Insert Prices Move to Saved for…
  24. 24. @mauroservienti | NDC Copenhagen shopping cart doesn’t exist
  25. 25. @mauroservienti | NDC Copenhagen Let’s decompose the Shopping Cart [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description - Estimated Delivery Shopping Cart Warehouse - Item ID - Price - Item ID - Name - Description Marketing - Item ID - Inventory Sales - Item ID - Delivery Type Shipping
  26. 26. @mauroservienti | NDC Copenhagen Sales shopping cart [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description - Estimated Delivery Shopping Cart Warehouse - Item ID - Price - Item ID - Name - Description Marketing - Item ID - Inventory Sales [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity - Item ID - Delivery Type Shipping
  27. 27. @mauroservienti | NDC Copenhagen - Item ID - Price - Item ID - Name - Description Marketing Sales [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity Warehouse shopping cart [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description - Estimated Delivery Shopping Cart [ list-of ] - Cart ID - Item ID - Inventory - Quantity Warehouse - Item ID - Inventory - Item ID - Delivery Type Shipping
  28. 28. @mauroservienti | NDC Copenhagen Shipping shopping cart [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description - Estimated Delivery Shopping Cart [ list-of ] - Cart ID - Item ID - Quantity - Delivery Est. - Item ID - Price - Item ID - Name - Description Marketing Sales [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity [ list-of ] - Cart ID - Item ID - Inventory - Quantity Warehouse - Item ID - Inventory - Item ID - Delivery Type Shipping
  29. 29. @mauroservienti | NDC Copenhagen Marketing tends to be stable [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity - Inventory - Name - Description - Estimated Delivery Shopping Cart [ list-of ] - Cart ID - Item ID - Quantity - Delivery Est. - Item ID - Price - Item ID - Name - Description Marketing Sales [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity [ list-of ] - Cart ID - Item ID - Inventory - Quantity Warehouse - Item ID - Inventory - Item ID - Delivery Type Shipping
  30. 30. @mauroservienti | NDC Copenhagen Do we need the Shopping Cart at all? [ list-of ] - Item ID Shopping Cart [ list-of ] - Cart ID - Item ID - Quantity - Delivery Est. - Item ID - Price - Item ID - Name - Description Marketing Sales [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity [ list-of ] - Cart ID - Item ID - Inventory - Quantity Warehouse - Item ID - Inventory - Item ID - Delivery Type Shipping
  31. 31. @mauroservienti | NDC Copenhagen Can Sales be responsible for that concept? [ list-of ] - Cart ID - Item ID - Quantity - Delivery Est. - Item ID - Price - Item ID - Name - Description Marketing Sales Cart ID [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity [ list-of ] - Cart ID - Item ID - Inventory - Quantity Warehouse - Item ID - Inventory - Item ID - Delivery Type Shipping
  32. 32. @mauroservienti | NDC Copenhagen We followed the coupling [ list-of ] - Cart ID - Item ID - Quantity - Delivery Est. - Item ID - Price - Item ID - Name - Description Marketing Sales Cart ID [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity [ list-of ] - Cart ID - Item ID - Inventory - Quantity Warehouse - Item ID - Inventory - Item ID - Delivery Type Shipping
  33. 33. @mauroservienti | NDC Copenhagen information structure doesn’t fit users
  34. 34. @mauroservienti | NDC Copenhagen Can Read Models be a solution? Marketing Sales Shipping Warehouse others ViewModel Storage Shopping Cart
  35. 35. @mauroservienti | NDC Copenhagen that’s a cache
  36. 36. @mauroservienti | NDC Copenhagen We cannot cache everything
  37. 37. @mauroservienti | NDC Copenhagen What do we have? [ list-of ] - Cart ID - Item ID - Quantity - Delivery Est. - Item ID - Price - Item ID - Name - Description Marketing Sales Cart ID [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity [ list-of ] - Cart ID - Item ID - Inventory - Quantity Warehouse - Item ID - Inventory - Item ID - Delivery Type Shipping
  38. 38. @mauroservienti | NDC Copenhagen Shared identifiers [ list-of ] - Cart ID - Item ID - Quantity - Delivery Est. - Item ID - Price - Item ID - Name - Description Marketing Sales Cart ID [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity [ list-of ] - Cart ID - Item ID - Inventory - Quantity Warehouse - Item ID - Inventory - Item ID - Delivery Type Shipping
  39. 39. @mauroservienti | NDC Copenhagen ViewModel Composition /products/ Browser 1
  40. 40. @mauroservienti | NDC Copenhagen ViewModel Composition /products/ Marketing Sales Shipping Warehouse others Browser IDIDIDIDID 1 ViewModel
  41. 41. @mauroservienti | NDC Copenhagen ViewModel Composition (flow) Marketing Sales Shipping Warehouse Marketing Handler Sales Handler Shipping Handler Warehouse Handler → Request matching HTTP Response -> ViewModel → Composition → Composed ViewModel HTTP Request -> /products/1 composition gateway
  42. 42. @mauroservienti | NDC Copenhagen Let’s focus on the price
  43. 43. @mauroservienti | NDC Copenhagen Sales Product Requests Handler
  44. 44. @mauroservienti | NDC Copenhagen Sales Request matching
  45. 45. @mauroservienti | NDC Copenhagen Sales Composition retrieve data from your favorite source
  46. 46. @mauroservienti | NDC Copenhagen what about writes?
  47. 47. @mauroservienti | NDC Copenhagen ViewModel Decomposition [ list-of ] - Cart ID - Item ID - Quantity - Delivery Est. - Item ID - Price - Item ID - Name - Description Marketing Sales Cart ID [ list-of ] - Item ID - CurrentPrice - LastPrice - Quantity [ list-of ] - Cart ID - Item ID - Inventory - Quantity Warehouse - Item ID - Inventory - Item ID - Delivery Type Shipping
  48. 48. @mauroservienti | NDC Copenhagen ViewModel Decomposition POST -> /shopping-cart/ Browser { ItemID Quantity }
  49. 49. @mauroservienti | NDC Copenhagen ViewModel Decomposition POST -> /shopping-cart/ Browser Sales Shipping Warehouse ID Q.ty ID Q.ty ID Q.ty { ItemID Quantity }
  50. 50. @mauroservienti | NDC Copenhagen Shipping Shopping Cart Requests Handler
  51. 51. @mauroservienti | NDC Copenhagen Shipping Request Matching
  52. 52. @mauroservienti | NDC Copenhagen Shipping Decomposition
  53. 53. @mauroservienti | NDC Copenhagen things might go wrong
  54. 54. @mauroservienti | NDC Copenhagen POST -> /shopping-cart/ Browser Sales Shipping Warehouse ID Q.ty ID Q.ty ID Q.ty { ItemID Quantity } ViewModel Decomposition HTTP no transaction OK
  55. 55. @mauroservienti | NDC Copenhagen Shipping Shopping Cart Requests Handler
  56. 56. @mauroservienti | NDC Copenhagen Shipping Decomposition
  57. 57. @mauroservienti | NDC Copenhagen Shipping Error Handling
  58. 58. @mauroservienti | NDC Copenhagen Append Only Model It’s not Event Sourcing
  59. 59. @mauroservienti | NDC Copenhagen there is no such thing as orchestration
  60. 60. @mauroservienti | NDC Copenhagen Full Vertical Slices MarketingSales Warehouse Shipping behavior & databehavior & data behavior & databehavior & data ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition
  61. 61. @mauroservienti | NDC Copenhagen services need to communicate
  62. 62. @mauroservienti | NDC Copenhagen Business requirements • Notify users of 1 week stale carts • Wipe 1 month stale carts
  63. 63. @mauroservienti | NDC Copenhagen Services communication channel MarketingSales Warehouse Shipping behavior & databehavior & data behavior & databehavior & data ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition
  64. 64. @mauroservienti | NDC Copenhagen Services communication channel MarketingSales Warehouse Shipping behavior & data behavior & data behavior & databehavior & data ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition Add Item to Cart
  65. 65. @mauroservienti | NDC Copenhagen Services communication channel MarketingSales Warehouse Shipping behavior & data behavior & data behavior & databehavior & data ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition Add Item to Cart 1. Set 1 week timeout
  66. 66. @mauroservienti | NDC Copenhagen Services communication channel MarketingSales Warehouse Shipping behavior & data behavior & data behavior & databehavior & data ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition Add Item to Cart 1. Set 1 week timeout 2. Set 1 month timeout
  67. 67. @mauroservienti | NDC Copenhagen 1 week later MarketingSales Warehouse Shipping behavior & data behavior & data behavior & databehavior & data ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition Add Item to Cart 1. Set 1 week timeout 2. Set 1 month timeout Cart Got Stale
  68. 68. @mauroservienti | NDC Copenhagen 1 week later MarketingSales Warehouse Shipping behavior & data behavior & data behavior & databehavior & data ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition Add Item to Cart 1. Set 1 week timeout 2. Set 1 month timeout busCart Got Stale
  69. 69. @mauroservienti | NDC Copenhagen 1 week later MarketingSales Warehouse Shipping behavior & data behavior & data behavior & databehavior & data ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition Add Item to Cart 1. Set 1 week timeout 2. Set 1 month timeout bus Cart Got Stale
  70. 70. @mauroservienti | NDC Copenhagen 1 week later MarketingSales Warehouse Shipping behavior & data behavior & data behavior & data behavior & data ViewModel Composition ViewModel Composition ViewModel Composition ViewModel Composition Add Item to Cart 1. Set 1 week timeout 2. Set 1 month timeout bus Notify User Cart Got Stale
  71. 71. @mauroservienti | NDC Copenhagen 1 month later MarketingSales Warehouse Shipping behavior & data behavior & data behavior & databehavior & data ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition Add Item to Cart 1. Set 1 week timeout 2. Set 1 month timeout bus Cart Expired
  72. 72. @mauroservienti | NDC Copenhagen busCart Expired 1 month later MarketingSales Warehouse Shipping behavior & data behavior & data behavior & databehavior & data ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition Add Item to Cart 1. Set 1 week timeout 2. Set 1 month timeout Cart Expired
  73. 73. @mauroservienti | NDC Copenhagen 1 month later MarketingSales Warehouse Shipping behavior & data behavior & data behavior & databehavior & data ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition Add Item to Cart 1. Set 1 week timeout 2. Set 1 month timeout busCart Expired Cart Expired
  74. 74. @mauroservienti | NDC Copenhagen 1 month later MarketingSales Warehouse Shipping behavior & databehavior & data behavior & data behavior & data ViewModel Composition ViewModel Composition ViewModel Composition ViewModel Composition Add Item to Cart 1. Set 1 week timeout 2. Set 1 month timeout bus Wipe cart Wipe cart Cart Expired Cart Expired
  75. 75. @mauroservienti | NDC Copenhagen cross-services events can be as thin as event name and identifiers
  76. 76. @mauroservienti | NDC Copenhagen bus The final big picture MarketingSales Warehouse Shipping behavior & databehavior & data behavior & databehavior & data UI Shell ViewModel Composition ViewModel Composition ViewModel CompositionViewModel Composition
  77. 77. @mauroservienti | NDC Copenhagen time tyranny Demos bit.ly/ndc-copenhagen-demos Udi Dahan talking about boundaries go.particular.net/ndc-copenhagen-boundaries
  78. 78. @mauroservienti | NDC Copenhagen Takeaways
  79. 79. @mauroservienti | NDC Copenhagen Takeaways • Boundaries are key to success • Do not bring in more technology to solve non- technical problems
  80. 80. @mauroservienti | NDC Copenhagen Takeaways • Boundaries are key to success • Mental model can badly influence design • Users/Business analysts tend to think in term of data presentation
  81. 81. @mauroservienti | NDC Copenhagen Takeaways • Boundaries are key to success • Mental model can badly influence design • Do not name things prematurely • Premature names stick and drive data aggregation
  82. 82. @mauroservienti | NDC Copenhagen Takeaways • Boundaries are key to success • Mental model can badly influence design • Do not name things prematurely • Behaviors define how to aggregate data • Group data that change together and that influence each other • Use anti-requirements techniques to validate data grouping • Follow the coupling
  83. 83. @mauroservienti | NDC Copenhagen Takeaways • Boundaries are key to success • Mental model can badly influence design • Do not name things prematurely • Behaviors define how to aggregate data • Use Composition techniques to present data • No need for complex projections and centralized read models
  84. 84. @mauroservienti | NDC Copenhagen Mauro Servienti Solution Architect @ Particular Software the makers of NServiceBus mauro.servienti@particular.net @mauroservienti //milestone.topics.it
  85. 85. @mauroservienti | NDC Copenhagen Thank you! I’ll be around to answer your questions the whole day

×