Are You a Java Developer ? Start thinking Scala
R U a Java Developer? Starting thinking Scala

Are You a Java Developer ? Start thinking Scala

Java, the legendary programming language came into existence about 20 years ago. It had solutions to a number of technical and development problems troubling the developer community at that time. Fast forward 20 years – it is the most widely used and preferred language for a variety of applications including areas like mobile which did not exist when the language was created. It’s hard to find a developer who hasn’t coded in this language.

Is it still the best? Mostly Yes. But there are definitely areas where the language can be developer friendly. So, Martin Odersky and a few folks got together to build a new language that builds upon Java, but removes a number of its pain points and improve productivity. That language is Scala. You would have already heard and read about it. But is it something that you can start adapting in your code, projects and enterprise? Read on for answers. What does Scala bring to the table?

1.  Less Code, more productivity

If you are Java developer like me, you would have been frustrated by the fact that everything has to be explicitly spelled out (or did you even notice?). From using a statement terminator (the semi-colon!) to data type specification for every declaration to writing endless setter and getter code, Java wants you to be explicit. The first and significant help Scala provides is this; it can implicitly determine a number of things – statement completions, data types etc. It can provide capabilities – like setters and getters without extra coding. It is still type safe. That means less code to write. Less code to test. An average of 50% reduction is what we hear. Managers – taking notice?

2.  Friendlier features

Scala creators added features that are more practical and needed for developers. OOP capabilities like Traits, Case Classes and Abstract classes with implementations reduce unnecessary super and sub-classes that are needed otherwise. Having functions as first class objects simplify code. Combining them with new capabilities in collections (e.g.: map, reduce and filter) makes code crisp, easy to understand and delegate. It makes Scala a friendlier language for processing data. Futures and Promises add a new dimension to concurrent programming. Scala supports both Functional and OOP styles. All this helps to make your code developer friendly. The Scala interpreter is a great tool for the developer to test intermediate code rather than run the full application or write test suites. If you haven’t yet, give Scala a try.

3.  Java Interoperability

Perhaps this is the most appealing feature for Java developers. Scala is a JVM language. Once compiled, it generates byte-code that runs on a standard JVM. You can import and use all Java libraries within Scala without missing a beat. Scala has Maven and SBT support. Your project can have both Scala and Java code. This provides you a great migration path to move from Java to Scala in your existing projects. You don’t have to redevelop from scratch. Rather build new features in Scala while migrating existing code at your own set pace (You don’t have to).

4.  The Eco-System

Many new open source projects and startups have started using Scala as their development language. Apache Spark and Kafka are some examples. Companies like LinkedIn, Twitter etc. use Scala. An array of third party open source libraries exist for standard capabilities; Slick for ORM, scalaxb for XML, Play framework for web development and Akka for concurrent programming to name a few. BTW, you can still use legendary Java libraries like Spring Framework and Hibernate with Scala. More such libraries are in the works.

5.  Deployment

Scala applications are deployed the same way you deploy Java. Compile into jars, add dependent jars to class path, deploy on a Java application Server etc. Scala benefits from all the run time capabilities the JRE offers like memory management and monitoring. Your Operations folks don’t have learn anything new to deploy and manage Scala applications.

If you are a developer, you benefit from better code and better capabilities. If you are a company, you benefit from better developer productivity. I think it’s worth giving Scala a try if you haven’t done already. 

To view or add a comment, sign in

More articles by Kumaran Ponnambalam

Insights from the community

Others also viewed

Explore topics