Command-Query Responsibility Segregation: теория и практика

2,000 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,000
On SlideShare
0
From Embeds
0
Number of Embeds
377
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Command-Query Responsibility Segregation: теория и практика

  1. 1. Command / Query ResponsibilitySegregation<br />теория и практика<br />
  2. 2. О чем пойдет речь?<br /><ul><li>Немного теории
  3. 3. С чего мы начали?
  4. 4. Куда мы движемся?
  5. 5. Чем пользоваться?
  6. 6. Что в итоге?</li></li></ul><li>Теория<br />
  7. 7. Типовые свойства<br /><ul><li>Бизнес развивается
  8. 8. Сложность принятия решений
  9. 9. Новые роли
  10. 10. Масштабируемость
  11. 11. Старые компоненты
  12. 12. Расходы на разработку</li></li></ul><li>С чего все начинают?<br />Shared Services<br />End User Interface<br />Backoffice<br />Service Layer<br />Application Facade<br />Domain Model<br />DB1<br />DB2<br />Services<br />
  13. 13. С чего все начинают?<br />
  14. 14. С чего все начинают?<br />
  15. 15. Как все заканчивается?<br />
  16. 16. Command / Query Responsibility Segregation<br /><ul><li>Command / Query Separation
  17. 17. Event Sourcing
  18. 18. Task Based User Interface
  19. 19. Messaging
  20. 20. Domain Driven Design</li></li></ul><li>Command/Query Separation<br />End User Interface<br />Application Server<br />SELECT * FROM Product<br />UPDATE Product<br />DB<br />
  21. 21. Command/Query Separation<br />End User Interface<br />Application Server<br />Query<br />Command<br />SELECT * FROM Product<br />UPDATE Product<br />DB<br />
  22. 22. Command/Query Separation<br />End User Interface<br />Application Server<br />Query<br />Command<br />SELECT * FROM Product<br />UPDATE Product<br />DB<br />
  23. 23. Command/Query Separation<br />End User Interface<br />Application Server<br />Query<br />Command<br />SELECT * FROM Product<br />UPDATE Product<br />Queries Cache<br />Domain Persistence<br />
  24. 24. Command/Query Separation<br />End User Interface<br />Reporting<br />Domain Model<br />UPDATE Product<br />SELECT * FROM Product<br />Queries Cache<br />Domain Persistence<br />
  25. 25. Command/Query Separation<br />End User Interface<br />AddProductToTheCart<br />Reporting<br />Domain Model<br />INSERT INTO CartINSERT INTO CartItem<br />Queries Cache<br />Domain Persistence<br />
  26. 26. Command/Query Separation<br />End User Interface<br />AddProductToCart<br />Reporting<br />Domain Model<br />INSERT INTO CartINSERT INTO CartItem<br />ProductToCartAdded<br />View Data Cache<br />Domain Persistence<br />
  27. 27. Command/Query Separation<br />End User Interface<br />AddProductToCart<br />Reporting<br />Domain Model<br />INSERT INTO CartINSERT INTO CartItem<br />INSERT INTO ProductsInCart<br />ProductToCartAdded<br />View Data Cache<br />Domain Persistence<br />
  28. 28. Command/Query Separation<br />End User Interface<br />AddProductToCart<br />SELECT * FROM ProductsInCart<br />Reporting<br />Domain Model<br />INSERT INTO CartINSERT INTO CartItem<br />INSERT INTO ProductsInCart<br />ProductToCartAdded<br />View Data Cache<br />Domain Persistence<br />
  29. 29. Event Sourcing<br />
  30. 30. Event Sourcing<br />КАК?! <br />У Вас на счету: -19435.89₴<br />
  31. 31. Event Sourcing<br />У Вас на счету: -19435.89₴<br />Перемещение средств:<br />
  32. 32. Event Sourcing<br />End User Interface<br />Reporting<br />Domain Model<br />ProductToCartAdded<br />ProductFromCartRemovedProductQuantityChanged<br />…..<br />View Data Cache<br />Domain Persistence<br />Events Storage<br />
  33. 33. Event Sourcing<br />End User Interface<br />Reporting<br />Domain Model<br />ProductToCartAdded<br />ProductFromCartRemovedProductQuantityChanged<br />…..<br />View Data Cache<br />Domain Persistence<br />Events Storage<br />
  34. 34. Task Based User Interface<br />1. As a Tourist I want to Book a Hotel<br />
  35. 35. Task Based User Interface<br />1. As a Tourist I want to Find and Book a Hotel<br />
  36. 36. Task Based User Interface<br />1. As a Tourist I want to Find and Book a Hotel<br />
  37. 37. Task Based User Interface<br />1. As a Tourist I want to Find and Book a Hotel<br />
  38. 38. Messaging<br />Book Hotel<br />Domain Model<br />View Data Cache<br />Events Storage<br />
  39. 39. Messaging<br /><br />BookHotelCommand<br />Book Hotel<br />Domain Model<br />View Data Cache<br />Events Storage<br />
  40. 40. Messaging<br /><br />BookHotelCommand<br />Book Hotel<br /><br />Domain Model<br />HotelBooked<br />View Data Cache<br />Events Storage<br />
  41. 41. Domain Driven Desingn<br />Ожидайте<br />
  42. 42. Практика<br />
  43. 43. С чего начали мы?<br />
  44. 44. С чего начали мы?<br />Shared Services<br />End User Interface<br />Backoffice<br />Service Layer<br />Application Facade<br />Domain Model<br />DB1<br />DB2<br />Services<br />
  45. 45. Как это выглядит?<br />
  46. 46. Шаг №1<br />User Interface<br />Service Layer<br />Application Facade<br />Domain Model<br />Database<br />
  47. 47. Шаг №1<br />User Interface<br />Domain Model<br />Database<br />
  48. 48. Шаг №2<br />User Interface<br />Domain Model<br />Reports<br />Database<br />
  49. 49. Шаг №2<br />
  50. 50. Шаг №3<br />В контроллерах нет<br /><ul><li>Навигации
  51. 51. ViewResult</li></li></ul><li>Шаг №3<br />В контроллерах нет<br /><ul><li>Навигации
  52. 52. ViewResult</li></ul>В контроллерах остались<br /><ul><li>Void-методы</li></li></ul><li>Шаг №4<br />
  53. 53. Шаг №4<br />
  54. 54. Шаг №4<br />
  55. 55. Шаг №4<br />
  56. 56. Что дальше?<br /><ul><li>Event Sourcing
  57. 57. NoSQL
  58. 58. Cloud</li></li></ul><li>Утилиты<br /><ul><li>NServiceBus, MassTransit
  59. 59. RavenDb, CouchDb, MongoDb
  60. 60. Lokad.CQRS</li></li></ul><li>Выводы<br />
  61. 61. Вывод всего один<br />Можно, но осторожно!<br />

×