Why Prefer Scala Language

Scala
Reading Time: 2 minutes

Learning languages is really about concepts and how to effectively use them in practice. Scala has a lot of great concepts that are way better than mainstream.This is the main reason to prefer scala.

Scala was designed to look at how OO and functional could be combined in a language that started with the OO side. If you really want to do server-side work, Scala is established. The other space that is really fueling Scala adoption right now is big data analytics.

Where is Scala ?

Frameworks like Spark and Kafka are written largely in Scala. This is because of the quality of parallel support in the language, and at least with Spark,. If you really want to take full advantage of it, you should be writing code for it in Scala. Maybe too many, but you could get them little by little. Also, it comes with a ‘downside’ that a simpler language will feel limiting.

There are many Scala libraries out there for you to work with. And if they don’t do what you need, you can either have fun writing it yourself, or you can probably find a Java library to do it for you. Calling Java libraries from Scala is practically seamless.

Rumers

Pay no attention to comments about the Scala compiler’s speed. It’s not a factor in actual day-to-day work. If you’re using an IDE like IntelliJ/IDEA or Eclipse, you will know within have a second if you have made one of the majority of errors.

Missing (or ambiguous) implicits typically won’t show up until you try to build but, assuming you’re using something like sbt or maven, you’ll know about that within a couple of seconds.

Facts

The Scala folks are aware of the “slow” compiles—bear in mind that the compiler is doing a huge amount of work for you, compared with say the Java compiler—and are working on it. What all this extra work implies is that once you get your project building, it’s much more likely to run the way you expect than if you were using Java.

It’s a mash up of the best bits from a bunch of languages, what’s not to love:

  • Ruby’s terse syntax
  • Java’s performance
  • Erlang’s Actor Support
  • Closures/Blocks
  • Convenient shorthand for maps & arrays

Other Feature Fusion

Other features that work well together are case classes and pattern matching. This allowing you to easily build and deconstruct algebraic data types, without having to manually write all the tedious equality, hashcode, constructor and getter/setter logic that Java demands.

Specifying immutability by default, offering lazy values, and providing first class functions all combine to give you a language that’s very suited to building efficient functional data structures.

The list goes on, but I’ve been using Scala for over 3 years now, and I’m still amazed almost daily at how well everything just works together.

Just shortly:

  • Get the power and platform-independency of the Java libraries, but without the boilerplate and verbosity.
  • You will get the simplicity and productivity of Ruby, but with static typing and compiled bytecode.
  • You get the functional goodnesses and concurrency support of Haskell, but without complete paradigm shift and with the benefits of object-orientation.

Written by 

Vipul Kumar is Senior Software Consultant having 6years of experience. He has knowledge of languages like Functional Java, Scala, Akka, Akka-http. He is familiar with Object-Oriented Programming Paradigms and also has an interest in Functional Programming technologies. His hobbies include travelling, riding bikes and listening to music.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading