I attended Scaladays 2010 at EPFL in Lausanne, Switzerland in April. at which Nigel Warren and I presented the work we had done on porting Fly’s Java client library to Scala. You can watch all the Scaladays videos on the Scaladays website and so I will not dwell on the talks, which were excellent. Instead, I want to talk about Scala and its community, led by Martin Ordersky.
It has become clear to me, as it did with Java 15 years ago, that Scala is an incredibly important language and almost certainly Java’s successor. There is no reason for anyone intending to build applications for the JVM to choose Java over Scala.
Any Java developer is capable of writing Scala in a basic sense, that is, write exactly what they would write in Java but in Scala’s syntax. They can even start by mixing Java and Scala if they feel uncomfortable about jumping all the way in. Developers can choose to use Scala on parts of a system or even just in tests. Scala’s tight integration with Java libraries and frameworks enables developers to make use of the Java ecosystem as they normally would which is incredibly valuable.
However, Scala has a great deal of headroom. It enables much more concise, simpler, reusable and elegant software to be written for those that have the will to learn functional programming and a little practical type theory. Importantly, Scala offers Java developers a way to move from idiomatic Java to idiomatic Scala in small steps, there is no need for a wholesale leap into the unknown. In short, Scala offers a migration path to a better way to build robust software.
A reason why Scala is important is that it offers mechanisms for controlling complexity. In The Structure and Interpretation of Computer Programs, Abelson and Sussman said:
In our study of program design, we have seen that expert programmers control the complexity of their designs with the same general techniques used by designers of all complex systems. They combine primitive elements to form compound objects, they abstract compound objects to form higher-level building blocks, and they preserve modularity by adopting appropriate large-scale views of system structure.
Scala facilitates this abstraction and combination that results in simpler, more robust software in a number of ways: functional programming techniques, object oriented techniques, a rich type system and mechanisms to build components. In Scalable Component Abstractions, Martin Odersky and Matthias Zenger describe abstractions for the construction of reusable components:
abstract type members, explicit selftypes, and modular mixin composition. Together, these abstractions enable us to transform an arbitrary assembly of static program parts with hard references between them into a system of reusable components.
Making full use of Scala does not come for free, there is a lot to learn. Fortunately, the Scala community is very friendly which is in large part due to Martin and his team’s efforts. The community is full of very smart people who are very willing to help novices. It is not unusual for questions asked on mailing lists to be answered by Martin or other leaders in the Scala community. This friendly environment is actively fostered so that beginners feel comfortable asking basic questions without fear of angry replies to RTFM.
There are those that think that Scala is a complex language and they are right to a certain extent, but you can be productive in Scala without using advanced features, just not as productive as you would be if you learnt about those features.
Most objections to new languages like Scala and Clojure can be reduced to, “I don’t understand this after 2 mins of skimming the website so its too academic”. Not very good really and not worthy of further argument.
Learning Scala has real benefits in understanding more about computing in general, and it lets you do it gently whilst being productive. Give it a try!