Scala provides many tools to help us build programs with less runtime errors.
Instead of relying on nulls, the recommended practice is to use the Option type.
Instead of throwing exceptions, Try and Either types are used for representing potential error scenarios.
What’s common with these features is that they’re used for capturing runtime features in the type system,
thus lifting the runtime scenario handling to the compilation phase:
your program doesn’t compile until you’ve explicitly handled nulls, exceptions, and other runtime features in your code.
In his “Strategic Scala Style” blog post series,