O'Reilly logo

Scala Functional Programming Patterns by Atul S. Khot

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required