Why Scala will be the next big thing


Why Learn Scala ?

This is not a scala fanboy post, I am currently learning scala and below are some of the things that I felt worth sharing about the language.

It is a very powerful language and not a simple one to learn. First, I will list the good things, and this cannot be done without comparing it with other languages and ill also speak about its downsides and how to avoid them. There won’t be any code, but there are few good videos/talks that you can use to learn the nuances of coding.

No programming language is a silver bullet, it is up to you to decide what is best for your job.

PS : You are free to use this article to sell scala to your boss

: This article has been translated to chinese by ChanZong Huang, you can check it out here.

Heads Up !!

If I were to pick a language to use today other than Java, it would be Scala. – James Gosling, creator of Java

If someone had shown me the ‘Programming in Scala’ book back in 2003, I’d probably have never created Groovy – James Strachan, creator of Groovy

No other language on the JVM seems as capable of being ‘replacement of Java’ as Scala, and the momentum behind Scala is now unquestionable – Charles Nutter , co-creator of JRuby

Ok, those are some pretty big names talking about scala. Let’s get started.

A Little bit of History

Scala was designed from 2001 by Martin Odersky who was also the co-creator of javac and Java Generics.

The main goal of Scala was to be multi paradigm, focused on the JVM and to overcome the problems left by other languages.

Scala evolution is a short presentation which you can read if you are curious.

Scala - The Good Stuff !!

Multi Paradigm

Scala orthogonally combines functional programming and object oriented programming which no other language has done till date or at least not to the level of Scala on the JVM. Technically Object oriented programming is not a paradigm and falls under the imperative programming paradigm, but you get the idea.

In this aspect it is better than Haskell.

Functional programming purists might disagree with this statement and say that pure functional programming is always better and does not mix well with OOP.

Well that is not true. Why mix OOP and FP? - Because that’s how the real world is like. Some aspects are nicely modelled with timeless relations, others need life-cycle and state. Scala offers this perfect balance between both.

But why use functional programming in the first place? Below is an excellent talk by Martin Odersky himself on that.

Martin Odersky, "Working Hard to Keep It Simple"

Runs on the JVM

Scala was designed to run on the JVM platform. Despite several people ranting about JVM for several reasons, it is a very powerful platform which developers can leverage. Making scala run in its own environment would have been re-inventing the wheel. The designers of scala took a very good decision in this aspect. This has several advantages, mainly being able to directly use Java libraries and other feature rich APIs without having to do much boilerplate work.

This where Scala’s close counterpart OCaml loses out. Although things are improving, there are many libraries that are missing.

Statically typed

Yes, scala is statically typed. Why is this even mentioned as an advantage? I encourage you to read this post that explains the advantages of static typing.

Clojure was a more newer language that came out in the JVM platform, but it is dynamically typed which gives Scala the advantage here. There is a typed closure version, I have not tried that yet so I cannot comment on it. Until then ill go with Scala.

Built for Concurrent/Parallel computing

As Moore’s law draws near, the need for concurrency is greater than ever. Companies today are looking out for scaling out rather than scaling up and distributed systems come more into play. With these things in mind, Scala was built to handle concurrency at a more fundamental level using Functional programming.

Support and Ecosystem

Scala has gained extensive support. Companies including Linkedin, Twitter, Coursera, Foursquare etc have ported majority of their code bases to Scala. There is a commercial company called typesafe, which Martin Odersky himself is part of it and offers consulting for the Reactive platform built using Scala.

Edit : Typesafe is now lightbend.

A more comprehensive list is available here.

Many open source projects such as Apache Spark, Apache Kafka use Scala for their Core. The pretty famous Play framework is developed using Scala.

And unlike some languages which I shall not name, Scala was created and has a ecosystem of some really smart people. This does make a difference when you are looking for a platform to build and rely upon for your product/business rather than for your hobby projects, although it is fun to do some hobby projects using Scala.

The Shortcomings !!

Not purely functional

If you are familiar with the functional programming world, then you can find lot of people arguing that Scala is not purely functional and is ugly at doing some functional programming constructs. This is not entirely true, while Scala is not a pure functional language, it was not intended to either, it has the right mix of constructs for the real world implementations. I find the programming constructs comparison a little too academic rather than real world.

But nonetheless, if you are looking for a pure functional language, then you might want to look elsewhere.

Larger learning curve

This is common for any new language, but I would admit that it has a steeper learning curve to it. Fortunately things have improved and there are many resources that I have listed separately below that can be leveraged to overcome this.

Not yet popular - Well really?

You might be surprised that after mentioning many big names that popularity is listed as a shortcoming. Well yes, the software industry is slow to adopt new technologies, primarily because companies don’t really feel comfortable in the cost of migration and developers who don’t adapt fearing losing their jobs. Scala is not yet as popular as Java and other languages. It takes time, but it is definitely not a prototype language, mission critical systems have been developed using Scala.

But as mentioned earlier it is already built on the JVM and it can operate seamlessly with Java libraries.

Scala is the only language which is statically typed,multi paradigm (object, functional and imperative) and runs on the JVM.

Resources

If you find one that is really good, do let me know.

There are several more, but hopefully that should get you started.

References

Do watch out for more Scala articles.

Happy Coding


Tagged Under


Scala


Search this website...




Keeping up with blogs...

I blog occasionally and mostly write about Software engineering and the likes. If you are interested in keeping up with new blog posts, you should follow me on twitter where I usually tweet when I publish them. You can also use the RSS feed , or even subscribe via email below.

Feedio Subscribe


Share & Like

If you like this post, then you can either share/discuss/vote up on the below sites.



Thoughts ...

Please feel free to share your comments below for discussion

Blog comments powered by Disqus