Chapter 2Functional Programming
Object-oriented programming has been a standard in large-scale applications for many years, and it isn't going to change any time soon. The advantage of Scala is that it allows you to choose functional programming, without abandoning the good parts of object-oriented architecture. It is possible to program in Scala in the same way that you program in Java. Sure, there would be some different keywords here and there, but the overall structure would be the same. You may start by writing your application in a boring imperative style, and then transforming it to the immutable-functional one.
When a “functional feature” comes to an imperative object-oriented language (see streams in Java 8), you may want to reject it at first. But then, after trying it for some time, you find that you can't develop without it. This chapter provides you with hints about the advantages of functional programming, but it's up to you to decide whether or not functional programming is your cup of tea.
The previous chapter covered Scala's syntax, and in this chapter we discuss the classical pillars of functional programming language, and how ...
Get Professional Scala 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.