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

Process Automation with Domain-Driven Design @ Navigate 2021

Process Automation with Domain-Driven Design @ Navigate 2021

In this talk I discuss the application of “strategic” and “tactical” patterns and best practices from domain-driven design to software projects for the automation of business processes - with or without the use of workflow engines. I will show that the two different worlds - “DDD” and “Workflow” - which appear to be very different and often look at each other with skepticism - have much more in common than not - but if and only if they are cleverly linked.

Martin Schimak

April 20, 2021
Tweet

More Decks by Martin Schimak

Other Decks in Programming

Transcript

  1. BPMN
    DDD
    Process Automation with Domain-Driven Design
    © Martin Schimak – plexiti GmbH – All rights reserved

    View Slide

  2. This is our automated process!
    Process
    starts!
    Make
    decision
    Check
    HUMAN
    REJECT!
    FRAUD_S
    ERVICE
    ANTI
    pattern

    View Slide

  3. After five sprints, it finally works!
    RAUD_S
    ERVICE
    Check
    GET
    invoice
    POST
    negative
    amount
    Process
    ends.
    REJECT!
    Yes
    No
    ANTI
    pattern

    View Slide

  4. You got it?

    View Slide

  5. Eric Evans, 2004

    View Slide

  6. 2004 2006 2008 2018
    2010 2012 2014 2016
    ?
    DDD … is not a book! It
    only started as a book.
    2020

    View Slide

  7. Applying DDD to
    Process Automation

    View Slide

  8. Process Automation
    "Done Right"

    View Slide

  9. View Slide

  10. 2) Strategic
    Design
    The three pillars of Domain-Driven Design
    3) Modeling
    in Code
    1) Collaborative
    Modeling
    1) Collaborative
    Modeling

    View Slide

  11. "Ubiquitous" Language
    DDD emphasizes the
    importance of language
    for modeling
    executable software.

    View Slide

  12. Stop nitpicking about "labeling"!
    Process
    starts!
    Make
    decision
    Check
    HUMAN
    REJECT!
    FRAUD_S
    ERVICE
    ANTI
    pattern

    View Slide

  13. Healthily obsess with language!
    Process
    starts!
    Make
    decision
    Check
    HUMAN
    REJECT!
    FRAUD_S
    ERVICE
    DDD
    Paradigm
    Invoice
    dispute
    raised
    Determine
    dispute handling
    strategy
    Economic
    relevance? Low:
    automatic
    handling
    Higher:
    manual
    handling
    Check
    invoice dispute
    Approved
    Approved
    Rejected
    Determine
    fraud
    potential
    Partially
    approved
    Partially
    rejected
    Dispute
    approved?
    Determine
    dispute handling
    strategy
    Check
    invoice dispute
    Determine
    fraud
    potential

    View Slide

  14. Healthily obsess with language! DDD
    Paradigm

    View Slide

  15. Think.
    Together.

    View Slide

  16. "Handing over" diagrams. ANTI
    pattern
    Analyst Developer Tester

    View Slide

  17. In DDD modeling is collaborative
    DDD emphasizes the
    importance of developing
    a shared mental model.
    DDD
    Paradigm

    View Slide

  18. You need workshop methods which enable
    everybody in a meeting room to contribute

    View Slide

  19. Understand the bigger picture of your domain!
    EVENTSTORMiNG

    View Slide

  20. Events (and more) on a timeline
    Something
    business relevant
    happened!
    Invoice
    dispute
    raised
    Invoice
    dispute
    approved
    Invoice
    dispute
    rejected
    Time

    View Slide

  21. Useful for process automation projects?
    Invoice
    dispute
    raised
    Invoice
    dispute
    approved
    Invoice
    dispute
    rejected
    Invoice
    dispute
    checked
    Yes!
    Time

    View Slide

  22. EVENTSTORMiNG
    Understand the bigger picture of your domain!

    View Slide

  23. Easily explore specific domain scenarios!
    EVENTSTORMiNG

    View Slide

  24. Useful for process automation projects?
    Invoice
    dispute
    raised
    Invoice
    dispute
    approved
    Invoice
    dispute
    rejected
    Invoice
    Check
    Fraud Detection Service Design sophisticated
    collaboration models
    with your domain
    experts
    Yes!

    View Slide

  25. Easily explore specific domain scenarios!

    View Slide

  26. storystorming.com

    View Slide

  27. 2) Strategic
    Design
    The three pillars of Domain-Driven Design
    3) Modeling
    in Code
    1) Collaborative
    Modeling
    2) Strategic
    Design

    View Slide

  28. Violating responsibility boundaries ANTI
    pattern
    Customer
    Care
    Fraud
    Prevention
    Billing

    View Slide

  29. Central orchestration
    Customer
    Care
    Fraud
    Prevention
    Billing
    Invoice
    Dispute
    ANTI
    pattern

    View Slide

  30. Subdomains & Bounded Contexts DDD
    Paradigm
    Customer
    Care
    Invoice
    Dispute
    Fraud
    Prevention
    Fraud
    Detection
    Billing
    Invoicing
    Crediting
    API
    C/S
    C/S
    C/S Internal
    Customer-
    Supplier
    Relationship

    View Slide

  31. Invoice Dispute Process (in Customer Care)

    View Slide

  32. Fraud Detection Process (in Fraud Prevention)

    View Slide

  33. Crediting Process (in Billing)

    View Slide

  34. Universal enterprise-wide model
    Customer
    Care
    Fraud
    Prevention
    Billing
    ANTI
    pattern

    View Slide

  35. Defined language boundaries DDD
    Paradigm
    Customer
    Care
    Fraud
    Prevention
    Billing
    API

    View Slide

  36. DDD's
    "ubiquitous language"
    is NOT universal

    View Slide

  37. Bounded contexts for models DDD
    Paradigm
    Customer
    Care
    Fraud
    Prevention
    Billing
    API

    View Slide

  38. 2) Strategic
    Design
    The three pillars of Domain-Driven Design
    3) Modeling
    in Code
    1) Collaborative
    Modeling
    3) Modeling
    in Code

    View Slide

  39. Search!
    Close!
    Jump!
    Customer
    Care
    Fraud
    Prevention
    Billing
    ANTI
    pattern
    Process controls other services

    View Slide

  40. Process automation IMPLEMENTS
    non-atomic, asynchronous services

    View Slide

  41. Processes implement a service DDD
    Paradigm
    Customer
    Care
    Fraud
    Prevention
    Billing
    API

    View Slide

  42. Intention revealing interfaces DDD
    Paradigm
    Billing
    API

    View Slide

  43. Synchronous interfaces
    Billing
    Sync
    API
    Customer
    Care
    What looks like a
    simple, fast and
    atomic operation
    today, can tomorrow
    turn out to be …
    ANTI
    pattern

    View Slide

  44. A long-running, async business operation

    View Slide

  45. Asynchronous interfaces
    Billing
    Async
    API
    Customer
    Care
    Feed
    Async APIs will NOT
    break, if you later need
    more than just a
    simple, fast, atomic
    operation to implement

    View Slide

  46. Objects & code inside the process
    Do not mix domain objects or
    domain code into your process model
    • No type safety or code completion!
    • Editing code in vendor-specific modelers? Nah.
    • Difficult or even impossible to test :-(
    • Complex domain objects as JSON ... seriously?
    process +
    objects +
    code
    Crediting
    ANTI
    pattern

    View Slide

  47. Processes as aggregates
    Model the
    process flow in a
    visual form
    1
    DDD
    Paradigm
    Invoice Dispute Process
    Model the
    domain objects
    in code
    2
    Invoice Dispute Root Entity
    3
    Bind them 1:1
    and transition
    them as an
    aggregate
    1
    1
    ${root}

    View Slide

  48. Chaotic consistency boundaries ANTI
    pattern
    Update with an
    ACID transaction
    A
    B

    View Slide

  49. Defined consistency boundaries DDD
    Paradigm
    Update with an
    ACID transaction
    B
    A
    Aggregates
    Strong consistency
    Eventual consistency

    View Slide

  50. BPMN DDD
    Well-designed processes can be seen as aggregates?

    View Slide

  51. Thank you!
    BPMN
    DDD
    Process Automation with Domain-Driven Design
    © Martin Schimak – plexiti GmbH – All rights reserved

    View Slide