Scala Introduction | Scala Tutorial | Scala Tutorial For Beginners | Scala Programming | Scala
Description
Scala is a general-purpose programming language providing support for functional programming and a strong static type system. Designed to be concise, many of Scala's design decisions aimed to address criticisms of Java.
10 reasons why a programmer should learn Scala:
1. Multi-Paradigm Language
Scala is a bit different than Java, as it supports two programming paradigms: object-oriented programming (OOP) and functional programming (FP).
To advance your programming skills, it’s good to learn at least one language from different paradigms, e.g. imperative, logical, functional, and OOP, and Scala gives you a chance to explore both functional and OOP together.
The Pragmatic Programmer book also advises you to learn a new programming language every year.
The Pragmatic book for Programmers
Scala allows you to define types associated with both data attributes (with classes behaving like C++/Java classes) and behavior attributes (with traits corresponding to Java interfaces).
2. Interoperability With Java
In my opinion, Scala’s choice of being inter-operable with Java is the best thing happen to Scala. Scala runs on the Java Virtual Machine (JVM) and can interoperate nicely with Java code.
It is also possible to call Scala code from Java, and you can easily write part of your program in Scala and the rest in Java.
In short, interoperability with Java gives Scala huge potential to become mainstream, enterprise programming language, as so much of the world’s code is written in Java and so many developers are working in Java around the world.
3. Best Practices and Patterns Built-In Language
One thing you might not know about Scala is that it was originally developed at the Swiss university EPFL in an attempt to apply recent innovations in programming language research to a language that can gain mainstream traction, much like Java.
Several best practices and patterns are built into the language itself, e.g. val declares top-level immutability, which is much better than the overloaded final keyword in Java, or const/read-only in C# with the weird rules associated with it.
It also got case classes, which makes it easy to create immutable Classes in Scala.
Scala also offers closures, a feature that dynamic languages like Python and Ruby have adopted from the functional programming paradigm.
4. Expressiveness
When you compare Scala with Java as I did in my previous post about the differences between Scala and Java, Scala certainly scores big over Java.
Scala is inherently very expressive. There’s also tons and tons of really beautiful and useful code written in Scala.
This is attracting more and more Java developers to learn Scala, who like to write beautiful and clean code.
To give you an idea, here is the word count program written in both Java and Scala, you can see the difference in the expressiveness of language by yourself.
Scala code is more clear and concise
By the way, things can be improved on the Java side by using Java 8 features like lambdas and stream, which is not used in this example, but still, Scala scores big over Java when it comes to concise and clean code.
5. Marketable
What programmer doesn’t want to be marketable? One reason for learning a new technology or framework is always a better job and career growth.
Learning Scala will certainly make you more marketable. Many companies are using or migrating to Scala these days, including Twitter, LinkedIn, Foursquare, and Quora.
Given Scala’s marketing as Scalable language, the days are not far when the big investment banks and financial organizations will start looking Scala for their low-latency solutions.
Similar to the advice given in Effective Java, Twitter has already shared best practices to develop programs in Scala as Effective Scala.
The founders of Quora spent a couple of months building a Scala web framework in order to use Scala.
Martin Odersky, the man behind Scala, is now behind the start-up Lightbend, formally known as Typesafe for supporting commercial Scala development.
Everything is going in the right direction for Scala to grow as the prime alternative to Java.
6. Statically Typed
In general, a statically typed language like Java prevents programmers from doing bad things, while, with a dynamic language like Python, you only know about a bad thing when you run the program.
Scala has the best of both worlds. It feels dynamic, but it’s strongly statically typed. The Scala compiler is really smart and uses type-inference to its fullest extent.
Scala provides type inference for variables and functions, much better than the limited type inference in Java and C#.
7. Growing Frameworks
One thing you might know about the ecosystem is that Scala is growing. There are lots of good libraries and frameworks coming around.
Companies that have started using Scala are also contributing to the recent growth of Scala as a mainstream language.
There are some nice Scala web frameworks out there
Comments