Scala is an amalgamation of object-orientation programming language and functional programming language which runs on the JVM (Java Virtual Machine). Scala was created by Martin Odersky and promoted by Typesafe Company. Therefore we need to use some tools of Typesafe in order to learn Scala. Scala was officially released for Java platform in early 2004 and for .Net framework in June 2004.
There are lots of people who haven’t heard about Scala, they know Java and other languages but not Scala. Scala is very important, very fast and very efficient. Also, Scala is very important in the World of Big Data.
Scala stands for scalable language. Does this mean that other languages are not scalable? Java is scalable, python is scalable, all this languages are scalable, but there is a limit to the scalability. When it comes to java it is scalable to an extent, similarly python is scalable to an extent. But scala is a programming language which was built scalability, Actually the main motto of building scala was scalability, that’s why scala stands for scalable language. Scalability is one of the important features of scala.
Now what next? The world is changing right? So everywhere we have this big data, we are generating a huge amount of data, so we have this concept of big data. And to work with big data we need a framework called Hadoop. We have another framework, the latest for big data, which is called Spark. For working with Hadoop we can opt to use Java or Scala but if we work with spark, the only language we can work with is Scala.
Therefore in case if you are going for big data on Spark framework, then you need to learn Scala. If you are going for certification for Hadoop Spark then it is very important to know Scala programming language.
The next important thing is, you know, there is always a debate about which is the best programming language. Some like Python and some java, people who love python say that in Python if you want to print "“hello world", you only have to write one line and to do the same thing in java, you have to write six lines of code. You have to write a class, a main method, you have to write system.out.println and then you can say hello world.
Its bit odd, in Jave we have, it is a structured language. Yes there is a boiler plate code in java because it is a structured language. And it has certain boiler plate codes. Now there are lots of programmers in java who thinks java should be modified as we need less boilerplate codes. So they tried to modify java and they came out with scala. So we cannot say that there is much difference between java and scala. Scala is java with some changes. So there is no boiler plate code is scala, so if you want to print something, you directly write a line and print it.
You don’t have to write any boiler plate code in Scala. When it comes to boiler plate code, it simply means those lines which are not important. For example – if you want to print “Hello world” in java, the most important line is ‘system.out.println’ but we have to mention class the main method that is boiler plate code.
Java supports concurrency, now why we need concurrency is because we are living in an age of octa-core CPUs. In our CPUs, initially we had one core, then we had two core which is dual core machines, then we got quad-core machines and now we have octa-core CPUs. So when you have octa-core CPUs means that there are multiple cores, so we have to make sure that we write a software, it should be efficient enough to utilize all the available cores. And scala provides you that feature. Even if you don’t know it, Scala will do it automatically for you. So scala provides concurrency.
So we have talked about Scala being scalable language, it works on big data, it doesn’t have boiler plate codes and it is concurrent. And what else? In fact there is a quote from Alan J Palace “ A language that doesn’t change the way you think about programming is not worth learning.” So that means after learning scala, it will change the way you think about programming. No its not about procedures, its not about objects now, its more about functions. Because Scala is functional programming. In scala we only have to focus on functions. Scala is functional programming.
Now it may happen that you don’t want to make your career in Big Data, you don’t want to do any other stuff. But even if you learn scala, it will change the way you write your java codes.
Advantage of Scala
Scala is better than java you can say that scala is an upgraded version of java. Now the question arises? Does that mean this is the end of java? And the answer is No. Java will forever be there, but there are some requirements where scala is better than Java. For example- when twitter was made in 2009, they used Ruby language, but later on because of lots of tweets, this big data concept, So it was very difficult for the twitter to manage all this data using Ruby language. So what they did was remove Ruby from the backend and now they are using Java and Scala on the backend, that means they are using both and they work together. It’s because Java runs on JVM and Scala also runs on JVM. That means you can write one application which is a java based application, and you are using Scala code there. And you can write a Scala application on which you are using java code. That means a java project support scala code and a Scala project supports java code.
In Scala you can use all the java libraries. So if you know java then you can learn scala in one month. But if you don’t know java then scala is a bit difficult. I am not saying it is impossible to learn scala but it will be difficult to understand. Scala and java work together. Scala also runs on JVM, and nobody loves java as everyone loves JVM, therefore, we can Scala is powerful than Java.
Below are the names of some famous companies using Scala language: