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 ...

Get Scala Functional Programming Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.