Linux之父:Java是糟糕的语言

引言

大约十年前,在一个比较轻松愉快的Linus(Linux之父)与粉丝的线下见面会上,Linus表示“Java is a horrible language”,上面的视频记录了这一切。十年来,Java的发展可以说是非常迅猛,如今已经是企业级开发必不可少的语言,那么大神Linus是否搞错了呢?

Linus是谁

林纳斯·本纳第克特·托瓦兹(Linus Benedict Torvalds, 1969年~ ),著名的电脑程序员。Linux内核的发明人及该计划的合作者。托瓦兹利用个人时间领导来自全世界的开源团队创造出了这套当今全球最流行的操作系统内核之一。此外,他制作的Git是目前最流行的代码版本控制工具。

国外的讨论

quora(外国知乎)与reddit(外国贴吧)以及其他网站有相关的讨论。试着翻译了一部分,供参考。

Historical reference: I started with Java in early 1995, it was in alpha. The big language at the time was C++. Compilers were expensive, Microsoft's being over 1,000 USD for some versions.
Java came out. Free compiler for several platforms. No pointers (remember NullPointerExceptions?) Java applets for web pages. I could write a network stack in three lines, vs. about 60 for C++.
It was a better and much needed language. I got Sun Certified. I programmed in it for about the next 10 years, I still do sometimes. Languages like Python, Ruby and Go are also great. We no longer pay for compilers. We have free training online. There is community support.
Bottom line, use the language that's appropriate. If you have a legacy Java app, keep using it, it's still a good language. Stop believing there is one ideal language.

本人自1995年开始使用Java,当时最火的语言是C++,但编译器非常昂贵。Java出现后,可以免费在各个平台运行,没有指针,三行代码即可写出网络组件,而用C++需要至少60行。

---reddit用户

Linus says that from perspective of kernel developer.
Just look at Java. High level, JIT compiled, no pointer arithmetic, full memory safety. Great language for userland and server applications - not fit for kernel.
That's very uneducated to take that out of context and post here. Linus "hates" pretty much any language that isn't fit for kernel development.
OP is a bundle of sticks.

Linus是从一个操作系统内核开发者的角度说这话。看看Java,高级语言、JIT、无指针、内存安全。对于用户和服务端都是非常好的语言,但并不适合内核开发。

---另一位reddit用户

OP may be a bundle of sticks, but a kernel Dev is not the only one who feels this way.
Java is a horrible language, even from an application point of view. The OO approach in Java is so cumbersome. The entire paradigm of Java style OO is fundamentally flawed and long since abandoned by other communities. Even C++ has adopted a more usable framework than the archaic OO in Java.
Parallel/async in Java is annoyingly implemented. This is ever a more important aspect for modern arch as we move towards higher core computing. Unless there has been a significant update, this entire feature feels like a half baked afterthought.
The standard library structure has some benefits in theory, but in practice ends up extremely bloated and the functionality is too opaque to do serious optimizations. I have spent many hours of my life converting Java standard libs to use custom implemented structures for optimizations. One of the worst things is you aren't allowed to implement some operators that the library implements so it is almost impossible to write drop in replacements and you are forced to refactor hundreds to thousands of lines of code. This just makes the entire language difficult to use at scale.
Those are some basic gripes with the language, there are a lot of other problems with Java. There exist many other languages that are just better suited for application development, Java was only first.

即使不是从事内核开发,也感觉Java是个糟糕的语言。Java的面向对象非常笨重。Java的面向对象编程范式已经被其他社区遗弃了。甚至C++已经引入比古老的Java面向对象更加易用的框架。

并发和异步在Java中的使用是非常烦人的。这在现代越来越多使用多核高并发的架构时更为重要。除非有个非常大的更新,目前的整个并发和异步特性就像一个半熟的马后炮想法。

标准库的结构在理论上有一些好处,但是在实践中最终会变得臃肿,并且功能太不透明,无法进行严肃的优化。我花了很多时间来转换Java标准库,以使用自定义实现的结构进行优化。最糟糕的事情之一是不允许您自己实现库已经实现的某些运算符,因此几乎不可能写掉替换项,并且您不得不重构成百上千行代码。这只会使整个语言难以大规模使用。

