Decompose by Business Capability
Split services around stable business capabilities such as users, orders, billing, and shipping.
What you will be able to do
- Explain what a monolith, a service and a business capability are
- Compare the three common ways to split a system: by technical layer, by database table and by business capability
- Show, with numbers, why layer and table splits make every feature and every request cross services
- Find the capabilities of a system with a five-step method
- Check proposed boundaries with the feature test
- Say what a service owns, and judge whether it is too big or too small
The idea, in plain English
A monolith is one application that does everything: one codebase, one database, deployed as one unit. It works well until many teams have to change it at once - then every release needs everyone, and one bug can take everything down.
Microservices split that application into smaller services. Each runs on its own, owns its own data, and can be released by its own team. But the split only helps if it is drawn in the right place. Cut in the wrong place and you keep all the old coordination - plus a network in the middle.
This lesson’s answer: cut around business capabilities - the things the business DOES, like taking orders, taking payments and shipping parcels. Most new features then land inside one service, owned by one team, and released on its own.
Worked example: Splitting an online shop into services three ways - by layer, by table and by capability - and testing the result against real features.
An everyday example: a restaurant
A busy restaurant is organised by job, not by tool:
- The kitchen cooks. The billing counter takes money. The delivery desk sends food out.
- Each has its own people, its own tools and its own records. The kitchen does not keep the cash book.
- A new dish changes only the kitchen. A new card machine changes only billing. Nobody else has to stop.
- Now imagine organising by tool instead: everyone who uses knives in one team, everyone who uses screens in another, everyone who uses the store room in a third.
- A new dish would now need the knife team, the screen team and the store-room team, all at the same time.
- Splitting software into services is the same choice. Split by what the business DOES, not by the technology each part uses.
Kitchen, billing, deliveryBusiness capabilities - one service each.Each desk keeps its own recordsEach service owns its own data.A new dish changes only the kitchenA feature changes one service, released by one team.Teams by tool: knives, screensSplitting by technical layer - every change needs every team.The words you need
- You do not need any other lesson first. These five words are enough for this one.
MonolithOne application, one database, released as one unit.ServiceA separate application with its own API and data, released on its own.BoundaryThe line between what one service does and what another does.Business capabilitySomething the business does that produces value. Stable over years.Owning teamThe one team that builds, releases and runs a service.Three ways to cut - and what each one costs
Teams new to microservices usually reach for one of three splits:
- BY TECHNICAL LAYER: a UI service, a logic service, a database service. It copies how the code is organised.
- BY DATABASE TABLE: one service per table - products, prices, stock, customers, addresses. It copies how the data is stored.
- BY BUSINESS CAPABILITY: one service per thing the business does - catalogue, orders, payments, shipping.
- The first two look tidy on a diagram. The next two sections measure what they cost in practice.
By layerA feature needs every layer, so it changes every service - and they release together.By tableA request needs several tables, so it calls several services - slow and fragile.By capabilityMost features and most requests stay inside one service.Why a layer split fails: features cross every service
- A feature is not a layer. "Add gift wrap at checkout" needs a new button (UI), a new rule (logic) and a new column (database).
- So with a layer split it changes three services, owned by three teams, which must be released together.
- With a capability split it changes one: the checkout service.
- The model below counts it for four ordinary features: 11 service changes by layer, 4 by capability.
- Services that must always change and release together are called a distributed monolith - all the coordination of a monolith, plus a network.
features = {
"Add a 'gift wrap' option to checkout": {"layer": ["ui-service", "logic-service", "database-service"], "capability": ["checkout"]},
"Change how shipping cost is calculated": {"layer": ["logic-service", "database-service"], "capability": ["shipping"]},
"Let customers save a second address": {"layer": ["ui-service", "logic-service", "database-service"], "capability": ["customers"]},
"Add UPI as a payment method": {"layer": ["ui-service", "logic-service", "database-service"], "capability": ["payments"]},
}
for split in ("layer", "capability"):
touched = [len(f[split]) for f in features.values()]
print(f"split by {split:<10} services changed per feature: {touched} total: {sum(touched)}")
# split by layer services changed per feature: [3, 2, 3, 3] total: 11
# split by capability services changed per feature: [1, 1, 1, 1] total: 4Why a table split fails: requests cross every service
- A table split looks clean: each service guards one table. But a table holds data, not a job.
- Placing ONE order needs the product, its price, the stock and the customer’s address - four tables, so four or more services.
- Every call adds waiting time, and every service in the chain must be up for the order to work.
- With a capability split, the catalogue owns products WITH their prices, and inventory owns stock. The same order needs 2 calls, not 6.
- The customer’s address can travel with the order request, or be kept as a local copy - the Self-Contained Service pattern (Lesson 4).
entity_split = { # one CRUD service per database table
"place an order": [
("order-service", "product-service", "get name"),
("order-service", "price-service", "get price"),
("order-service", "stock-service", "check stock"),
("order-service", "stock-service", "reserve stock"),
("order-service", "customer-service", "get customer"),
("order-service", "address-service", "get address"),
],
}
capability_split = { # services own whole capabilities
"place an order": [
("order-service", "catalog-service", "get product with price"),
("order-service", "inventory-service", "reserve stock"),
],
}
for name, split in (("entity split", entity_split), ("capability split", capability_split)):
calls = split["place an order"]
services = {callee for _, callee, _ in calls} | {"order-service"}
print(f"{name:<17} {len(calls)} calls, {len(services)} services must be up")
# entity split 6 calls, 6 services must be up
# capability split 2 calls, 3 services must be upFinding the capabilities: a five-step method
Start from the business, not from the code or the database:
- 1. LIST what the business does, as verb + noun: show products, set prices, take orders, take payments, pack parcels, track parcels, send emails.
- 2. GROUP activities that use the same information and change for the same reasons: "show products" and "set prices" both work on the catalogue.
- 3. NAME each group with a noun the business already uses: Catalogue, Checkout, Payments, Fulfilment.
- 4. FIND THE OWNER: who in the business is responsible for it? A capability nobody owns is usually two capabilities, or not one at all.
- 5. DRAW one service per capability, and give it its own data and one owning team.
- Expect the first map to be wrong in places. Boundaries are cheap to move on paper and expensive to move in code - spend the time here.
1-3. Activities, grouped and named
Customers sign up, edit profile, save addresses
Catalogue show products, set prices, search
Inventory count stock, reserve stock, restock
Checkout cart, place order, order history
Payments charge, refund
Fulfilment pick, pack, ship, track
Notifications email, SMS, push
4. Owners
Catalogue -> merchandising team Payments -> finance team
Fulfilment -> warehouse team Checkout -> sales team ...
5. Services - each with its own database and one team
customer-service catalog-service inventory-service order-service
payment-service shipping-service notification-serviceCheck the boundaries: the feature test
Before writing any code, test the map against the future:
- Write down 10-20 real features you expect in the next year.
- Next to each, write the services it would change.
- Most should stay inside one service. A few crossing boundaries is normal.
- If the SAME pair of services keeps showing up together, the line between them is probably in the wrong place - move it, or merge them.
- Run the test again whenever the business changes direction.
features = {
"Add gift wrap at checkout": ["order-service"],
"Show delivery date on the product page": ["catalog-service", "shipping-service"],
"Save a second address": ["customer-service"],
"Add UPI payments": ["payment-service"],
"Refund automatically when a parcel is lost": ["shipping-service", "payment-service"],
"Search by brand": ["catalog-service"],
}
inside = [f for f, s in features.items() if len(s) == 1]
across = [f for f, s in features.items() if len(s) > 1]
print(f"{len(inside)} of {len(features)} features stay inside one service")
for f in across:
print(f" crosses a boundary: {f:<45} {' + '.join(features[f])}")
# 4 of 6 features stay inside one service
# crosses a boundary: Show delivery date on the product page catalog-service + shipping-service
# crosses a boundary: Refund automatically when a parcel is lost shipping-service + payment-serviceTip: Two crossing features out of six is fine - they become one call or one event between services. Worry when most features cross, or the same pair keeps appearing.
What a service owns
A capability service owns its whole job, end to end:
- Its API: the only way other services may use it.
- Its data: its own database. Other services never read or write its tables directly - they ask through the API (Database per Service, Lesson 16).
- Its releases: it can be deployed without asking anyone else.
- Its running: the owning team watches it and is on call for it.
- If any of these is shared - one database for everyone, one release train - the boundary exists only on the diagram.
How big should a service be?
- Big enough that most features land inside it.
- Small enough that one team can understand it, change it and run it.
- TOO SMALL: it always changes together with another service, or calls it on almost every request. Merge them.
- TOO BIG: several teams queue to change it, or its name needs "and". Split it along a capability line.
- When unsure, start bigger. Splitting one service later is easier than merging two that have grown their own APIs, data and teams.
- Conway’s law: a system ends up shaped like the teams that build it. So match the boundaries to the teams - one team per capability.
Decomposing by business capability
Business capabilitySomething the business does that produces value. Stable over time.
take payments
One service per capabilityOwns its API, data, releases and running.
payment-service
Layer splitFeatures cross every service - avoid.
ui / logic / database
Table splitRequests cross every service - avoid.
product / price / stock
Five-step methodList, group, name, find the owner, draw.
verb + noun
Feature testMost expected features should change one service.
4 of 6 inside
Conway’s lawSystems mirror the teams that build them.
one team per capability
What usually goes wrong
Every feature needs every layer, so every feature changes every service - and they must be released together.
✗ ui-service, logic-service, database-service✓ customer-service, order-service, payment-serviceTables hold data, not jobs. Every real request needs several of them, so it becomes a chain of calls.
✗ product-service, price-service, stock-service - each pure CRUD✓ catalog-service owns products and prices; inventory-service owns stockIf every service reads the same tables, a schema change still needs everyone. The boundary is only on the diagram.
Developers alone tend to draw the code’s current shape. Find capabilities with the people who run the business.
Fifty tiny services on day one means fifty deployments, dashboards and on-call rotations before you know where the real boundaries are.
Practice
Write these yourself before opening anything. Getting them wrong first is most of how this sticks.
Use the five-step method on a food delivery app: list what the business does, group it, name the capabilities and draw the services.
Show hintHide hint
Think about customers, restaurants, riders and money.
Show solutionHide solution
Customers sign up, addresses, saved cards -> customer-service
Restaurants onboarding, menus, opening hours -> restaurant-service
Ordering cart, place order, order status -> order-service
Payments charge, refund, restaurant payouts -> payment-service
Delivery assign rider, live tracking -> delivery-service
Ratings reviews for food and riders -> rating-service
Notifications push, SMS, email -> notification-serviceA team proposes frontend-service, rules-service and storage-service for a library app. What happens when the library adds "reserve a book"? Suggest a better split.
Show hintHide hint
Count the services one feature has to change.
Show solutionHide solution
"Reserve a book" needs a new button (frontend-service), a new rule such as
"max 3 reservations" (rules-service) and a new table (storage-service):
three services, released together, for one feature.
Split by capability instead:
catalog-service books, search, availability
member-service members, cards, limits
lending-service borrow, return, reserve, fines
"Reserve a book" now lands inside lending-service.Run the feature test on your food delivery services with these features: "show rider location on the order page", "add a tip at checkout", "pay restaurants weekly", "let customers rate riders". Which cross a boundary?
Show solutionHide solution
show rider location on the order page order-service + delivery-service crosses
add a tip at checkout order-service inside
pay restaurants weekly payment-service inside
let customers rate riders rating-service inside
3 of 4 inside one service. The crossing one becomes one call or one
event (delivery-service publishes the rider's location).Key points
- A monolith is one application released as one unit; microservices split it so teams can release on their own.
- The split only helps if the boundaries are in the right place.
- A layer split makes every feature cross services; a table split makes every request cross services.
- Cut around business capabilities - what the business does. They are stable, and features land inside them.
- Find capabilities with five steps: list, group, name, find the owner, draw.
- Check boundaries with the feature test: most expected features should change one service.
- Each service owns its API, data, releases and running - nothing shared.
- Start bigger rather than smaller, and match teams to boundaries (Conway’s law).
Quick check before you move on
Interview questions
How do you decide service boundaries in a microservices architecture?
Start from business capabilities: list what the business does, group activities that share data and change together, confirm each has a business owner, and give each its own service, data and team. Then validate with real expected features - most should change one service. Avoid splitting by technical layer or by database table.
What is a distributed monolith?
Services that still have to change and deploy together - usually because the system was split by layer, shares a database, or has services that call each other for everything. It has the costs of microservices without the independence.
How does Conway’s law affect microservices design?
Systems drift toward the shape of the organisation that builds them. If team and service boundaries do not line up, ownership blurs and services couple, so design them together - sometimes changing the teams first.
Quiz
- 1.
Why are business capabilities good service boundaries?
- 2.
Two services always change together. What does that tell you?
- 3.
What does it mean for a service to own its data?
Comments
Sign in to leave a comment. Your name and photo come from Google; nothing else is shared.
Loading comments...