Scala developers say exceptions smell. At Samebug we use and love Scala and know why referential integrity is essential and why we avoid throwing exceptions. But as all developers, we know as well that in practice there is difference between theory and practice.

We love to challenge theoretic statements so we’ve decided to challenge the Scala community. We used samebug.io data containing exceptions collected from the Internet and libraries.io data for checking out libraries and their popularity.

Contestants

We’ve decided to compare three languages and their communities:

Java as the evergreen and mainstream language,

Kotlin as a promising newcomer that conquered the Android space

and Scala as the functional Java.

Methodology

We’ve decided to use the only valid measurement for code quality:

We compared two information pieces:

every stack trace we find on the Internet including frames of a library means a WTF related to that library — provided by samebug.io

the number of stars on a repository correlates to the popularity of the library — provided by libraries.io

The easiest way to compare contestants is to look at the ratio of stack traces to popularity. Since people love to click on small yellow stars but hate copying thousand-line stack traces, pasting them in a forum and asking others to help, we used thousands of stars: kStars. So our quality metrics become: WTF / kStars

The results

After loading data into Spark it was hard to join the two datasets. We found only a few correctly matching artifact ids (see the numbers at the end of the article). Anyway, we consider it a tiny random sample that can be used to compare the contestants.

The third is Java with 93 WTF/kStars

The second is Kotlin with 67 WTF/kStars

And the winner is Scala with 35 WTF/kStars

So we can tell that Scala developers are not hypocrites and they really cause much less headache for their users— at least when we talk about crashes.

Here is the data we used:

I would like to thank Andras Horvath for doing the research for this article.