这些是该语言的一些基本技巧,Java还有许多其他问题。 还有许多其他语言更适合于应用程序开发,而Java曾经是唯一的,但现在不是。

---另一位reddit用户

Java and Linux emerged at roughly the same time. They were both hugely important in the move from proprietary systems to open systems. Using them both in the mid-90s, I can tell you that Java was, for its time, beautiful and amazing — even early on! — and Linux was just a disaster. They have both aged very well, though, and we're lucky for it.

Java和Linux大致同时出现。在从专有系统到开放系统的转变中,它们都非常重要。我可以在90年代中期同时使用它们,我可以告诉您Java在当时是美丽而令人惊叹的! —而Linux当时只是一团糟。但是他们俩的后续发展都很好,我们为此感到幸运。

---quora用户

I think that’s the typical sort of thing Linus would say about just about anything.
Linus has created two free tools (Linux and Git) that are used by billions of people. This has elevated him to the status of demigod in the open-source community and have left him a little bit arrogant. Okay, more than a little bit.
He is, by own admission, not a very pleasant person. He loves to provoke and piss people off. He often exaggerates wildly to get his point across. And then people listen, because it’s Linus.
Is Java a horrible language? Well, millions of developers would disagree. It’s the most used programming language in the world, after all. Java has its flaws and disadvantages like any other language, but according to majority opinion it’s really useful for the most part.

我认为那是Linus关于任何事情都会说的典型的话。

Linus创建了两个免费工具(Linux和Git),数十亿人都在使用它们。 这使他在二手手机买卖开源社区中的地位上升到半神,这使他有些自大。 好吧,不止一点。

坦白说,他不是一个非常令人愉快的人。 他喜欢惹人生气。 为了阐明自己的观点,他经常夸大其词。 然后人们会倾听,因为它是Linus。

Java是一种可怕的语言吗? 好吧,数百万的开发人员绝不会同意。 毕竟,它是世界上使用最广泛的编程语言。 Java与其他任何语言一样都有其缺点和劣势,但是根据大多数人的看法,它在大多数情况下确实很有用。

---quora用户

国内的讨论

国内对Linus喷Java的事的讨论较少,有人在讨论Linus喷C++的事件时提到了喷Java的事情。没错,Linus本人多次在各种场合多次喷C++语言。

Linus言论特点

Linus在言论中多次提到crap,horrible

Linus_Torvalds部分语录

C++is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it.

  • Torvalds, Linus (2007-09-06). Message to gmane.comp.version-control.git mailing list. Retrieved on 2007-09-22.

I thinkLeopardis a much better system [than Windows Vista] … but OS X in some ways is actually worse than Windows to program for. Their file system is complete and utter crap, which is scary.

  • "linux.conf.au conference". 2008-02-05.

Gcc is crap.

  • Torvalds, Linus (2006-11-28). Re: [PATCH] Don't compare unsigned variable for <0 in sys_prctl(). Retrieved on 2010-09-20.

Microsoft isn't evil, they just make really crappy operating systems.

  • Torvalds, Linus (2013-01-29). Linus Torvalds on Twitter. Retrieved on 2016-07-26.

There aren't enough swear-words in the English language, so now I'll have to call you perkeleen vittupää just to express my disgust and frustration with this crap.

  • Torvalds, Linus (2013-07-13). Re: [GIT pull] x86 updates for 3.11. Retrieved on 2013-07-15.

XML is crap. Really. There are no excuses. XML is nasty to parse for humans, and it's a disaster to parse even for computers. There's just no reason for that horrible crap to exist.

  • Torvalds, Linus (2014-03-06). Linus Torvalds - Google+ (As a reply in the comments section). Retrieved on 2014-03-07.

My personal opinion of Mach is not very high. Frankly, it's a piece of crap. It contains all the design mistakes you can make, and even managed to make up a few of its own.

  • 《Just for fun》

总结

很多大神是非常有水平的,说出的话也很有启发,但Linus这句Java是horrible的,似乎只是他口头禅的自然流出,并无太大意义。Linus本人的历史言论表明他是一个喜欢爆粗口的人,喷的语言或公司多如牛毛,无需太在意。如今Java的地位无法被撼动,依旧是企业级开发的最主流语言。

您怎么看,欢迎留言!

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值