Scala introduction

Released in 2004, Scala was designed to fill all the gaps that Java leaves behind.  After working on Funnel, Generic Java and Javac, Martin Ordersky set out to create Scala not as a better Java, but as a better language altogether.  Complex and concise, Scala is a general purpose language that runs on the Java platform and is compatible with all existing Java programs.  Designed to bridge the gap between object-oriented and functional programming, Scala supports functional programming within an object-orientated paradigm.  One of Scala’s most important features is its immense scalability.  Odersky specifically designed Scala to scale well to tackle a number of different problems, making sure the same concepts can describe both small and large parts.  Scala is often considered one of the most difficult languages to learn, since its principles are based on mathematical type theory.  But don’t let that scare you — mastering Scala opens a whole new world of possibilities. 

Scala and Java

Syntax-wise Scala and Java are very similar, but Scala’s syntax is more flexible and expressive, earning comparisons to high level languages such as Ruby.  There are some fundamental differences between the two languages which makes shifting from Java to Scala challenging. 

While Java developers run the risk of writing lengthy codes, Scala is far less verbose and more compact.  What you might write in 20 lines in Java, you can pack into a single line in Scala.  Thanks to Scala’s smart compiler, Scala.js, Scala developers don’t have to explicitly specify as many things.  As a machine compiled language, it was designed to run in the Java Virtual Machine (JVM) and performs type-checking at compilation time instead of at runtime.  Running Scala in JVM allows developers to benefit from JVM’s stability, ubiquity and its features, such as JIT compilation and management extensions.  Another advantage is that in addition to Scala’s standard library Akka, you can use your favourite Java libraries, both third party and your own. 

Despite its lack of mainstream success, Scala is highly suited for handling Big Data.  It’s one of the most powerful and efficient languages for data analysis and processing, streaming analytics and machine learning.  When using Big Data tools such as Spark, a cluster-computing framework, Scala is actually 10 times faster than Python for data analysis and processing thanks to JVM, and Scala programs are usually 5-10 times shorter than the equivalent Java program would be.  Scala may not yet be as established as Java or Python, but it sure will keep your Big Data programming short and sweet. 

Share this post

GET STARTED IN 5 MINUTES

Selina Chung is an Endorsed content creator for the tech and manufacturing sectors.  Always up-to-date with London, Berlin and Munich’s tech scenes.  Whenever she is not ferociously tapping away at her keyboard, she can usually be found reading a book or practicing a foreign language.