from Hacker News

Do You Really Know Java?

by flykespice on 5/29/25, 2:57 PM with 3 comments

  • by PaulHoule on 5/29/25, 3:44 PM

    I think concurrency support is underestimated today. It is so sad to see so many people say "concurrent programming is hard" when it is often trivial if you use an Executor -- meanwhile many languages push snake oil solutions such as Actors that usually don't work, that is, either you get a different answer every time you run them, or you only wind up with a 2x speedup when you have 16 cores.

    The idea that you can build systems with a limited number of types and operations is workable for many kinds of programming but it is absolute death for concurrent and distributed program. If you have 100 threads and you want them all to stop for synchronization and get woken up simultaneously, Java has a primitive for that. If you take that out of the toolbox then concurrent programming is easy, if you think for moral reasons it is better to write your own, you're screwed.

    When I started coding in Java I expected pthreads to 'just not work', just as I could never trust locks in POSIX. Instead of chasing CS research fads, Java has always been pragmatic. It also helps that Java has a xenophobia that distrusts native code, so Java started on day one with the concurrency features you need and a standard library you could trust 100% and led people to create a huge mass of concurrency friendly open source software in Java.