Chapter 9. Scala: powerful and concise

 

This chapter covers

  • Scala is not Java
  • Scala syntax and more functional style
  • Match expressions and patterns
  • Scala’s type system and collections
  • Concurrent Scala with actors

Scala is a language that came out of the academic and programming language research community. It has gained a certain amount of adoption, due to its very powerful type system and advanced features, which have proved to be useful for elite teams.

There is currently a lot of interest in Scala, but it’s too early to tell whether it’s a language that will fully permeate the Java ecosystem and challenge Java as a primary development language.

Our best guess is that Scala is going to filter down into more teams, and that some projects are going to end up deploying it. Our prediction is that a larger pool of developers will see some Scala in one of their projects over the next 3-4 years. This means that the well-grounded Java developer should be aware of it, and be able to determine whether it’s right for their projects.

Example

A financial risk modeling application might want to make use of Scala’s novel approach to object-orientation, type inference, and flexible syntax capabilities, new collections classes (including natural functional programming style, such as the map/filter idioms), and the actor-based concurrency model.

9.1. A quick tour of Scala

9.2. Is Scala right for my project?

9.3. Making code beautiful again with Scala

9.4. Scala’s object model—similar but different

9.5. Data structures and collections

9.6. Introduction to actors

9.7. Summary