Skip to content
tezvyn:

Decompose a monolith for scaled agile teams

Source: learn.microsoft.comHardHow cards are made

Decompose a monolith for scaled agile teams

Tests aligning architecture to team boundaries during incremental monolith decomposition. Cover: bounded contexts with isolated data and sagas, backward-compatible versioned APIs, and replacing shared libraries with duplicated code or versioned SDKs.

What's really being asked

This question evaluates whether you understand that microservices decomposition is primarily an organizational boundary problem rather than a packaging exercise. The interviewer wants to see if you can align architecture with team autonomy, manage the shift from ACID to distributed consistency, enforce API boundaries without creating a distributed monolith, and handle the socio-technical transition where multiple teams ship independently.

The full answer

First, bounded context mapping. You would identify natural business capabilities and align each to a single team with its own codebase and deployment pipeline, ensuring services do not span team boundaries. Second, data consistency. You must reject a shared database and assign each service its own data store, using eventual consistency patterns such as sagas or outbox patterns with a message broker to synchronize state across boundaries. Third, API contracts. You would establish explicit contracts using schema registries or OpenAPI specifications, enforce backward compatibility, and use consumer-driven contract testing so teams can evolve interfaces without breaking dependents. Fourth, shared libraries. You would minimize shared code to avoid deployment coupling; where reuse is necessary, treat libraries as internal products with semantic versioning and independent release cycles, or prefer polyglot duplication over hidden coupling. Fifth, transition mechanics. You would use the Strangler Fig pattern to incrementally extract services from the monolith, deploy anti-corruption layers to translate legacy models into new bounded contexts, and maintain feature flags to toggle between old and new paths safely.

The mistakes people make

Proposing a shared database with separate schemas because it avoids data duplication destroys team autonomy and creates a distributed monolith. Suggesting two-phase commit distributed transactions for consistency introduces availability risks and coupling that contradicts microservices goals. Recommending a company-wide shared utilities library that all teams must upgrade in lockstep creates hidden coupling and prevents independent deployment. Ignoring the API gateway or suggesting direct client-to-service calls without handling cross-cutting concerns centrally is also a weakness.

What usually comes next

How do you handle transactions that span three or more services? What is your rollback strategy if a saga step fails? How do you prevent a broken API change in one team from blocking another team's deployment? When is it acceptable to share a database read replica versus owning the data entirely? How do you manage schema changes in an event-driven architecture?

A concrete example

Suppose you are extracting an Order service from a monolith. You would create an Order bounded context with its own database, publish OrderCreated events via Azure Service Bus, and let Inventory and Payment services subscribe asynchronously. The monolith remains the system of record temporarily, bridged by an anti-corruption layer that translates legacy Order tables into the new schema. API contracts are versioned in a central registry, and a shared logging library is forked per team so that updates do not force cross-team deployments.

Interview question

When incrementally decomposing a monolith for scaled agile teams, which approach best preserves team autonomy while still allowing controlled code reuse?

  • a.Duplicate every utility and domain function across all services to guarantee zero coupling
  • b.Treat shared libraries as versioned internal products with independent release cycles and semantic versioningCorrect
  • c.Maintain a single shared database with separate schemas so teams can query across contexts without duplication
  • d.Use two-phase commit transactions to keep service data consistent within a single ACID boundary
Why?

Correct answer C treats shared libraries as versioned internal products, aligning architecture with team autonomy by letting teams consume upgrades independently. D is tempting because the card mentions preferring duplication over hidden coupling, but duplicating everything is an impractical extreme; the card explicitly recommends versioned SDKs when reuse is necessary, while A and B create coupling via shared data or distributed transactions.

Just read this? Test yourself on what you have been reading.

Read the original → learn.microsoft.com

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on microservices — each one lists the topics its interview covers.

See open roles