Scrivio Interview library
LeadershipAdvanced7 min read · updated 12 November 2026

You must make a breaking change to a shared library used by 120 services owned by many teams. Plan the migration.

I would add the new API next to the old one and mark the old one @Deprecated with a pointer to its replacement, then keep both for an announced period, for example two minor releases or six months. Teams get an automated migration, such as an OpenRewrite recipe, plus examples, and we track adoption per service from dependency data and contact owners who lag. The old API is removed only in a major version once usage reaches zero or an agreed exception, and the shared BOM is updated so services move together.

Why this question is asked

A breaking change in a library used by 120 services is not a coding task; it is a coordination project across many teams with their own priorities. If we just release a new major version and announce it, half the services stay on the old version for years, security fixes have to be backported, and the library team ends up maintaining two products. Interviewers ask this at the fifteen-year level to hear a plan that is kind to consumers and still finishes. In this answer, we will recap why breaking changes are so expensive, then walk through the migration in order: the parallel API, the timeline, the automated migration, tracking adoption, and the final removal.

1Why a Breaking Change Is Expensive at This Scale

A breaking change is any change that makes existing consumer code stop compiling or stop working: removing a method, changing its signature or return type, or changing its behaviour in a way callers rely on. With semantic versioning, such a change is only allowed in a major version, and consumers expect to do work when they upgrade one.

The cost multiplies with the number of consumers. If each of 120 services needs half a day to understand, change, test and deploy, that is 60 engineer-days spread across many teams, each of which must find time in its own plan. If the change arrives as a surprise, many teams postpone it, and the library team is stuck supporting two major versions. The whole plan below is about lowering the cost per service and spreading the work over time.

Step throughMigration plan for a breaking change
  1. Add the new API beside the old oneold one delegates to the new where possible
  2. Deprecate the old API@Deprecated(forRemoval = true) with a pointer
  3. Announce the timelinefor example removal in 5.0, six months away
  4. Ship an automated migrationOpenRewrite recipe and examples
  5. Track adoption per servicedependency data and usage telemetry
  6. Usage at zero or agreed exceptions?
    YesRemove in the major release and update the BOMNoContact owners who lag, help them migrate

6 steps in order. Play them, or step through them one at a time.

2Add the New API Beside the Old

We never replace the old API in one release. The new API arrives in a minor version, next to the old one, so every service can upgrade without changing any code. Where possible, the old method is reimplemented as a thin call to the new one, so there is a single implementation to maintain and both paths behave the same way.

Java
public final class PaymentsClient {
/** Charges a payment method. Replaces {@link #send(String, BigDecimal, String)}. */
public ChargeResult charge(ChargeRequest request) { ... }
/**
* @deprecated since 4.2, removed in 5.0. Use {@link #charge(ChargeRequest)}.
* The migration recipe com.acme.MigrateToCharge does this automatically.
*/
@Deprecated(since = "4.2", forRemoval = true)
public String send(String token, BigDecimal amount, String currency) {
return switch (charge(ChargeRequest.of(token, Money.of(amount, currency)))) {
case ChargeResult.Approved a -> a.paymentId();
case ChargeResult.Declined d -> throw new PaymentDeclinedException(d.reasonCode());
};
}
}
// In a consumer's build:
// warning: [removal] send(String,BigDecimal,String) in PaymentsClient has been deprecated and marked for removal

Notice that forRemoval = true makes the compiler print a stronger removal warning in every consuming build, which is a constant, low-cost reminder. The Javadoc says what replaces the method, when it goes away and how to migrate. A deprecation without a pointer just annoys people.

3Announce a Clear Timeline

Teams can plan only what they know about. We announce the change once, clearly, in the channels teams actually read: the library's changelog, the engineering announcement list and the platform team's planning notes. The announcement says what changes and why, what teams must do, how long it should take with the recipe, and the date or version of removal. For a change of this size, six months, or two minor releases, is a reasonable window; it covers most teams' quarterly planning cycles.

Then we keep the promise. If the removal date slips every time someone complains, teams learn that deadlines are optional. If a real blocker appears, we handle it as a recorded exception for that service, not by moving the date for everyone.

4Make Migration Cheap With an Automated Recipe

The biggest lever is making each service's migration nearly free. OpenRewrite recipes transform source code safely using the compiler's understanding of types, so they change real calls to our method and not unrelated methods with the same name. For simple renames and type moves, a declarative recipe is enough; for changes in arguments, we write a small imperative recipe in Java.

