Scala and the cloud
As the cloud becomes more popular, so does the functional programming language Scala. Don't worry though, it's Java compatible and it runs on a JVM. So why are people using it? Perhaps because it's so functional.
One of the curious developments in the cloud computing landscape is the fact that as the benefits of the virtualized world becomes increasingly adopted, so increases the interest in developing with the programming language Scala. So what is Scala, and why is it so darn popular with the cloud computing crowd?
What is Scala?
The name Scala is actually an abbreviation, or perhaps more accurately, a condensing of the two words Scalable Language, demonstrating right from the start that the language itself was intended from the outset to conform to a paradigm where the language itself must be able to grow and evolve.
Unlike many of the most common languages in prominent use today, Scala is a relative newcomer to the language wars, with its origins tracing back no earlier than the start of this century when Martin Odersky, a respected name in the arena of Java and generics, began architecting it at the École Polytechnique Fédérale de Lausanne (EPFL). So what’s the twist that would make a die-hard Java proponent like Martin to develop something new? Well, it was the desire to combine the object-oriented nature of Java with a functional programming model as well, which is essentially what Scala delivers: a fully object oriented language that can also be used to do functional programming.
Scala and the Java Virtual Machine
Now here’s the neat thing about Scala. While it is indeed a language unto itself, the code you write in Scala gets compiled into an intermediary form. For Java based environments, Scala gets compiled into bytecode in the exact same way that standard Java code gets compiled. In fact, Scala is so completely compatible when compiled, you can actually take a decompiler to the bytecode Scala creates and decompile it directly into Java. And since Scala is compiled into Java bytecode, Scala can be run on any Java Virtual Machine, which makes Scala just as ‘cross-platform’ as Java is.
But beyond being compatible with Java code, Scala is also inter-operable with Java code. As a result, you can make a call from a Scala program to any of the standard Java libraries, or for that matter, to any custom libraries that are on the Java Virtual Machine’s classpath. And the reverse is true, as Java applications are more than entitled to invoke Scala functions. So although Scala may be a new language, it quickly and easily integrates with the existing Java code in which an organization may have invested.
But why is Scala becoming so popular, especially in the realm of cloud computing? Well, it really has to do with the fact that the functional aspect of Scala makes it perfect for creating domain specific languages (DSLs). A domain specific language is a language that is focused on a particular problem or area of specialization. The cloud itself is a new area of specialization in the computing world, and as such, there is often a need to create DSLs for it, or should we call them, CSLs or Cloud Specific Languages. Many vendors competing in the could space are developing their own DSLs, and more and more of those DSLs are leveraging the scalable nature of the scalable language named Scala.
The interoperability of Scala with Java, the statically typed nature of the language, and the additional ability of Scala to provide a platform for functional programming has made Scala a quickly growing language in the industry, and as cloud computing emerges as the platform of choice for many enterprise developers, so does Scala become the choice for programming to, and interacting with, that cloud computing platform.
Follow Cameron McKenzie on Twitter (@potemcam)
Josh Suereth's Scala in Depth on Amazon.com
Martin Odersky Programming in Scala
Cay S. Horstmann's Scala for the Impatient
Martijn Verburg's The Well-Grounded Java Developer