Programming Styles in Scala

Scala does not limit us to one programming style. We can program with objects, or in functional style, and also mix the two to get the best of both worlds.

Java programmers are familiar and comfortable with OOP. Scala is object-oriented and statically typed—a notch more than Java on both fronts. That’s good news since our investment over the years in OOP is not wasted but earns dividends as we begin to program in Scala. When creating traditional applications we can lean toward the OO style provided by Scala. We can write code much like the way we’re used to in Java, leveraging the power of abstraction, encapsulation, inheritance, and above all, polymorphism. At the same time, we’re not restricted to this model when ...

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