Scrivio Interview library
LeadershipPrincipal7 min read · updated 12 November 2026

As the senior technical leader, how do you decide what should be shared code, what should be a platform service, and what should be left to teams?

I would share code when behaviour must be consistent inside every process, such as security checks or observability, and changes slowly. I would offer a platform service when the capability has state or operations behind it, such as identity, feature flags or configuration, and leave domain logic to teams, because shared domain code couples their release cycles. For each piece I would also consider who maintains it and how upgrades reach all users, and review the boundary as the organisation grows.

Background to this question

Every growing engineering organisation keeps meeting the same question in different forms: should this be a library, a service the platform runs, or something each team does its own way? Getting it wrong is expensive in both directions. Too much shared code and teams cannot release independently; too little and every team rebuilds security and observability differently. A senior technical leader needs a rule that teams can apply without asking every time. In this answer, we will look at what each option really costs, then at when shared code fits, when a platform service fits, why domain logic stays with teams, how maintenance and upgrades decide many cases, and why the boundary must be reviewed over time.

1A Quick Recap of the Three Options

Shared code is a library, such as a Spring Boot starter, that each service includes and runs inside its own process. A platform service is a running system that a central team operates and other services call over the network, such as an identity provider or a feature flag service. Leaving it to teams means each team builds what it needs, perhaps following a written standard.

Each option moves cost to a different place. Shared code is cheap to call, a method call with no network hop, but every change must be upgraded in every service. A platform service changes in one place, but adds a network dependency and needs people to run it around the clock. Leaving it to teams costs nothing centrally but may duplicate work and produce inconsistency.

Where each option puts the cost
OptionRuns whereChange reaches usersMain cost
Shared codeinside each servicewhen each service upgradesupgrade effort across services
Platform servicecentral, over the networkimmediately, for everyoneoperations, availability, latency
Left to teamseach team's own wayteam decidesduplication, inconsistency

2When Shared Code Is the Right Choice

Shared code fits behaviour that must be consistent inside every process and changes slowly. Security checks are a good example: validating a token on every request must happen in the service, within microseconds, and must behave the same everywhere. A network call to a central service for every request would add latency and a single point of failure. Observability setup is another: every service must produce metrics, traces and logs in the same format, and that happens in-process.

The slow-change condition is important. Shared code is upgraded by every consumer separately, so a library that changes every week forces constant upgrades across the organisation. Security starters are the exception that proves the rule: they change rarely in features, but when a vulnerability appears they need fast patch releases, which is why they need an owner, a BOM and dependency bots to spread updates quickly.

3When a Platform Service Is the Right Choice

A capability belongs in a platform service when it has state or operations behind it. Identity is the classic case: users, credentials, sessions and keys are state that must live in one place, be backed up and be secured by specialists. Feature flags need a central store of flag values that can change at runtime for all services. Configuration and secrets need a central, audited store. A library cannot hold that state for everyone; something must run.

Usually a platform service still comes with a small client library, for example a feature flag SDK or Spring Security's OAuth2 support for the identity provider. That is fine: the state and operations are central, and only the thin, slowly changing client is shared code.

Java
// Platform service plus thin client: the flag's value lives centrally, the check runs locally
@Service
class CheckoutService {
private final FeatureFlags flags; // client from the platform's SDK, cached locally
CheckoutService(FeatureFlags flags) { this.flags = flags; }
Receipt checkout(Cart cart, User user) {
if (flags.isEnabled("new-tax-engine", user.id())) { // value from the flag service, refreshed in background
return newTaxCheckout(cart);
}
return legacyCheckout(cart);
}
}

Notice that the client caches flag values and refreshes them in the background, so a short outage of the flag service does not stop checkouts. Designing the client this way is part of offering a platform service responsibly.

4Why Domain Logic Stays With Teams

Domain logic is the business rules of a product area: how prices are calculated, when an order can be cancelled, how a loan is approved. It changes as often as the business does. If it lives in shared code, every change needs a release that all consuming services must take, and teams start waiting for each other. If it lives in a central service owned by nobody in particular, it becomes a bottleneck that every team must queue for.

