The Most Common Scala Myths Debunked

Author Image

Wojciech Mazur

Tooling Software Developer

13 minutes read

At VirtusLab, we stand for the truth. Phew! Those words convey a strong moral attitude and also seem a little absurd! So, what exactly do we mean?

We like to help folks grasp Scala as it’s a field where we have significant expertise. As a part of this, we strive tirelessly to ensure accurate information and constructive perspectives are readily available. This essay dispels several very substantial myths that we have seen circulating the blogosphere. For each debunked myth, we present an alternative viewpoint backed up by data from reliable sources. 

We hope it is of use to you 🙂

Working with Scala requires mega-analytical skills

The first stereotype originated probably from the domain which made Scala famous in the first place – big-data distributed computing using Apache Spark or other similar frameworks. However, working in these areas needs analytical skills, but it does not mean it’s crucial for every Scala project.

The Scala language has a simple syntax and is successfully used in many areas, including a highly-concurrent backend for web services based on libraries like akka-http, finagle or Play framework, processing pipelines using akka or fs2, or – more recently – as a scripting language when using Ammonite or scala-cli, especially with Scala 3. Moreover, it is getting traction in frontend development too – you can use it with Scala.js, which compiles Scala to JavaScript. In my opinion, none of these needs expert-level analytical skills.

Scala requires a solid understanding of functional programming

Scala is a hybrid of object-oriented and functional programming paradigms. That does not mean you need to be a master of both. For example, many Scala developers do not know what a functor, monad or semigroup is or whether a given data structure is covariant, contravariant, or invariant. Many of them don’t even know that such concepts exist! 

If you have worked with object-oriented or procedural languages before, you can start using Scala in the same way. For a starter, you can try to use some of the simpler libraries, which don’t require a strong knowledge of functional programming. A good example might be some, of Li Haoyi’s libraries which typically are ports of Python popular tools, like cask – a simple HTTP server based on the Flask framework. As you progress with Scala, you’ll find yourself absorbing basic functional paradigms as you go, and finally, when you’ll feel comfortable with plain Scala, you might try some of the more advanced functional libraries like cats or ZIO, which are popular choices for a bit more complex projects. 

Many modern versions of object-oriented languages like Java 8 have already included the same basics of functional programming, e.g. by introducing lambda expressions or functions taking another function as a predicate – Scala just makes usage of them a lot easier. There are plenty of Java-to-Scala transition tutorials, you check this one or the one in the Scala documentation to see that the basics of Scala are no different than in any other programming language. 

Scala syntax is strange and difficult

Scala is a very flexible language – in my opinion, it has a very simple basic syntax which makes it a great candidate for beginners choosing it as their first programming language. At the same time, this language is capable of providing a powerful set of tools for the experts. Most of the users of Scala are sticking to the basic syntax which can be learned within a few minutes, you can find a quick tutorial here or a cheat sheet with basic syntax on the Scala website. 

There was a time when abstract symbolic operators were popular in Scala. However, those naming conventions have been highly deprecated and are best avoided. The early versions of Scala tried to imitate other functional languages’ syntax, like Haskell, to attract users and make their transitions easy. However, symbolic operators were hard to understand and remember for newcomers. Since then, Scala’s last few major releases have all featured descriptive naming of methods.

How about an example? Let’s have a list of strings for which we would like to count the total length of all elements. We can use the common `foldLeft` method on the sequence, which takes an initial state and a binary operator as an argument. When using symbolic syntax, we would see the following code, which is confusing, especially for less experienced developers.

java

(0 /: list)(_ + _.length)

Whereas, with more verbose, commonly used syntax, we can simply write

java

list.foldLeft(0){ (sum, string) => sum + string.length }

or when using a wildcards

java

list.foldLeft(0)(_ + _.length)

Not everyone can understand Scala’s “magic”

Magic is an ambiguous concept at the best of times! True: It is entirely possible to use Scala as an alternative to other languages, such as Java or Python while disregarding the functional aspects. Also true: by disregarding the functional aspects, you may miss the best that Scala has to offer! In my opinion, investing some time to get a solid understanding of the functional aspects will make you a better developer.

If you tried Scala in the past and are sceptical about it, you should try again – especially with the latest Scala 3, which brings completely new idioms to the language. 

Today, Scala has clean and easy-to-understand implicit values, better enums, and a more expressive system. It also comes with a complete rewrite of Scala metaprogramming, which is now one of the best in the industry. Last but not least, issues with backward compatibility have been solved, which was one of the main problems with Scala 2 when migrating to newer versions. One of the best resources to learn Scala is precipitating the free online course taught by Martin Odersky (the creator of Scala) and his team.

I’d like to share my discovery of ‘the magic of Scala’ with you. When I started working as a junior developer, I appreciated immutability by default, the implicit type resolution, expressiveness and chaining of collection operations, and the ease of work with concurrency. Those few elements made me fall in love with Scala; they made my code concise, readable, and easy to understand. Moreover, I see them as Scala’s most significant advantages on the micro-scale, e.g., in single class functions.

As my experience grew, I learned how implicit work and I’ve started to use them in a safe manner in my code, e.g. to pass some context in the application or to extend existing types with some additional methods. In my opinion, Scala implicits are way easier to maintain than auto-magical code injects known from popular Java frameworks, like Spring, because their scope can be limited and IDE can help you to track their usages. It was way easier to test and debug! Also, I learned about types derivation and metaprogramming at that time, which allowed my team to remove additional boilerplate code. We could then focus on our model and logic instead of getting tangled up in supplementary code. 

I believe the functional aspects of Scala really start to shine when the size and the complexity of the project grow. By favouring the pure functions (functions without any external effects where the same input always yields the same output), you’re able to compose your building blocks with ease and you can be sure that they would always behave as you expected. Using higher-kinded types, you’re able to generalize your code. Last but not least, by using referential transparency, you can abstract over some values and introduce powerful optimizations without introducing any overhead.

