📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

How do you find good service boundaries? Explain business capabilities, bounded contexts, data ownership and team ownership, how you test a proposed boundary, and the signs that a boundary is in the wrong place.

Finding microservice boundaries from business capabilities and bounded contexts, using data and team ownership, testing a boundary with change and call patterns, and recognising a wrong boundary.

Intermediate Theory Intermediate bounded-context conways-law distributed-systems domain-driven-design microservices service-boundaries

🎯 Key points

  • Start from business capabilities (what the business does), not technical layers or entities
  • Bounded context: where a term like Order has one meaning; a strong guide to boundaries, though a context may hold several services
  • Each service is the single writer of its data; others read through its API, events or a replicated read model
  • One owning team per service; Conway's law means boundaries tend to follow team communication paths
  • Test a boundary: most changes stay inside one service, and a user request needs few synchronous hops
  • Wrong boundary signs: changes always span services, chatty sync calls, shared tables, need for distributed transactions
  • Where a process spans services, use sagas and eventual consistency rather than distributed transactions
  • Prefer bigger services first and split later when the seam is proven

⏱ 30-second answer

Start from business capabilities (ordering, pricing, payments, fulfilment) and bounded contexts, the areas where a word like "Order" has one consistent meaning. A good boundary has one owner for its data and one owning team, and by Conway's law it should match how teams communicate. Test a proposed boundary with real change history and call flows: most features should change one service, and a user request should need few synchronous hops. Wrong boundaries show up as changes that always span services, chatty calls and shared tables. The trade-off: smaller services give more autonomy but more coordination, so start coarse and split when the seam is proven.

🗣 Full answer (senior)

How I would answer this in an interview

"I start from what the business does, not from the database. I list the business capabilities, for example quoting, policy administration, billing and claims for an insurer, and then look for bounded contexts: places where a word means one thing. 'Policy' in sales is a quote with a price; in claims it's a set of cover limits on a date. When the same word means different things to different people, that's usually a seam.

Then I check ownership. Each candidate service must own its data outright: no other service writes its tables. And each should have one owning team, because boundaries that cut across teams create coordination meetings, and Conway's law says the system will end up shaped like the communication anyway. Finally I test the boundary against reality: I look at the last few months of pull requests and ask how many would have touched more than one service, and I sketch the main user journeys to count synchronous hops. If checkout needs five services to answer in sequence, the boundary is wrong or that data should be replicated.

The mistake I see is splitting by entity, so you get a Customer service, an Order service and a Product service, and every feature needs all three to change together. My rule: draw boundaries around behaviour and data that change together, start coarse, and split later when the seam has proven itself."


Sources of boundaries

Source Question to ask Example
Business capability What does the business do, independent of how? Billing, Claims
Bounded context Where does a term have one meaning? "Policy" in Sales vs Claims
Data ownership Who is the single writer of this data? Billing owns invoices
Team ownership Which team will run it and be on call? Payments team
Change cadence Which parts change together? Pricing rules change weekly, invoices rarely
Non-functional needs Different scale, security or compliance? Card data in a PCI-scoped service

Testing a proposed boundary

Test Good sign Bad sign
Change history (last 3–6 months of PRs) >80% touch one service Most features touch 2–3 services
Request flow 0–2 synchronous hops per user request Long sync chains, fan-out to many services
Data One writer per table Two services update the same rows
Consistency Eventual consistency acceptable between services Needs an atomic transaction across them
Language Clear, stable vocabulary Constant translation and arguments about meaning

Signs a boundary is wrong

  • Every release needs coordinated deployment of two or more services.
  • Services call each other back and forth (A → B → A).
  • You're tempted to add a distributed transaction.
  • One service is a thin CRUD wrapper around a table other services also use.

Production example

In a [retail] system, splitting by entity produced Product, Price and Stock services; 70% of feature PRs touched all three and the product page made 9 sequential calls (~140 ms p95). Merging them into a Catalogue service and publishing PriceChanged events to the few consumers cut cross-service PRs to under 15% and the page to 2 calls (~35 ms).

🔍 What the interviewer is checking

Checks whether the candidate can find boundaries from the domain and organisation, and can tell when a boundary is wrong.

Green flags

  • Starts from business capabilities and bounded contexts
  • Insists on one data owner and one team per service
  • Mentions Conway's law
  • Proposes a concrete test (PR history, call hops)

Red flags

  • Splits by entity or technical layer
  • Thinks smaller is always better
  • Accepts shared tables between services

📚 Learn in depth

1. Business capabilities first

A business capability is something the business does that would still exist if you changed all the software: taking orders, invoicing, handling claims. Capabilities are stable over years, which is what you want for an expensive boundary. Technical layers and entities are not: "Customer" is touched by almost every capability.

