Summary
Paradigm shift is a fundamentally alternate approach to program design. It invites us to think in radically different ways. Sorting, parsing, error handling, and concurrency have very different forms in Scala compared to Java.
Scala provides some stock sorting methods. We took a look at them and then came up against a problem of needless computation when sorting objects. The solution is the Schwartzian transform, a memorization technique. This is a Perl idiom, however, the idea is pretty general. We saw its Scala implementation.
Error handling is usually messy. The scheme of returning error codes always has the risk of us forgetting to check for errors. Exceptions are an improvement. Scala provides a nice solution so the error handling blends into the computation pipeline. We looked at the Try/Success/Failure family with an example.
We can use threads; however, Scala provides Futures and Promises. These are much easier to use when performing asynchronous computations. We can approach...