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

  • 1,750 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,750
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
14
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Command / Query ResponsibilitySegregation
    теория и практика
  • 2. О чем пойдет речь?
    • Немного теории
    • 3. С чего мы начали?
    • 4. Куда мы движемся?
    • 5. Чем пользоваться?
    • 6. Что в итоге?
  • Теория
  • 7. Типовые свойства
    • Бизнес развивается
    • 8. Сложность принятия решений
    • 9. Новые роли
    • 10. Масштабируемость
    • 11. Старые компоненты
    • 12. Расходы на разработку
  • С чего все начинают?
    Shared Services
    End User Interface
    Backoffice
    Service Layer
    Application Facade
    Domain Model
    DB1
    DB2
    Services
  • 13. С чего все начинают?
  • 14. С чего все начинают?
  • 15. Как все заканчивается?
  • 16. Command / Query Responsibility Segregation
    • Command / Query Separation
    • 17. Event Sourcing
    • 18. Task Based User Interface
    • 19. Messaging
    • 20. Domain Driven Design
  • Command/Query Separation
    End User Interface
    Application Server
    SELECT * FROM Product
    UPDATE Product
    DB
  • 21. Command/Query Separation
    End User Interface
    Application Server
    Query
    Command
    SELECT * FROM Product
    UPDATE Product
    DB
  • 22. Command/Query Separation
    End User Interface
    Application Server
    Query
    Command
    SELECT * FROM Product
    UPDATE Product
    DB
  • 23. Command/Query Separation
    End User Interface
    Application Server
    Query
    Command
    SELECT * FROM Product
    UPDATE Product
    Queries Cache
    Domain Persistence
  • 24. Command/Query Separation
    End User Interface
    Reporting
    Domain Model
    UPDATE Product
    SELECT * FROM Product
    Queries Cache
    Domain Persistence
  • 25. Command/Query Separation
    End User Interface
    AddProductToTheCart
    Reporting
    Domain Model
    INSERT INTO CartINSERT INTO CartItem
    Queries Cache
    Domain Persistence
  • 26. Command/Query Separation
    End User Interface
    AddProductToCart
    Reporting
    Domain Model
    INSERT INTO CartINSERT INTO CartItem
    ProductToCartAdded
    View Data Cache
    Domain Persistence
  • 27. Command/Query Separation
    End User Interface
    AddProductToCart
    Reporting
    Domain Model
    INSERT INTO CartINSERT INTO CartItem
    INSERT INTO ProductsInCart
    ProductToCartAdded
    View Data Cache
    Domain Persistence
  • 28. Command/Query Separation
    End User Interface
    AddProductToCart
    SELECT * FROM ProductsInCart
    Reporting
    Domain Model
    INSERT INTO CartINSERT INTO CartItem
    INSERT INTO ProductsInCart
    ProductToCartAdded
    View Data Cache
    Domain Persistence
  • 29. Event Sourcing
  • 30. Event Sourcing
    КАК?!
    У Вас на счету: -19435.89₴
  • 31. Event Sourcing
    У Вас на счету: -19435.89₴
    Перемещение средств:
  • 32. Event Sourcing
    End User Interface
    Reporting
    Domain Model
    ProductToCartAdded
    ProductFromCartRemovedProductQuantityChanged
    …..
    View Data Cache
    Domain Persistence
    Events Storage
  • 33. Event Sourcing
    End User Interface
    Reporting
    Domain Model
    ProductToCartAdded
    ProductFromCartRemovedProductQuantityChanged
    …..
    View Data Cache
    Domain Persistence
    Events Storage
  • 34. Task Based User Interface
    1. As a Tourist I want to Book a Hotel
  • 35. Task Based User Interface
    1. As a Tourist I want to Find and Book a Hotel
  • 36. Task Based User Interface
    1. As a Tourist I want to Find and Book a Hotel
  • 37. Task Based User Interface
    1. As a Tourist I want to Find and Book a Hotel
  • 38. Messaging
    Book Hotel
    Domain Model
    View Data Cache
    Events Storage
  • 39. Messaging

    BookHotelCommand
    Book Hotel
    Domain Model
    View Data Cache
    Events Storage
  • 40. Messaging

    BookHotelCommand
    Book Hotel

    Domain Model
    HotelBooked
    View Data Cache
    Events Storage
  • 41. Domain Driven Desingn
    Ожидайте
  • 42. Практика
  • 43. С чего начали мы?
  • 44. С чего начали мы?
    Shared Services
    End User Interface
    Backoffice
    Service Layer
    Application Facade
    Domain Model
    DB1
    DB2
    Services
  • 45. Как это выглядит?
  • 46. Шаг №1
    User Interface
    Service Layer
    Application Facade
    Domain Model
    Database
  • 47. Шаг №1
    User Interface
    Domain Model
    Database
  • 48. Шаг №2
    User Interface
    Domain Model
    Reports
    Database
  • 49. Шаг №2
  • 50. Шаг №3
    В контроллерах нет
    • Навигации
    • 51. ViewResult
  • Шаг №3
    В контроллерах нет
    • Навигации
    • 52. ViewResult
    В контроллерах остались
    • Void-методы
  • Шаг №4
  • 53. Шаг №4
  • 54. Шаг №4
  • 55. Шаг №4
  • 56. Что дальше?
  • Утилиты
    • NServiceBus, MassTransit
    • 59. RavenDb, CouchDb, MongoDb
    • 60. Lokad.CQRS
  • Выводы
  • 61. Вывод всего один
    Можно, но осторожно!