Hacker News new | ask | show | jobs
by ArnoVW 1867 days ago
Haven't upgraded Java since version 9, so take this with a cube of salt (my suspicion is that many hardcore Java haters were created by Java 5, 6 etc).. but my general issue is the readability. The idioms used to perform 'standard' things are verbose. The worst for me is that it's impossible to catch exceptions in lambdas. The absence of named or optional parameters.

Mind you, I'm only saying that after having spent 2 years in Kotlin. The Stockholm syndrom is real: you don't realize how much better things can be from the inside. Programming has become enjoyable again, my work 'feels' cleaner, more readable. Null safety makes reasoning about code that much easier. I can switch to functional programming when it's convenient. I keep all the tooling from Java, including the amazing IntelliJ IDE.

At the end of the day, choices are a matter of arbitration. Do I want the speed of C, the ecosystem and resource pool of Java, the locality / mathematical guarantees of functional languages, and the IntelliJ IDE? Sure. But they don't exist in one language.

So when I'm programming embedded, it's C. When I'm creating a complex data treatment pipeline for machine learning, it's Scala. And when I'm making a CRUD application that will have to support a team of 15 developers hacking on it for a decade, I'll go with Kotlin.

3 comments

>The worst for me is that it's impossible to catch exceptions in lambdas.

I don't take issue with your comment overall, but this is not true. You can catch exceptions within lambdas, and you can define functional interfaces that declare that they throw checked exceptions.

You're right. It's been a while and I forgot the exact issue. I looked it up on StackOverflow, to refresh my memory [1]. It is indeed possible to thow exceptions within a lambda.

My issue is that for something as everyday as "throwing exceptions", you have to define a separate interface, or catch it inside the lambda. The first option being the Evil Verbosity everyone is on about, the second essentially rendering the exception useless as an instrument.

[1] : https://stackoverflow.com/questions/18198176/java-8-lambda-f...

Java, in my experience of having to puzzle out a couple of large codebases in my career (that is, not having been a serious developer) is what happens when a couple of idioms run amok.

Inversion of control, interfaces, and OO make wandering a codebase feel like being lost in a bureaucracy.

Then we het to the issue of projects being coupled to IDEs. "Oh, this is an Eclipse project." "Oh, this is IntelliJ".

All of that chrome and tailfin leads to projects that take longer to boot than the OS.

The disdain for Java may be less about the language per se than the attendant mindset.

> Then we het to the issue of projects being coupled to IDEs. "Oh, this is an Eclipse project." "Oh, this is IntelliJ".

We use Maven projects, and edit them in whatever people prefer to use.

Yeah that's a weird complaint. Java build system situation is better than most other languages. Especially C++ is in stone age comparatively.
Maybe it was more historically true. Then there was the Ant vs. Maven vs. Gradle thing.

This would not be such a complaint (look at the explosion of build systems everywhere) if Java were less touted as "write once, run anywhere".

Build systems and configuration management are two hard problems.

Maven and gradle projects can depend on each other, are producing the same kind of artifacts and deploying them to the same repositories. And both can be used in any IDE you like.

And ant is prehistory.

In C++ they don't even have Maven equivalent (only thousands build systems but no universal way of naming/deploying/running projects or specifying dependencies).

In Python there's several maven-like systems that are incompatible and don't have the concept of universal project identifier or repositories.

In JS and Rust they basically copied the Maven system and changed it a little.

Clojure uses Maven wrappers with lispy syntax for pom files.

I struggle to find a language where this is solved better than in Java.

All the problems here are solved till Java 15 in every iteration. A lot of opinion in Java is based on comparing old versions of Java with latest version of other languages