Scrivio Interview library
DesignAdvanced6 min read · updated 12 November 2026

A team proposes adopting a functional effects library (for example Vavr or a reactive library) as the standard way to write business logic in all new services. How do you evaluate the proposal?

I would evaluate it as an investment decision, not a style preference. First, pin down the problem it is meant to solve, such as error handling, composition or concurrency. Then compare it with what Java 21 and 25 already provide: records, sealed types and pattern matching for results, virtual threads for simple blocking concurrency, and structured concurrency, which is still a preview. Weigh skills, hiring, readability and framework integration, run a pilot in one service with measurable criteria, and adopt it company-wide only if the pilot proves a clear benefit.

Why this question is asked

Proposals to standardise on a programming model come up regularly, often from a strong team that had a good experience with it. A functional effects library or a reactive library changes how every method in a service is written, so a company-wide standard is one of the most far-reaching technical decisions a platform group can make. Interviewers ask this to see whether we can evaluate it with evidence instead of enthusiasm or reflexive rejection. In this answer, we will clarify the problem, compare the proposal with modern Java, weigh the human and framework costs, design a pilot, and decide what the standard should be.

1Start With the Problem It Solves

An effects library represents computations, including their failures and side effects, as values that we compose. A reactive library such as Project Reactor models asynchronous streams of values with operators and back-pressure, which means a slow consumer can signal a fast producer to slow down. Vavr provides functional types like Try and Either. These are different tools that solve different problems, so the first question to the proposing team is which problem they have.

Typical answers are: error handling, where failures are scattered and easy to ignore; composition, where chaining many dependent steps is clumsy; and concurrency, where calling several services in parallel with timeouts and cancellation is hard. Each has a different best answer, and naming it lets us compare options fairly. If the honest answer is that the code feels more elegant, that is a fine reason for one team's choice, but not for a company standard.

2What Java 21 and 25 Already Provide

Java has moved a long way in the problem areas these libraries address. For error handling and composition, records, sealed interfaces and pattern matching in switch (final in Java 21) let us model results as closed sets of types that the compiler checks exhaustively. For concurrency, virtual threads (Java 21) make blocking code cheap again: a service can handle tens of thousands of concurrent requests with plain, sequential code, which removes the main reason many teams adopted reactive programming. Structured concurrency, which treats a group of concurrent subtasks as one unit with shared cancellation and error handling, is still a preview feature in Java 25, so we should not build a standard on its current API, but its direction is clear.

Java
// Concurrency with virtual threads: plain blocking code, run in parallel
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
Future<Customer> customer = executor.submit(() -> customers.find(id)); // blocking HTTP call
Future<List<Order>> orders = executor.submit(() -> ordersClient.recent(id));
return new Profile(customer.get(2, SECONDS), orders.get(2, SECONDS)); // both run at once
}
// Error handling with sealed types
sealed interface Lookup permits Found, Missing {}
record Found(Customer c) implements Lookup {}
record Missing(long id) implements Lookup {}
Problem, JDK option and library option
ProblemModern JavaLibraryGap left
Expected failuressealed types, records, switchEither, Trysmall: map and flatMap helpers
Composition of stepsplain code, Optional, streamseffect chainssmall to medium
Many blocking callsvirtual threadsreactive or effects runtimesmall for request-response
Parallel subtasks, cancellationstructured concurrency (preview)effects runtimemedium until it is final
Streams with back-pressureFlow API onlyReactorlarge: library clearly wins
The gap the library fills is what we are really evaluating.

Notice that both snippets use only the JDK, are readable to any Java developer, and work with Spring's ordinary programming model. So the evaluation question becomes sharper: what does the library give beyond this, and is that difference worth its costs? For some problems, such as streaming with back-pressure, a reactive library still has a clear advantage.

3Skills, Hiring, Readability and Integration

The costs of a programming model are mostly human. Every engineer must learn it to read any code, so onboarding takes longer. Hiring gets harder, since most Java developers know Spring MVC and plain Java far better than effect types. Code reviews slow down while the team builds fluency, and a few experts become bottlenecks. Debugging changes too: stack traces in effect or reactive code show the library's scheduler rather than our call chain, and tools like profilers and thread dumps become less helpful.