Scala is a dying language with no future

No, it’s not true. The need for Scala developers is higher than ever before. Scala is still one of the top languages for distributed computing using Apache Spark and processing pipelines when using Akka. Besides these long-standing projects, we can also see younger projects storming the Scala community. For example, just 4 years ago, the ZIO and cats-effect libraries were introduced to the Scala community. Both are now the most common asynchronous and concurrent programming choices in Scala. Another example of a recent, successful project is Caliban – a functional GraphQL server and client library. The success of the mentioned projects follows their purely functional approach, allowing safe error handling and easy composition with other building blogs.

It’s true that some companies are replacing Scala with other languages, but that is due mainly to a shortage of experienced Scala developers. In the last few years, we can see that Scala developers are at the top of the salary rankings, and to fulfil demand, you can even find free boot camps or language transition offers.

The Scala community is elitist and closed off

I would never think about the Scala community being closed. True, it is much smaller than the Java, PHP, or Python community, but it welcomes newcomers. There are plenty of conferences, workshops, and meetups, both face to face and online, where you may learn and give talks, and high-five some of the best-known people in the community and beyond. 

Is this group elite? I don’t think so. Everyone can join it. The idea might have originated when, in the ~2010 Scala boom, many senior developers from Twitter and other large tech companies were using Scala. Unfortunately, those reports far outweighed the news of smaller companies that were starting to use Scala.

The Scala community is very narcissistic

In my opinion, every programming language community has some people who make a lot of noise and generate bad press. However, they’re typically only a tiny fraction of the community overall. Scala is no different, but these loud elements stand out more as the community is relatively small. I’ve heard stories of some troublesome members of the community, but I’ve never had a negative professional impression of anyone I’ve met in person. 

Also, because Scala was previously utilized mostly by the largest technology businesses, which hired only the most skilled people in Silicon Valley, we can presume that some of them had an over-supply of self-esteem.

To learn Scala, you must first learn sbt and a load of other strange tools

The sbt is a default build tool for working with Scala. For me personally, it’s the best build tool for mid-size Scala projects, with tons of features, multiple plugin extensions, and multi-scope configurations. According to GitHub stars statistics, it’s currently used in 74 out of 80 of the most popular Scala libraries. However, sbt is often challenging for newcomers who have used Maven or Gradle previously. Recently, many small projects have adopted Mill, a new build tool perfect for 1-5 module projects. In addition, configuring it is much easier, meaning you don’t need a long startup.

However, if you are new to Scala, I recommend you use scala-cli – a completely new tool made by VirtusLab. It’s a blazingly fast command-line tool, which will soon be a standard way of interacting with Scala. It’s perfect for working on single module projects or scripts using Scala.

Scala tooling is slow and hard to work with

I don’t think it’s true. Some of these rumors may have started as a misunderstanding of the tools. As mentioned previously, sbt, in contrast to Gradle or Maven, should be using its interactive shell instead of passing single commands from the command line. This allows for significant improvement in user experience since the initial start of the application can take a while. This common mistake was responsible for rumors about slow build times. However, we still need to remember that Scala has a way more complex type system than other JVM languages, with longer compilation times as a consequence. In most cases, Scala needs more time to compile than other languages.

Another myth about the slowness of Scala comes from the IDE used by developers. The most popular one, JetBrains IntelliJ, can take a significant amount of time before being ready to use, especially in large projects. Recently, there’s been a great alternative: Metals is a lightweight Scala language server that can be used with multiple text editors like VS Code, Vim, and Emacs – and it starts up quickly. It doesn’t take as many computer resources and, in many cases, it’s way faster. It’s not as fully-featured as IntelliJ, but in my opinion, for newcomers and small projects, it’s a good alternative. 

Many popular Scala tools are easy to set up and use. For example: `scalafmt` is a default choice for formatting your Scala code and enforcing its rules between project members. It comes with a decent default configuration, but you can precisely adapt it to match your needs. Another example might be `scalafix`: a refactoring and linting tool that allows you to easily create rules to modify your code. Both of these tools can be easily set up using `coursier`, which is a perfect choice for fetching artifacts and installing Scala-related tools on your machine.

The last word

We hope this article has helped guide you through the perilous landscape of opinions around Scala. VirtusLab routinely releases similar articles written by our engineering experts, you can find them here on our blog or on the Medium site. 

The myths were found and collected by Agnieszka Szyguła, our Talent Acquisition Specialist

Liked the article?

Share it with others!

explore more on

Take the first step to a sustained competitive edge for your business

Let's connect

VirtusLab's work has met the mark several times over, and their latest project is no exception. The team is efficient, hard-working, and trustworthy. Customers can expect a proactive team that drives results.

Stephen Rooke
Stephen RookeDirector of Software Development @ Extreme Reach

VirtusLab's engineers are truly Strapi extensions experts. Their knowledge and expertise in the area of Strapi plugins gave us the opportunity to lift our multi-brand CMS implementation to a different level.

facile logo
Leonardo PoddaEngineering Manager @ Facile.it

VirtusLab has been an incredible partner since the early development of Scala 3, essential to a mature and stable Scala 3 ecosystem.

Martin_Odersky
Martin OderskyHead of Programming Research Group @ EPFL

VirtusLab's strength is its knowledge of the latest trends and technologies for creating UIs and its ability to design complex applications. The VirtusLab team's in-depth knowledge, understanding, and experience of MIS systems have been invaluable to us in developing our product. The team is professional and delivers on time – we greatly appreciated this efficiency when working with them.

Michael_Grant
Michael GrantDirector of Development @ Cyber Sec Company