2. Bounded contexts

From Domain-Driven Design: a bounded context is a boundary inside which a model and its language are consistent.

+-------------- Sales --------------+   +------------- Claims -------------+
| Policy = quote, premium, discount |   | Policy = cover limits, excess,    |
| Customer = lead, contact details  |   |          effective dates          |
+-----------------------------------+   | Customer = claimant, bank details |
              |                          +----------------------------------+
              |  PolicyIssued (event: policyId, cover, dates)
              +------------------------------------------>

Each context keeps its own model of "Policy" and they exchange only what the other needs. A bounded context is a strong candidate for a service, but one context may contain several services, and a small context may share a service with another.

3. Data ownership

The hard rule: one writer per piece of data. Other services get the data through an API, through events they store locally (a read model), or through a reporting copy. Shared writes recreate the monolith's coupling with network costs on top.

4. Conway's law and team ownership

"Organisations design systems that mirror their communication structure." If two teams must coordinate every change, the boundary between their services is wrong, or the teams are. The inverse Conway manoeuvre shapes teams to match the architecture you want. Team Topologies calls these stream-aligned teams.

5. Granularity

Too coarse: teams block each other in one deployable. Too fine: distributed monolith, chatty calls, sagas everywhere. Heuristics:

  • A service should be owned by one team; a team may own several services.
  • If two services always deploy together, merge them.
  • If a service needs data from another service on every request, either replicate the data (events) or merge.

6. Event storming

A workshop technique: domain experts and engineers place domain events ("Order placed", "Payment captured") on a timeline, then group them. Clusters with their own language and few links become candidate contexts. It's fast and exposes disagreements early.

Try it yourself

  1. Export the last 200 merged PRs from a repo and tag each with the modules it touched. Count how many cross a proposed boundary.
  2. Draw the sequence of calls for your top three user journeys; count synchronous hops.
  3. For one shared table, list every service or module that writes it. Pick the owner.
  4. Run a 1-hour event storming session on a small domain (e.g. library loans) and see which clusters emerge.

💻 Code

Each context keeps its own model and only shares an integration event with the fields others need.

namespace Sales.Domain
{
    // Sales' view of a policy: pricing concerns.
    public sealed record Quote(Guid PolicyId, decimal Premium, decimal Discount, DateOnly ValidUntil);
}

namespace Claims.Domain
{
    // Claims' view of the same policy: cover concerns. Different model, same id.
    public sealed record CoveredPolicy(Guid PolicyId, decimal CoverLimit, decimal Excess, DateOnly From, DateOnly To);
}

namespace Contracts.Events
{
    // The integration event: a published contract, owned by Sales, versioned with care.
    public sealed record PolicyIssued(Guid PolicyId, decimal CoverLimit, decimal Excess, DateOnly From, DateOnly To);
}
// An architecture test that keeps the boundary: Claims may depend on the contract, never on Sales internals.
[Fact]
public void Claims_does_not_reference_sales_domain()
{
    var result = Types.InAssembly(typeof(Claims.Domain.CoveredPolicy).Assembly)
        .ShouldNot().HaveDependencyOn("Sales.Domain")
        .GetResult();

    Assert.True(result.IsSuccessful);
}

⚠ Common mistakes

  • Mistake: One service per entity (Customer, Order, Product). Why it is wrong: features need all of them to change together and call each other constantly. Instead: boundaries around capabilities and behaviour.
  • Mistake: Splitting by technical layer (API service, logic service, data service). Why it is wrong: every request crosses every layer over the network. Instead: vertical, capability-shaped services.
  • Mistake: Two services writing the same table as a permanent design. Why it is wrong: hidden coupling and conflicting invariants. Instead: one owner; others use events, an API or a read-only replica. During a migration off a legacy database a shared table can be a pragmatic temporary step, but give it a named owner, make other services read-only, and put an end date on it.
  • Mistake: Drawing boundaries without the teams in mind. Why it is wrong: cross-team services need constant coordination. Instead: one owning team per service.
  • Mistake: Going fine-grained on day one. Why it is wrong: wrong boundaries are expensive to move across a network. Instead: start coarse, split proven seams.
  • Mistake: Treating a bounded context as exactly one service by rule. Why it is wrong: sometimes a context needs several deployables, sometimes two small contexts share one. Instead: use contexts as a strong guide, not a law.
  • Mistake: Drawing a boundary through a process that must be atomic, then reaching for a distributed transaction. Why it is wrong: two-phase commit across services is fragile and mostly unavailable in cloud databases and brokers. Instead: keep invariants that must be atomic inside one service; for the rest use a saga with compensations and the outbox pattern.
  • Mistake: Putting cross-cutting concerns (auth, logging) in their own "service" that every request calls. Why it is wrong: it adds a hop to every request and a single point of failure. Instead: shared libraries or platform features (gateway auth, OpenTelemetry), not a boundary.

