The Scala debate demystified: Balancing the rants with the raves

Feature:

The Scala debate demystified: Balancing the rants with the raves

By Jason Tee

TheServerSide.com

What is it about Scala that creates such a chasm between ordinarily like-minded software developers? This ten year old programming language seems to bring out all of the fondest dreams and deepest frustrations of developers to the fore. Some love the language and look forward to using it in each new project, while others swear they will never touch it again. Even within a single organization, opinions can differ dramatically.

A scathing Scala review

When I'm reading Scala, I'm seeing about 60% of the code that's executable. But I've got no way of getting to the other 40%.

Giles AlexanderThoughtWorks developer

Giles Alexander, a lead developer at ThoughtWorks, had his first run-in with Scala in 2007, leaving him less than impressed. After a second harrowing experience with the programming language in 2013, he let the entire programming community know how he felt through a blog post that went viral. Even after the firestorm created by his expression of an honest opinion, he stands by most points in his one-star-review. Among his list of complaints were concerns with the excessive compile time, inconsistent and constantly changing libraries, and poor documentation.

However, one of his more interesting criticism had to do with the highly academic origins of the language. Scala's great in theory and certainly provides a great deal of opportunity for experimentation, but the transition to a production environment is fraught with issues. There's a disconnect between how things work in an academic setting and how developers actually get things done. For example, the language with its flexible syntax seems graceful because it conceals as much as it reveals, but such flexibility can become unwieldily, and what once seemed graceful can quickly become clumsy.

Lost in translation

Alexander likens the experience of using Scala to writing in CoffeeScript. CoffeeScript's easy to write, and a lot of superfluous syntactic verbosity disappears. But experienced JavaScript developers using such a language are basically translating back to JS in their minds as they go along. Alexander finds that with Scala, he's forced to do the same thing all the time, and despite working extensively with the language, the process never really went away. "When I was reading idiomatic Scala libraries and the code used to interact with those libraries, I wasn't getting the full story of the code on the screen." 

With JavaScript, this approach works fine because the language is small and simple. But the incredible flexibility and inconsistent applied rules in Scala make it much more challenging. "When I'm reading Scala, I'm seeing about 60% of the code that's executable. But I've got no way of getting to the other 40%. I can't run a tool and look at that and read it. Also, unlike JS, Scala is really quite a complex language. There's a whole bunch of things I need to know and be able to bring to mind to do this translation. That's the core of the problem I ran into."

Alexander also points to other unexpected ways in which Scala can increase the workload for development teams. For example, it might be necessary to construct code simply to hide syntax, a sure sign that's something's wrong. Or, developers may be forced to figure out large, elaborate types in order to add type annotations to help the compiler figure out things it should be able to infer without help. "My thinking isn't being assisted. In fact, I'm having to tell the computer what's going on." And Alexander is right; such a necessity hardly seems progressive.

Smoother sailing with Scala

But wouldn't you know it, one of Giles Alexander's fellow developers at Thoughworks takes quite the opposite stance on the language.  Jack Singleton, a senior software developer at ThoughtWorks, describes a much more gratifying experience with the Scala language. He says it's not about the language itself but the mind set of the people using it. "A lot of times, the decision of which language to use doesn't come down to what's best for the application. In reality, most applications aren't that different from one another. In my experience, it usually comes down to what type of culture you have, what kind of team you have, and how you like to develop software. I would recommend Scala to companies that are interested in the tools they are using and that enjoy working in tight-knit teams."

In Singleton's mind, Scala is the best fit for Java developers who can't stop thinking about a better way to do things. Instead of seeing Scala as an obstacle to getting the job done, they need to be excited about the challenge of learning a completely new way of thinking.

Growing pains

However, Jack does understand some of Alexander's frustrations, including Giles' concerns about the Scala libraries. Singleton has some gentle criticism for SBT, the largest and most popular Scala library. "It's still notorious for its use of symbols and deep dive into a functional way of expressing everything. When I'm working on a project for a client, trying to get functionality out the door, I don't want to have to dive into my build system and learn a whole new world and way of thinking just to get a task to run in my build. However, I think the guys behind SBT have learned that and are actively trying to improve it."

But Singleton is confident in the community's ability to focus on the readability and maintainability aspect of writing library code, rather than simply adding cool features. Perhaps when the language has been wrangled into a more standardized format, it will appeal to a broader set of developers.

Will Giles be convinced to give it another go a few years down the road? Time will tell. But one thing is for certain: beyond all the ranting and raving, Typesafe's Scala is a strong language that can take strong criticism. In fact, it's ten years of constructive commentary that has put the language in the enviable state that it currently finds itself: it is popular, it's scalable, it is proven, and its fan base continues to grow strong.

01 Mar 2014

Related Content

Related Resources