I have been using Scala for over a year and I believe it won’t die out. I would like to give you reasons to
ditch that other language and start using Scala. I would be presenting my case using powerful features in Scala known as case classes (no pun intended) and
pattern matching. Pattern matching is described as
switch on steroids on Scala’s official website. I think comparing it with switch cases is quite an injustice to it. It has also been called
Swiss army knife of Scala.
Unlike Java that is riddled with boiler plate codes, Scala is quite concise. Though to be fair, using Java 8 lambdas could make Java code a bit concise.
Comparing codes creating a user class in Scala and Java clearly shows Scala’s concise nature.
When we started Spark, we wanted it to have a concise API for users, which Scala did well.
— Matei Zaharia,CTO @ Databricks
Scala mixes the functional paradigm with pure object orientation. In Scala, functional programming is the recommended way to program but the creators knew making that deep dive would be tough for anyone so you can still use your OOP patterns.
Functions are first class objects in Scala. Using functional programming, you will be able to write less code that is reusable and easily maintained.
Solving the first Euler problem (Find the sum of all the multiples of 3 or 5 below 1000) in Scala with the functional paradigm shows clean and maintainable code.
Statically typed programming languages do type checking (the process of verifying and enforcing the constraints of types) at compile-time as opposed to run-time.
Scala’s static typing is one of my favorite feature.It has been proven that static typing improves code quality. This is important for data scientists, if you have a large job that will run for hours, you don’t want to find out half way through the job that it was not a correct implementation.
Scala’s static typing helps you write less tests, you don’t need to write tests to check type consistency as the compiler does that for you (Sigh of relief). This helps you reduce the amount of stupid bugs at an early stage.
Also, with Scala’s type inference you can create variables without a specified type and the type would be inferred.
Scala has awesome Java interoperability which means you can import and use your Java codes and libraries in your Scala application (isn’t that awesome?). The good thing is that integration is seamless as Scala runs on the JVM, you do it without any performance penalty.
Scala is suited for multi-core programming, it has built in tools for its implementation. Using Immutable values and collections is the recommended method of programming in Scala, as it guards your data from being mangled by different processes.
Scala also uses Akka which is a
toolkit and runtime for building highly concurrent, distributed, and fault tolerant event-driven applications. Scala’s functional nature makes it easier to write safe and performant multi-threaded code. There is less reliance on mutable state and Scala’s futures and actors provide powerful tools for organizing concurrent systems.
From the results of the recent stack-overflow survey, Scala is amongst the top five most loved languages. Scala has recently seen adoption as the language for introduction to computer science in some educational institutions.
It is no mistake that Spark (a data engine written in Scala) jobs and Scala jobs are the top paying tech jobs in the US and amongst the top ten paying tech jobs worldwide according to the stack-overflow survey. I guess if none of the above cases impressed you, this should do right?
Other features that make Scala awesome are
So, what do you think? Drop your thoughts in the comments section.