Then there is framework integration. Spring's transactions, security context and logging context are tied to the thread in the servlet model, and moving work across threads in a reactive or effects runtime needs explicit context propagation. Libraries for databases, messaging and HTTP must have compatible integrations, or teams end up wrapping blocking calls in the effect type, which removes the benefit. Each of these costs is multiplied by the number of services that would adopt the standard.

4Run a Pilot With Measurable Criteria

Instead of deciding in a meeting, we run a pilot. One team builds or rewrites a real service with the library, and we agree the criteria in advance, so the result cannot be argued away afterwards by either side.

Step throughEvaluating the proposal
  1. Name the problemerrors, composition or concurrency
  2. Does modern Java solve it well enough?
    YesUse the JDK; no standard neededNoContinue evaluation
  3. Pilot one real servicecriteria agreed beforehand
  4. Clear benefit on the criteria?
    YesAllow for that problem area, with guidanceNoStop, keep as team choice at most
  5. Review again after a yearJDK features keep arriving

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

Most proposals end as a scoped permission, not a company standard.

Good criteria are concrete: the number of production defects in error handling compared with similar services, the time for a new team member to make a first meaningful change, latency and resource use under the same load, and the amount of glue code needed for Spring, the database and observability. A pilot of three to six months on a service with real traffic is enough to see most of these.

5What the Standard Should Say

Even if the pilot goes well, a company-wide mandate is rarely the right conclusion. The benefit is usually concentrated in a type of service, for example streaming gateways that need back-pressure, while ordinary request-response services gain little. So the result is better expressed as guidance: plain Java with virtual threads and sealed result types is the default, and the library is an approved option for named problem areas, with a supported version and integration examples from the platform team.

This keeps the door open. If structured concurrency becomes final and covers the remaining gap, we have not tied hundreds of services to a library we then want to leave. A standard should be something the platform can support for years; a programming model that changes every method is the most expensive thing to reverse.

6Follow-up questions

Did virtual threads make reactive programming obsolete?

For typical request-response services that block on I/O, mostly yes: virtual threads give similar scalability with simpler code. Reactive libraries still make sense for streaming, back-pressure, and systems built around event streams. The point is that the default reason to adopt them, thread scalability, has largely gone.

How do you handle the proposing team if the answer is no?

By making the evaluation fair and transparent: they help define the criteria, they run the pilot, and the decision follows the data. Their service can often keep the library as a team choice, as long as it meets the platform's operational standards, and their learning feeds into the guidance for result types and concurrency.

Why not adopt structured concurrency now, since it is in Java 25?

Because it is still a preview feature in Java 25, which means it must be enabled with --enable-preview and its API may change between releases. It is fine to experiment with it, but a company standard should rest on final features.

7Conclusion

In this answer, we evaluated a proposal to make a functional effects or reactive library the company standard. We clarified the problem it solves, compared it with what Java 21 and 25 provide, including records, sealed types, pattern matching, virtual threads and preview structured concurrency, and weighed skills, hiring, readability and framework integration. A pilot with criteria agreed in advance gives the evidence, and the usual outcome is plain Java as the default with the library approved for specific problem areas rather than mandated everywhere.

What to say in the interviewAbout 80 seconds aloud

Open with

I would first ask the team which problem they want to solve, because error handling, composition and concurrency have different best answers, and elegance alone is not a reason for a company standard.

Then, if they want more

Then I would compare the proposal with what Java gives us now. Records, sealed interfaces and pattern matching in Java 21 let us model expected failures as types the compiler checks, and virtual threads make plain blocking code scale, which removes the main reason many teams went reactive.

Structured concurrency addresses parallel subtasks and cancellation, but it is still preview in Java 25, so I would not standardise on it yet. Where a real gap remains, like streams with back-pressure, a library such as Reactor clearly wins.

Next I would weigh the human costs: onboarding, hiring, readability, debugging with scheduler stack traces, and integration with Spring's transactions, security and logging context. Then I would run a pilot on one real service with criteria agreed up front: defects, time to first change for a new engineer, performance and glue code.

Even with a good result, I would usually make the library an approved option for specific kinds of services rather than a mandate, because a programming model that changes every method is the hardest thing to reverse.

About this answer

Last updated
12 November 2026
Versions it names
Java 21, Java 25
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 "A team proposes adopting a functional effects library (for example Vavr or a reactive...": https://scrivio-interview-library.netlify.app/java/utility-libraries/f189e393ac/