logoalt Hacker News

cbeachlast Wednesday at 6:46 PM2 repliesview on HN

Scala is a fantastic language and in fact I'd say it's the language that proves the article wrong.

Java was the language where "write libraries instead" happened, and it became an absolute burden. So many ugly libraries, frameworks and patterns built to overcome the limitations of a simple language.

Scala unified the tried-and-tested design patterns and library features used in the Java ecosystem into the core of its language, and we're better off for it.

In Java we needed Spring (urghh) for dependency injection. In Scala we have the "given" keyword.

In Java we needed Guava to do anything interesting with functional programming. FP features were slowly added to the Java core, but the power and expressivity of Java FP is woeful compared what's available at the core of Scala and its collections libraries.

In Java we needed Lombok and builder patterns. In Scala we have case classes, named and default parameters and immutability by default.

In the Java ecosystem, optionality comes through a mixture of nulls (yuck) and the crude and inconsistently-used "Optional". In Scala, Option is in the core, and composes naturally.

In Java, checked exceptions infect method signatures. In Scala we have Try, Either and Validated. Errors are values. It's so much more composable.

There's so much more - but hopefully I've made the point that there's a legitimate benefit in taking the best from a mature ecosystem and simple language like Java and creating a new, more elegant and complete language like Scala.


Replies

kelnoslast Thursday at 5:26 AM

I think you misunderstood the article (or only read the first couple paragraphs). The author sets the stage with the statement in the article title (a quote heard from other people), but shows that those fancy language features in some languages are exactly why rich, easy-to-use libraries can be built. And that some of these rich, easy-to-use libraries simply cannot be built in some languages that lack those features.

So you don't actually disagree with the article.

jiballast Thursday at 11:58 AM

> the language that proves the article wrong

It helps to actually read it. The title is in quotes because the point of the article is to refute it.