Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Why is Java preferred over other programming languages in enterprise
3 points by mr_o47 on May 3, 2023 | hide | past | favorite | 4 comments


These are my opinions on why:

1) Speed. 3rd or 4th place behind Rust, C, CPP, etc. It's orders of magnitude faster than dynamic scripting languages. It's faster than the languages that were designed to replace like it Go and C#. For a place that owns it's own hardware or doesn't want $100k/month AWS bills, speed is a good thing.

2) Lack of highly destructive footguns. It doesn't mean you can't do stupid things (collections memory leaks for instance), but it prevents entire classes of memory safety bugs.

3) Monitoring. It's built in. Having an SNMP like interface built into the runtime is a powerful tool.

4) Debugger. There's nothing quite like it in other languages. The JVM debugger is first class.

5) Testability. Given that "everything is a virtual method", one can truly do unit testing using frameworks like Mockito, where precisely one change is controlled at a time. Dynamic languages can actually do this trick too, but Java beats them on speed. Faster languages can't do this because of the nature of their compilation.

6) Backwards compatibility. The JVM Authors don't deprecate and rewrite things every 6 months. Any changes to the JVM are a slow intentional process to make sure things break as little as possible. For an enterprise making an investment, this is a highly attractive quality.

From a cultural take on that subject, there are Node packages on my machine published 6 months ago that are fully deprecated because the author rewrote them. I want to avoid sounding like I'm throwing a cheap punch, but this was just the first example I could think of.

And lastly, this is the most controversial one, but is the CDI Dependency Injection Framework. I wouldn't use Java without CDI. It turns difficult tasks like storing state correctly into simple one liners. I'm ready to jump to Rust as soon as we get a CDI like framework for Rust.


Lot's of great points. As a hiring manager for me it's:

  Easy to hire for
  Has great tooling/monitoring
  Supports large teams working on a project
  Fast (not the fastest but plenty fast)
Even the downsides are well known - yes it's verbose, harder to get started with, prone to over architecting


Mostly marketing. The adoption of C++ and Java were both the result of extensive marketing efforts. Magazines, trade shows, college courses, etc, etc. All paid for Microsoft, Sun and Oracle.


(LOL, nods)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: