Hacker News new | ask | show | jobs
by pacala 5057 days ago
> Why is it so horrible as a systems language above C?

* First class functions (interfaces with one method) plus garbage collector eventually encourage a functional programming style, with lots of little objects created on the heap. Alas, the per-object memory overhead of popular Java implementations is horrendous.

* Strong emphasis on using threads for concurrency. Alas, in practice, threads are incredibly large memory hogs.

* Verbosity. While it is possible to write clean composable code in Java, it is also remarkably verbose. After a while, this gets old and people take all shortcuts they can to limit verbosity. Which is a very bad idea. To quote an esteemed colleague, "I never took a shortcut I didn't regretted it later". Can we have our lambdas yet, pretty please?

2 comments

* If you are using the JVM's generational + concurrent garbage collectors, generally the hoards of little objects disappear without hiccups or leaving much of a footprint.

* My beef with threads for concurrency revolves not around memory footprint (can you substantiate threads as "memory hogs"?), but instead around the necessity to be mindful of resource sharing. Yes, the JDK gives you lots of useful tools in this quest, but it's still not all that difficult to end up with a deadlocked app.

Java's heavy syntax for anonymous classes and immutables actually discourages functional programming even when that's a strongly desired approach by the programmer.