Java
# rewrite.yml shipped with the library (declarative recipe; check recipe options for your version)
type: specs.openrewrite.org/v1beta/recipe
name: com.acme.MigrateToCharge
displayName: Migrate PaymentsClient.send to charge
recipeList:
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: com.acme.payments.LegacyResult
newFullyQualifiedTypeName: com.acme.payments.ChargeResult
- org.openrewrite.java.ChangeMethodName:
methodPattern: com.acme.payments.PaymentsClient sendRefund(..)
newMethodName: refund
# A team runs it, reviews the diff, runs its tests and merges:
# mvn rewrite:run -Drewrite.activeRecipes=com.acme.MigrateToCharge

We also publish two or three before-and-after examples from real services, and the platform team can run the recipe across all repositories itself and open pull requests, so most teams only need to review and merge. That changes the cost per service from half a day to perhaps half an hour.

5Track Adoption and Help the Laggards

We need to know, per service, where things stand. Two data sources work well. Dependency data, from software bills of materials, the build system or the artifact repository, tells us which library version each service builds with. Usage data tells us whether the deprecated method is still actually called, for example a counter the library increments and reports as a metric, or a version header it sends on every request.

Adoption dashboard, week 10 of 26
Service groupServicesOn 4.2+Still call send()
Checkout and payments18180
Orders and fulfilment34314
Customer and marketing413012
Internal tools271215
Usage of the old method, not just the version, decides when removal is safe.

The dashboard turns a vague worry into a short list of teams to talk to. We contact owners of lagging services early, find out what blocks them, and help: a pairing session, a recipe fix for a case it missed, or an agreed exception with a date. Making the progress visible to engineering leadership also helps teams prioritise the work.

6Remove in a Major Version and Move the BOM

When usage of the old method reaches zero, or only agreed exceptions remain, we remove it in the next major version, 5.0. Services with an exception stay on the 4.x line for their agreed period, and we backport only security fixes there.

The shared BOM, the bill of materials that pins tested versions of the organisation's libraries, is then moved to 5.0. Services that import the BOM pick up the new version together on their next upgrade, which keeps the whole estate on a consistent, tested set of versions instead of a mix of old and new. The changelog for 5.0 lists the removal and links to the migration guide for anyone who comes late.

7Follow-up questions

What if the old and new APIs cannot coexist, for example because of a shared type change?

Then we introduce the new type in a new package or with a new name, so both can exist on the classpath at once, and provide adapters between them. Coexistence is worth a little extra design effort, because it is what lets 120 services migrate one at a time instead of all at once.

How do you choose the length of the deprecation window?

Long enough for every team to fit the work into a normal planning cycle, and short enough that the library team is not maintaining two APIs indefinitely. With an automated recipe, three to six months is usually enough; for changes that need manual work or behaviour changes, a longer window is fairer. The key is announcing it up front.

Who pays for the migration work, the library team or the consumers?

Both, but the library team should carry most of it, because it decided on the change and it can automate the work once instead of 120 teams doing it by hand. Consumers review, test and deploy. A library team that only announces changes and expects others to do the work quickly loses trust.

8Conclusion

In this answer, we planned a breaking change for 120 services as a coordinated migration. The new API ships beside the old one, the old one is deprecated for removal with a pointer and an announced timeline, an OpenRewrite recipe and examples make each migration cheap, adoption is tracked per service from dependency and usage data with direct help for teams that lag, and the old API is removed only in a major version once usage is at zero or agreed exceptions, with the BOM moved so services upgrade together.

What to say in the interviewAbout 100 seconds aloud

Open with

I would never make the breaking change in one step. First I add the new API alongside the old one in a minor release, and where possible reimplement the old method as a call to the new one, so there's one implementation.

Then, if they want more

I mark the old one @Deprecated with since and forRemoval set, and the Javadoc says what replaces it and when it will be removed, so every consumer build shows a removal warning with a pointer. Then I announce a clear timeline, for example removal in 5.0 in six months, which fits most teams' planning cycles, and I keep that date.

The biggest lever is making the migration cheap: I ship an OpenRewrite recipe that rewrites the calls, plus a few examples, and the platform team can run it across all repositories and open pull requests, so teams mostly just review and merge.

I track adoption per service using dependency data from the build or SBOMs, and usage data, like a metric the library emits when the deprecated method is called, because the version alone doesn't tell me whether the old method is still used. I contact owners who are lagging early and help them, or agree an exception with a date.

When usage is at zero, or only agreed exceptions remain, I remove the method in the major version, keep security fixes on the old line for the exceptions, and update the shared BOM so services move to the new version together.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "You must make a breaking change to a shared library used by 120 services owned by many...": https://scrivio-interview-library.netlify.app/java/clean-code/d9357b92da/