Technique: Discover service boundaries (SOA)

February 4th, 2021



Search for 'natural folding lines' in the domain

Try to find the "natural folding lines" between areas in the domain.

how: ask domain experts:

"Can you imagine that changing data x ever impact data y"

eg. "[hospital] Would the patient changing family name impact which doctor they get treated by"

eg. "[webshop] Would changing the description of a product cause the price to change?"

When the domain expert looks at you like

- "You don't get it at all do you?"

Then you know you've got a 'natural folding line'



Technique: Discover service boundaries

  • Apply use cases one by one

  • Grow your data model + messages between

  • Limit the amount of data that needs to be exchanged between services

  • cluster data into services ('needs to be' together)

    • make a decision

    • most decisions will be wrong

    • every wrong decision will lead you astray

    • do it anyway

  • don't name the clusters!

    • only meaningless names allowed for conciseness

      • random colors: the green cluster, the purple cluster

      • random letters: cluster A, cluster B

    • meaningful names attract 'data related to the name'

      • bad!

      • even when it does not need to be together

      • bad!

  • once you get stuck with too much coupling, reset (or revisit a clustering decision)

You'll know when you have found the 'right' boundaries.

But you can't predict how many attempts it will take...



Pattern: Global ID

share the global ID between services



(src: Course: Advanced Distributed System Design - Udi Dahan)