TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Why is Java preferred over other programming languages in enterprise

3 点作者 mr_o47大约 2 年前

2 条评论

exabrial大约 2 年前
These are my opinions on why:<p>1) Speed. 3rd or 4th place behind Rust, C, CPP, etc. It&#x27;s orders of magnitude faster than dynamic scripting languages. It&#x27;s faster than the languages that were designed to replace like it Go and C#. For a place that owns it&#x27;s own hardware or doesn&#x27;t want $100k&#x2F;month AWS bills, speed is a good thing.<p>2) Lack of highly destructive footguns. It doesn&#x27;t mean you can&#x27;t do stupid things (collections memory leaks for instance), but it prevents entire classes of memory safety bugs.<p>3) Monitoring. It&#x27;s built in. Having an SNMP like interface built into the runtime is a powerful tool.<p>4) Debugger. There&#x27;s nothing quite like it in other languages. The JVM debugger is first class.<p>5) Testability. Given that &quot;everything is a virtual method&quot;, 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&#x27;t do this because of the nature of their compilation.<p>6) Backwards compatibility. The JVM Authors don&#x27;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.<p>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&#x27;m throwing a cheap punch, but this was just the first example I could think of.<p>And lastly, this is the most controversial one, but is the CDI Dependency Injection Framework. I wouldn&#x27;t use Java without CDI. It turns difficult tasks like storing state correctly into simple one liners. I&#x27;m ready to jump to Rust as soon as we get a CDI like framework for Rust.
评论 #35827596 未加载
db48x大约 2 年前
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.
评论 #35809511 未加载