So domain logic belongs to the team that owns that domain, inside its own services. Other teams use it through that team's API or events, which are contracts that evolve compatibly. That way each team can change its rules and release on its own schedule, which is the main reason for having separate teams and services in the first place.

5Who Maintains It and How Upgrades Reach Users

Two practical questions often settle unclear cases. First, who will maintain it? A library or service without an owning team decays: bugs are not fixed, security issues linger and nobody can approve changes. If no team is willing and funded to own a candidate shared piece, it should not be shared yet.

Second, how will upgrades reach everyone? For a platform service, an upgrade is one deployment. For shared code, it is a new version that 200 services must adopt, which needs a BOM, dependency update bots and a policy for how quickly teams must upgrade. If a capability needs frequent changes that must reach everyone at once, that is a strong sign it should be a service rather than a library.

Step throughDeciding where a capability belongs
  1. Is it business logic of one domain?
    YesyesNoleave it to the owning team
  2. Does it hold state or need operating?
    YesyesNoplatform service with thin client
  3. Must it be consistent in every process?
    YesyesNoshared code, if it changes slowly
  4. Is there a funded owner?
    YesyesNobuild it
  5. Review the decision as the organisation growsyearly or after reorganisations

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

6Reviewing the Boundary as the Organisation Grows

The right answer changes with size. With five teams, a written standard and a bit of copied code may be cheaper than any shared library. With fifty, the same duplication becomes a real cost, and a shared starter or a platform service pays for itself. As teams split and products change, some shared pieces turn out to be domain logic in disguise and should move back into a team.

So I would review the boundary regularly, for example once a year and after major reorganisations, looking at which shared pieces are widely used, which cause upgrade pain, and where teams have built the same thing several times. The rules stay the same; the answers move as the organisation does.

7Follow-up questions

Where would you put something like PDF generation that several teams need?

It has no shared state, but it is often heavy, needs fonts and templates, and changes when document formats change. If many teams need it, a platform service is usually better, because it keeps the heavy dependencies out of every service and upgrades in one place. If only two teams need it, a library owned by one of them may be enough.

Is copying code ever better than sharing it?

Yes, for small, stable pieces of code where the coupling of a shared dependency would cost more than the duplication. A dozen lines copied into three services is cheaper than a library that all three must upgrade together. The duplication becomes a problem when the code is large, changes often or must behave the same everywhere.

How do you stop a platform service from becoming a single point of failure?

Run it with high availability, give clients caching and sensible fallbacks, as with the feature flag client, and set clear service level objectives. Teams should be able to keep working for a period if the service is briefly unavailable.

8Conclusion

In this answer, we built a rule for deciding between shared code, platform services and leaving things to teams. Shared code fits in-process behaviour that must be consistent and changes slowly, like security and observability. Platform services fit capabilities with state or operations, like identity, feature flags and configuration, usually with a thin client. Domain logic stays with its team because shared domain code couples release cycles. Ownership and the upgrade path settle unclear cases, and the boundary is reviewed as the organisation grows.

What to say in the interviewAbout 90 seconds aloud

Open with

I use a few questions. First, is it business logic of one domain, like pricing or order rules? Then it stays with the team that owns that domain, and others use it through their API or events, because shared domain code couples everyone's release cycles.

Then, if they want more

Second, does it hold state or need operating, like identity, feature flags, configuration or secrets? Then it should be a platform service run by a central team, usually with a thin client library that caches and fails gracefully. Third, must it behave the same inside every process and does it change slowly, like token validation or observability setup?

Then shared code, such as a Spring Boot starter, is right, because it runs in-process without a network hop. If none of those apply, a written standard and letting teams do it themselves is often enough.

Two practical checks settle the unclear cases: who will maintain it, because shared things without a funded owner decay, and how upgrades reach users, because a library that needs frequent changes across 200 services is better as a service that changes in one place.

Finally, I would review the boundary regularly, since what is cheaper with five teams is different with fifty, and some shared pieces turn out to be domain logic that should move back into a team.

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 "As the senior technical leader, how do you decide what should be shared code, what...": https://scrivio-interview-library.netlify.app/architecture/platform-and-governance/1031d3f989/