Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The True Essence of the Canvas - Visualizing Do...

Kim Kao
October 19, 2024
10

The True Essence of the Canvas - Visualizing Domain Driven Design

In this talk, Kim would love to share the essential core knowledge serves as a major purpose to help the product development team stay focused. Through the use of a canvas, it consolidates logic and guides the next steps in development and testing. The Canvas introduced include "Aggregate Canvas" and "Aggregate Design Canvas". The former one is to well organize the artifacts of eventstorming, the latter demonstrated the design consideration on aggregate itself and map to physical implementation.

Kim Kao

October 19, 2024
Tweet

Transcript

  1. Agile Taipei 2024 Oct Meetup The True Essence of the

    Canvas 1 Kim Kao Core member of DDDesign Taiwan Visualizing Domain-Driven Design
  2. Introduction to MyFlexOffice Inc. • Founded 20 years ago, with

    1,000 employees • Leading provider of flexible office space in the Asia- Pacific (APAC) • 200 office centers across: o China o India o Australia o Japan o South Korea o Taiwan o Singapore
  3. Goals of the "Day Office" Booking Project 1. Optimize Utilization:

    o Maximize the use of unoccupied private offices. o Turn underutilized spaces into revenue-generating assets. 2. Offer Flexibility: o Provide alternative to meeting rooms 3. Enhance Member Experience: o Deliver fully-equipped private office o Support team collaborations.
  4. What is the "Day Office" Project? • New Booking System:

    o Reserve unused private offices from half a day to few days • Mobile App: Evaluate, select, and book day office • Day Office Admin System: Cancel, reschedule bookings
  5. © 2024, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. It’s developers’ (mis)understanding, not domain experts’ knowledge, that gets released in production. Alberto Brandolini Author of EventStorming
  6. 20 Towards to Aggregate Specification Invariant Combination Reveal Domain knowledge

    Talk subjects in boundary Pattern used to encapsulate logics Can be modular, reuse & compose Collaboration Modeling Clarify each single one rule time by time Maintain consistency Enforced within an aggregate to ensure internal state is valid Maintaining consistency and correctness Responsibilities Inside of Aggregate Root; Single entry point Aggregate
  7. Enhance the design • Calculate the charge fee estimation by

    the end of month • The chargefee can be summarized by replaying booking events
  8. Aggregate Canvas • Map artifacts to DDD Tactical design •

    Come out consensus for implementation • Kata; Deep dive the invariant constraints and Specifications 23
  9. Invariant Constraints • To maintain internal consistency, which is often

    enforced through invariant constraints. • These constraints define business rules that must always hold true within the aggregate. • If an operation would violate these invariants, it should be rejected or trigger an error. public class Payment { private final String Id; private final BigDecimal amount; private boolean isPaid; // Constructor to create a new Payment public Payment(String OfficeId, BigDecimal amount) { // Ensure the amount is valid according to the invariant if (amount.compareTo(BigDecimal.ZERO) < 0) { throw new IllegalArgumentException("Amount must be greater than or equal to 0."); } }
  10. Specifications • Encapsulate complex business rules and conditions to verify

    whether specific criteria are met • Allows for clearer aggregate logic by decoupling validation logic from the aggregate itself • Maintaining high cohesion and low coupling. public interface Specification<T> { boolean isSatisfiedBy(T t); } public class LeaseOrderPaymentSpecification implements Specification<LeaseOrder> { @Override public boolean isSatisfiedBy(LeaseOrder leaseOrder) { // Check if the order is not already paid return !leaseOrder.isPaid(); } }
  11. Adaptive systems design • Continuously evolve systems architecture and design

    • Achieve the least cost of future changes • Adapt rapidly to business and technological changes 29
  12. Adaptive to business growth Day 1 100 Users 1,000,000 Users

    1 2 Bottleneck of high-volume reads and writes Worsening transaction latencies 3 Diminishing performance return on marginal cost Day 1000
  13. Incorporating quality attributes in architecture Key Quality Attributes Non-Functional Requirements

    Simplicity Simplify the implementation of communication among different domains (retail, loyalty points) Scalability Support high QPS/TPS during peak traffic Usability Maintain user experience as usual under high QPS/TPS Performance Near real-time loyalty points issuance and redemption
  14. Aggregate Design Canvas • A modelling tool meant to be

    used as a part of design-level domain modelling activities. • An aggregate, a graph of objects that is a consistency boundary for our domain policies. Depending on the design of the aggregate we can either enforce them (make them invariant) or be forced to have corrective policies in place. • The canvas has a suggested order of working through it, that helps to iteratively discuss different aspects of the aggregate design.
  15. Handling throughput Key metrics Average Maximum Command handling rate 2/d

    100/d Total number of clients 10s 100s Concurrency conflict chance small medium (would be great to be clear once have data)
  16. Size Key metrics Average Maximum Event growth rate 2/d 100/d

    Lifetime of a single instance 10s 100s Number of events persisted small medium (would be great to be clear once have data)
  17. Key takeaways • Align business strategy with software architecture domains

    • Utilize LLM for developers to boost productivity • Choose the right architecture decisions that suit the use cases • Utilize the right resources to grow solution design capabilities Demo video https://sharing.kimkao.io/AWS-TPE-Summit-2024-AmazonQForDeveloper-AIZone0717+TC.mp4 Design guideline https://github.com/humank/amazonq-demo https://aws.amazon.com/tw/architecture/well-architected https://github.com/humank/aggregate-canvas https://github.com/ddd-crew/aggregate-design-canvas