🏛 Senior insight: trade-offs

The senior move is to validate boundaries with evidence, change history, call graphs and team structure, rather than whiteboard intuition, and to treat boundaries as a decision you can revisit. Merging two services is a legitimate fix, not a failure.

Boundary approach When it fits Cost When not to
Business capability Stable, well-understood business Needs domain knowledge Very early product still pivoting
Bounded context (DDD) Complex domain with clear language splits Workshops, modelling time Simple CRUD domain
Team-first (inverse Conway) Org is restructuring anyway Organisational change Teams are fixed and unrelated to domain
Entity-based Almost never Chatty, coupled services —

Track the result: percentage of PRs touching more than one service, synchronous hops per journey, and coordinated deployments per month.

🔗 Follow-ups the interviewer may ask

  1. When: Candidate mentions bounded contexts Why: Checks they can define a bounded context and decide where it ends.
    How to answer

    A bounded context is the boundary within which one model and one language apply consistently. You find its edges where the language changes (the same word means different things), where different experts or stakeholders own the rules, and where parts of the domain change for different reasons and at different rates (tax rules yearly, catalogue daily), because those parts need models that can evolve separately. Each context usually maps to one team and one module or service. Contexts still have to work together, so you draw a context map of how they integrate (customer-supplier, anti-corruption layer, published events) and keep each context's data private behind those integrations.

  2. When: Candidate says each service owns its data Why: Checks how they handle reporting and cross-service queries once data is split.
    How to answer

    Data ownership means each piece of data has one owner, a module or service, that is the only one allowed to write it and enforce its invariants. Everyone else either asks the owner (API), subscribes to its events, or keeps a read-only local copy.

    In microservices that usually means database per service; in a modular monolith it means schema per module with its own DbContext, and no cross-module joins.

    Shared writes are the thing to avoid: two services updating the same table means nobody owns the rules and every schema change is a coordinated release. For reporting, I ship data to a separate analytical store instead of joining live databases.

    The trade-off is duplication and eventual consistency: copies lag the owner, so you design for staleness and synchronise with an outbox.

  3. When: Candidate mentions team ownership Why: Checks they connect architecture to organisation structure.
    How to answer

    Conway's law: systems mirror the communication structure of the organisation that builds them. If two teams share a service, its internals split along team lines; if one change needs three teams, it needs three meetings and three release trains.

    • Draw service boundaries so one team owns each service end to end. That keeps changes local, deployments independent and the system easier to scale and maintain.
    • When you want a different architecture, you often must reshape teams first: the inverse Conway manoeuvre.
    • Team Topologies gives the vocabulary: stream-aligned teams own a business flow and its services, supported by platform, enabling and complicated-subsystem teams.

    The trade-off: aligning teams to services reduces coordination but can duplicate effort, so platform teams absorb the shared parts.

🛠 Real-world problems: how you handle them

Entity-based services forced every feature across three teams
Situation
A [retail] platform had been split into Product, Price and Stock services owned by [three] teams. The product page and most features depended on all three.
Signals
Around 70% of feature PRs touched all three repos; releases needed a coordinated deployment window; the product page made 9 sequential calls with ~140 ms p95; frequent incidents where a Price API change broke the page.
Investigation
Tagged six months of PRs by service touched; built a call graph from distributed traces in Application Insights (application map); ran an event storming session with the business to find which events and rules belonged together.
Resolution
Short term: added a batch endpoint to cut the page to 3 calls. Long term: merged the three into a Catalogue service owned by one team, kept Stock reservation separate because it had a different owner and scaling profile, and published `PriceChanged` and `StockLevelChanged` events for other consumers.
Prevention
An ADR documenting boundary criteria; a quarterly review of the cross-service PR ratio; architecture tests stopping new direct references between contexts.

How to tell it (STAR)

**S:** At [company], our product data was split into three services by entity, owned by [three] teams, and almost every feature touched all of them. **T:** I was asked to find out why delivery was slow and propose a fix. **A:** I tagged six months of PRs by service, pulled the application map from Application Insights to see the call chains, and ran an event storming session with the product owners. The data showed 70% of changes crossed all three services. I proposed merging them into one Catalogue service and keeping stock reservation separate, and wrote it up as an ADR. **R:** Cross-service PRs dropped from [70%] to [under 15%], the product page went from 9 calls to 2, and we stopped needing coordinated release windows.

↩ Usually asked after

More in Microservices

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me