Skip to content
Ameen Abozaid
MID-025

Service boundaries

  • 6 Lessons
  • 3 h practice (estimate)
On this page 8 topics

Overview

Topics

  • Cohesion
  • bounded contexts
  • data ownership

Learn first

3 h of practice (estimate)

Learning outcomes

  1. Identify bounded contexts from language and ownership, not from the database schema.
  2. Assign data ownership so each service owns its data exclusively.
  3. Replace cross-service joins with APIs, events, or local copies.
  4. Evaluate a proposed boundary by coupling and change patterns.

Lessons

  1. 01Bounded contexts
  2. 02One concept, several models
  3. 03Data ownership
  4. 04Life without cross-service joins
  5. 05Evaluating a boundary
  6. 06Demo: splitting Shop's shared database

Lab and exercises

Lab

MID-025-LAB1 · Split Shop

Outcomes: 1–4 · Time: ~3 h

  1. Draw Shop's context map from language and ownership, not from tables.
  2. Extract orders, inventory, and payments into separate services, each with its own database or schema and credentials.
  3. Replace each cross-service join with an API call, an event, a local copy, or a snapshot.
  4. Document the data ownership table and the context map.

Acceptance: no service reads another's tables; context map documented.

Exercises (assessment: boundary review of an unseen system; five exercises)

IDOutcomeTask
MID-025-EX011Given a glossary of a clinic system, propose three bounded contexts and justify them by language.
MID-025-EX022Make a data ownership table for Shop (stock level, price, order status, payment status, customer email).
MID-025-EX033An order-history page joins orders, products, and customers. Propose two replacements and compare them.
MID-025-EX043Design a local copy of customerEmail in notifications: source events, update rule, staleness risk.
MID-025-EX054Evaluate a proposed boundary "UserService, AddressService, PhoneService" by coupling and change patterns.
Show solutions
  • EX01 For example Scheduling (appointment, slot), Clinical (visit, diagnosis), Billing (invoice, claim); "patient" differs per context.
  • EX02 Stock level: inventory; price: catalog; order status: orders; payment status: payments; customer email: customer/identity service. Others read via API or events.
  • EX03 (a) API composition in a gateway; (b) snapshots in order lines plus a local customer name copy. Compare freshness, latency, and coupling.
  • EX04 Consume CustomerEmailChanged events; upsert by customerId; stale for seconds to minutes; fall back to an API call if missing.
  • EX05 Boundary by entity: one change (a profile page) touches three services and needs many calls; merge them into one Customer context.

Quiz

Outcomes: O1 bounded contexts · O2 data ownership · O3 replacing joins · O4 evaluating boundaries.

A self-check for you: nothing is graded, saved or sent anywhere. Choose an answer, then check it. You can try again as often as you like.

  1. 1Bounded contexts are best identified from:O1
  2. 2The same word with different meanings in two areas suggests:O1
  3. 3What should contexts share about a product?O1
  4. 4Who may read inventory's tables directly?O2
  5. 5A shared database between services mainly creates:O2
  6. 6Which replaces a cross-service join?O3
  7. 7Why store the unit price in the order line?O3
  8. 8A local copy built from events is:O3
  9. 9A sign of a wrong boundary:O4
  10. 10Boundaries drawn by technical layer (UI service, DB service) are:O4

Practical part

Five exercises MID-025-EX01 to EX05 plus the lab. Pass: at least four exercises correct, no cross-service table access in the lab, and a documented context map.

Common mistakes

Shared databases between services; boundaries drawn by technical layer.

Assessment

Boundary review of an unseen system.

Career relevance

Context mapping (SRA-003) and data ownership strategy (SRA-004).

Type to search levels, phases, modules and lessons.