As asked
In Scala, when would you use Future directly, and when would you reach for an effect system such as cats-effect or ZIO?
Sample answer outline
Future starts running eagerly and is tied to an ExecutionContext, which is fine for simple service calls but makes cancellation, resource safety and deterministic tests harder. Effect systems represent work as values, so execution, retries, cancellation, timeouts and resource scopes can be composed before the program is run. The tradeoff is complexity and team learning cost. A strong answer names the operational benefits: bounded concurrency, structured resource handling and better testing with controlled runtimes. Candidates often describe effect systems as only functional style rather than as production control over side effects.
Expect these follow-ups
- Why does eager execution make Future awkward in tests?
- How does Resource prevent leaks?
- When would an effect system be overkill?