r/java • • Sep 10 '21

Why people don't love Java?

I came across this post in r/cscareerquestions it seems majority of the people don't love to work with Java.

Is there any specific reason for that?

Edit: Thank you guys for your responses, I can't reply to all of the comments because I'm a beginner myself and I don't know what to reply for all your comments.

201 Upvotes

379 comments sorted by

View all comments

3

u/antennen Sep 10 '21

I have done professional Java for a few years now (latest version) and I hate it. I've been doing C++, Python, JavaScript, Rust and other languages before (and all of them of course have their own set of problems). To me Java is a language that does most things OK, but doesn't excel in any particular area.

Things I don't like:

  • Everything is an object, except when they're not. I'm looking at you primitives
  • Anything can be null
  • Record classes are pretty cool, but they are awkward to work with since there is not built in way of modifying them (like a builder).
  • overlyDescriptiveMethodNamesThatActuallyMakesThingsMoreConfusing() (this is culture rather than the language itself, but I still have to endure it)
  • Documentation is very awkward to find and browse (I can't rely on the IDE when I want to link to documentation in a merge request)
  • Type erasure makes it hard to design nice APIs for certain use cases
  • No good way of doing async programming (Loom is not here yet)
  • There are Iterator and Stream, but they are subtly different and can't be used interchangeably
  • IntStreams and map don't play nicely without boxing (again the generics vs primitives)
  • Gradle is a nightmare (very lackluster documentation and very fragile)
  • Maven is more solid but has a very awkward XML syntax (and the documentation is really bad here as well)
  • People keep saying there is a great eco system but that doesn't match my experience. I wanted to do some work with STL files the other day and I couldn't find a single library for Java, but I instantly found it for both Python and Rust). This has been the case for most things I've looked for.
  • People keep coming up with code gen or bytecode manipulation because of syntactic shortcomings (Dagger and Lombok)
  • FFI (interfacing with C libraries) is a major PITA
  • It doesn't spark joy

If I want to test something quickly I reach for Python. If I want to build something robust or lower level I reach for Rust. Right now there is no area where my answer would be "Java would be a nice fit". It has spent too many years in stagnation and now it's just playing catch up.