Why learning Scala, JavaScript and Ruby will make you a better Java developer

Obviously a JVM stack developer is going to know Java. But in this world of polyglot programming, knowing a bit of JavaScript, Ruby and Scala as well is a must. In fact, it might even make you a better Java developer.

There was a time when TheServerSide.com was a site primarily focused on Java development, and for those wishing to do .NET development, there was TheServerSide.net as well. But the server-side landscape has changed significantly since this site was originally launched. Java still dominates on the back-end, there’s no doubt about that, but a good server-side developer needs to know more than the lingua franca of the JDK.

The question often arises as to which programming languages a software architect or application developer should know in order to not only be productive, but also to make themselves valuable on the open market, just in case the situation ever arises where they find themselves hitting up Monster.com, searching for a new job. In today's job market, it's not good enough to simply know a single programming language, especially in this age of polyglot development. A modern software developer working on the Java stack needs to know more than just Java, and it behooves every software developer to gain a certain level of competency in languages like JavaScript, Ruby and Scala, at the very least.

The right development languages to know

In 2016, knowing JavaScript is a must, not only because it is the universal language of the web browser, but also because of its increasing relevance in server-side frameworks like Node.js. In fact, Node has become so prevalent in modern software development that NetBeans, the popular open-source Java based IDE, has out of the box support for the language. Furthermore, JavaScript is the language upon which important libraries such as JQuery and DOJO are built, not to mention the frameworks such as bootstrap.js and PhoneGap which make mobile web development possible. The fact is, every modern software developer needs to have a basic understanding of the JavaScript language in order understand all aspects of a modern enterprise software solution.

Simplified scripting with Ruby

There is an old saying that to a man holding a hammer, everything looks like a nail. Similarly, a server side developer who only knows Java is going to over-complicate things if every problem they encounter gets solved by throwing byte-code at it. More and more organization, organizations that have successfully built impressive, full-scale enterprise application deployments using Java, are introducing their development teams to Ruby, a powerful language with a much less restrictive syntax, not to mention a rich assortment of plug-ins, or “Gems” as they are called in Ruby parlance, that make everything from connecting to remote servers to processing giant lists of data much easier. Beyond knowing Java and JavaScript, a good solution developer working in the enterprise Java space should also be familiar with a language like Ruby, knowing the various benefits it can bring to the table, and understanding why sometimes it’s better to solve a problem with a simple and concise Ruby script as opposed to a complicated and overly verbose Java class.

Understanding why Java doesn't scale

And finally, to be able to speak intelligently about a given enterprise software solution, a seasoned architect should know a thing or two about a peripheral JVM language like Scala. It's a difficult reality with which to grapple, but the fact of the matter is, Java simply doesn’t scale effectively. The manner in which Java manages data at runtime, having to traverse through large collections of objects while resolving a spaghetti like mess of shared pointers that link variables to their underlying data, slows the JVM down. As applications scale, this slow down becomes increasingly more pronounced. Interestingly enough, this inability of the language to scale linearly is a problem with the Java language, but not actually a limitation of the Java Virtual Machine itself. Linear scalability is indeed possible with the JVM, so long as the JVM is guided on how to manage the underlying data appropriately, and this is exactly what a peripheral JVM language like Scala does. Scala scales, and it scales along with the JVM, not in spite of it.

The benefits of learning Scala

There are other compelling reasons why a Java focused software developer should know Scala. The Java language isn’t perfect, and due to the global adoption Java has enjoyed over the past twenty years, changes to the language must be made slowly and diligently. Scala on the other hand first emerged about 10 after Java’s initial release, allowing it to incorporate a variety of new programming practices and tactics that simply weren’t considered best practices before the turn of the century. Functional programming, futures and actors are all incredibly powerful programming tools, especially when the development of a concurrent system is the end goal. These features have been baked into the Scala syntax since the very start, while the Java language is only just now starting to adopt them. Sure, Java 8 did introduce Lambdas, and Java 9 is looking to use an immutable data type to solve the pointer problem, but how long will it be before existing systems are migrated to those platforms? A feature introduced in the 2016 Java 9 release wont likely find itself in widespread use until 2020, if not later.

Even if you aren’t actively developing with it, the benefit of learning Scala is that it will not only teach you to be critical of how the Java programming language is implemented, opening your eyes up to some of the language’s shortcomings for which you may never have even been aware. And what’s more, Scala not only shines a light on these shortcomings, but it provides its own mechanisms to address them.

Java is an important language to know, but if it's the only language a developer knows, that developer isn't achieving their full potential. A well rounded JVM stack should not only know Java, but should be well versed in peripheral languages as well. Knowing languages like Scala, JavaScript and Ruby will inevitably make a Java developer more adept at their craft.

What do you believe to be the most important languages to know in todays world of polyglot programming? Let us know what you think.

Recommended Titles

Josh Suereth's Scala in Depth on Amazon.com
Martin Odersky Programming in Scala
Cay S. Horstmann's Scala for the Impatient
Martijn Verburg's The Well-Grounded Java Developer

Dig Deeper on Core Java APIs and programming techniques

App Architecture
Software Quality
Cloud Computing