Java的外衣

Paul Graham 2001-04-01

Java的外衣

2001年4月

这篇文章源于我与几位程序员关于Java为何气味可疑的对话。这不是对Java的批判!这是黑客雷达的一个案例研究。

随着时间的推移,黑客对好(和坏)技术培养出了一种嗅觉。我想试着写下是什么让Java对我来说似乎可疑,这可能会很有趣。

一些读过这篇文章的人认为这是试图以前所未有的方式写一些有趣的事情。其他人说我将因为看起来写我不理解的东西而陷入麻烦。所以,以防万一有任何好处,让我澄清我在这里不是在写Java(我从未使用过),而是在写黑客雷达(我对此思考很多)。

“不能凭封面判断一本书”这句格言起源于书籍用普通纸板封面出售的时代,由每个购买者根据自己的品味装订。在那个时代,你不能凭封面判断一本书。但出版业从那时起进步了:现在的出版商努力使封面成为你可以判断一本书的依据。

我花了很多时间在书店,我觉得我现在已经学会理解出版商想要告诉我关于一本书的一切,可能还有更多。我没有在书店度过的时间主要花在电脑前,我觉得我在某种程度上已经学会了通过封面来判断技术。这可能只是运气,但我已经让自己避免了一些最终被证明是真正糟糕的技术。

到目前为止,Java对我来说似乎很糟糕。我从未写过Java程序,从未看过关于它的参考书,但我有一个预感,它不会是一种非常成功的语言。我可能被证明是错的;对技术做出预测是危险的事情。但作为某种时间胶囊,就其价值而言,这就是为什么我不喜欢Java的外观:

  1. 它被如此热情地炒作。真正的标准不需要被推广。没有人需要推广C、Unix或HTML。真正的标准在大多数人听到它之前就已经建立了。在黑客雷达屏幕上,Perl和Java一样大,或者更大,仅仅是凭借自身的优点。

  2. 它的目标很低。在最初的Java白皮书中,Gosling明确表示Java的设计对习惯C的程序员来说不会太困难。它被设计成另一个C++:C加上一些从更高级语言中借来的想法。就像情景喜剧、垃圾食品或包价旅游的创造者一样,Java的设计者有意识地为不如他们聪明的人设计产品。历史上,为他人使用而设计的语言都很糟糕:Cobol、PL/I、Pascal、Ada、C++。好的语言是那些为自己的设计者设计的:C、Perl、Smalltalk、Lisp。

  3. 它有不可告人的动机。有人说过,如果人们只在有话要说时才写书,而不是因为想写书,世界会变得更美好。同样,我们一直听到Java的原因不是因为它对编程语言有什么要说的。我们听到Java作为Sun公司削弱微软计划的一部分。

  4. 没有人喜欢它。C、Perl、Python、Smalltalk和Lisp程序员都喜欢他们的语言。我从未听任何人说过他们喜欢Java。

  5. 人们被迫使用它。我认识的许多使用Java的人使用它是因为他们觉得必须这样做。要么是他们觉得为了获得资助必须这样做,要么是他们认为客户会想要,要么是管理层告诉他们要这样做。这些都是聪明人;如果技术好,他们会自愿使用它。

  6. 它有太多的厨师。最好的编程语言是由小团体开发的。Java似乎是由一个委员会管理的。如果它最终成为一种好语言,这将是历史上委员会第一次设计出好语言。

  7. 它是官僚主义的。据我对Java的一点点了解,似乎有很多做事的协议。真正的好语言不是那样的。它们让你做你想做的事,然后让路。

  8. 它是伪时髦的。Sun现在假装Java是一种像Perl或Python那样的草根、开源语言努力。这个恰好由一家大公司控制。所以这种语言很可能具有与大公司生产的任何东西相同的单调笨重。

  9. 它是为大型组织设计的。大型组织的目标与黑客不同。他们想要适合大型平庸程序员团队使用的语言——具有像U-Haul卡车中的限速器那样的功能,防止傻瓜造成太大损害。黑客不喜欢对他们居高临下的语言。黑客只想要力量。历史上,为大型组织设计的语言(PL/I、Ada)都失败了,而黑客语言(C、Perl)获胜了。原因:今天的青少年黑客是明天的CTO。

  10. 错误的人喜欢它。我最钦佩的程序员整体上没有被Java迷住。谁喜欢Java?西装革履的人,不知道一种语言与另一种的区别,但知道他们在媒体上不断听到Java;大公司的程序员,惊讶地发现还有比C++更好的东西;以及即插即用的本科生,准备好喜欢任何可能让他们找到工作的东西(这会考试吗?)。这些人的意见随风而变。

  11. 它的爸爸陷入困境。Sun的商业模式正受到两方面的侵蚀。与台式机相同类型的廉价Intel处理器现在对服务器来说已经足够快了。而且FreeBSD似乎至少与Solaris一样适合作为服务器操作系统。Sun的广告暗示你需要Sun服务器用于工业级应用程序。如果这是真的,Yahoo会第一个排队购买Sun;但当我在那里工作时,服务器都是运行FreeBSD的Intel盒子。这对Sun的未来是个坏兆头。如果Sun遇到麻烦,他们可能会把Java拖下水。

  12. 国防部喜欢它。国防部鼓励开发者使用Java。这在我看来是最 damning 的迹象。国防部的国防工作做得很好(虽然昂贵),但他们喜欢计划、程序和协议。他们的文化与黑客文化相反;在软件问题上他们往往会下错注。国防部最后一次真正喜欢一种编程语言是Ada。

请记住,这不是对Java的批判,而是对其外衣的批判。我对Java的了解还不足以喜欢或不喜欢它。这只是为什么我不觉得急于学习它的解释。

在尝试用一种语言编写程序之前就将其 dismissed 可能看起来 cavalier。但这是所有程序员都必须做的事情。外面的技术太多了,无法全部学习。你必须学会通过外部迹象来判断哪些值得你花时间。我同样 cavalier 地 dismissed 了Cobol、Ada、Visual Basic、IBM AS400、VRML、ISO 9000、SET协议、VMS、Novell Netware和CORBA等。它们只是气味不对。

在Java的情况下我可能错了。可能一种由一家大公司推广以削弱另一家大公司、由委员会为”主流”受众设计、被炒作到天际、国防部喜欢的语言,碰巧是一种我会喜欢编程的干净、美丽、强大的语言。可能,但这似乎非常不可能。

Trevor Re: Java’s Cover | Berners-Lee Re: Java | Being Popular | Sun Internal Memo | 2005: BusinessWeek Agrees

日语翻译

Java’s Cover

April 2001

This essay developed out of conversations I’ve had with several other programmers about why Java smelled suspicious. It’s not a critique of Java! It is a case study of hacker’s radar.

Over time, hackers develop a nose for good (and bad) technology. I thought it might be interesting to try and write down what made Java seem suspect to me.

Some people who’ve read this think it’s an interesting attempt to write about something that hasn’t been written about before. Others say I will get in trouble for appearing to be writing about things I don’t understand. So, just in case it does any good, let me clarify that I’m not writing here about Java (which I have never used) but about hacker’s radar (which I have thought about a lot).

The aphorism “you can’t tell a book by its cover” originated in the times when books were sold in plain cardboard covers, to be bound by each purchaser according to his own taste. In those days, you couldn’t tell a book by its cover. But publishing has advanced since then: present-day publishers work hard to make the cover something you can tell a book by.

I spend a lot of time in bookshops and I feel as if I have by now learned to understand everything publishers mean to tell me about a book, and perhaps a bit more. The time I haven’t spent in bookshops I’ve spent mostly in front of computers, and I feel as if I’ve learned, to some degree, to judge technology by its cover as well. It may be just luck, but I’ve saved myself from a few technologies that turned out to be real stinkers.

So far, Java seems like a stinker to me. I’ve never written a Java program, never more than glanced over reference books about it, but I have a hunch that it won’t be a very successful language. I may turn out to be mistaken; making predictions about technology is a dangerous business. But for what it’s worth, as a sort of time capsule, here’s why I don’t like the look of Java:

  1. It has been so energetically hyped. Real standards don’t have to be promoted. No one had to promote C, or Unix, or HTML. A real standard tends to be already established by the time most people hear about it. On the hacker radar screen, Perl is as big as Java, or bigger, just on the strength of its own merits.

  2. It’s aimed low. In the original Java white paper, Gosling explicitly says Java was designed not to be too difficult for programmers used to C. It was designed to be another C++: C plus a few ideas taken from more advanced languages. Like the creators of sitcoms or junk food or package tours, Java’s designers were consciously designing a product for people not as smart as them. Historically, languages designed for other people to use have been bad: Cobol, PL/I, Pascal, Ada, C++. The good languages have been those that were designed for their own creators: C, Perl, Smalltalk, Lisp.

  3. It has ulterior motives. Someone once said that the world would be a better place if people only wrote books because they had something to say, rather than because they wanted to write a book. Likewise, the reason we hear about Java all the time is not because it has something to say about programming languages. We hear about Java as part of a plan by Sun to undermine Microsoft.

  4. No one loves it. C, Perl, Python, Smalltalk, and Lisp programmers love their languages. I’ve never heard anyone say that they loved Java.

  5. People are forced to use it. A lot of the people I know using Java are using it because they feel they have to. Either it’s something they felt they had to do to get funded, or something they thought customers would want, or something they were told to do by management. These are smart people; if the technology was good, they’d have used it voluntarily.

  6. It has too many cooks. The best programming languages have been developed by small groups. Java seems to be run by a committee. If it turns out to be a good language, it will be the first time in history that a committee has designed a good language.

  7. It’s bureaucratic. From what little I know about Java, there seem to be a lot of protocols for doing things. Really good languages aren’t like that. They let you do what you want and get out of the way.

  8. It’s pseudo-hip. Sun now pretends that Java is a grassroots, open-source language effort like Perl or Python. This one just happens to be controlled by a giant company. So the language is likely to have the same drab clunkiness as anything else that comes out of a big company.

  9. It’s designed for large organizations. Large organizations have different aims from hackers. They want languages that are (believed to be) suitable for use by large teams of mediocre programmers— languages with features that, like the speed limiters in U-Haul trucks, prevent fools from doing too much damage. Hackers don’t like a language that talks down to them. Hackers just want power. Historically, languages designed for large organizations (PL/I, Ada) have lost, while hacker languages (C, Perl) have won. The reason: today’s teenage hacker is tomorrow’s CTO.

  10. The wrong people like it. The programmers I admire most are not, on the whole, captivated by Java. Who does like Java? Suits, who don’t know one language from another, but know that they keep hearing about Java in the press; programmers at big companies, who are amazed to find that there is something even better than C++; and plug-and-chug undergrads, who are ready to like anything that might get them a job (will this be on the test?). These people’s opinions change with every wind.

  11. Its daddy is in a pinch. Sun’s business model is being undermined on two fronts. Cheap Intel processors, of the same type used in desktop machines, are now more than fast enough for servers. And FreeBSD seems to be at least as good an OS for servers as Solaris. Sun’s advertising implies that you need Sun servers for industrial strength applications. If this were true, Yahoo would be first in line to buy Suns; but when I worked there, the servers were all Intel boxes running FreeBSD. This bodes ill for Sun’s future. If Sun runs into trouble, they could drag Java down with them.

  12. The DoD likes it. The Defense Department is encouraging developers to use Java. This seems to me the most damning sign of all. The Defense Department does a fine (though expensive) job of defending the country, but they love plans and procedures and protocols. Their culture is the opposite of hacker culture; on questions of software they will tend to bet wrong. The last time the DoD really liked a programming language, it was Ada.

Bear in mind, this is not a critique of Java, but a critique of its cover. I don’t know Java well enough to like it or dislike it. This is just an explanation of why I don’t find that I’m eager to learn it.

It may seem cavalier to dismiss a language before you’ve even tried writing programs in it. But this is something all programmers have to do. There are too many technologies out there to learn them all. You have to learn to judge by outward signs which will be worth your time. I have likewise cavalierly dismissed Cobol, Ada, Visual Basic, the IBM AS400, VRML, ISO 9000, the SET protocol, VMS, Novell Netware, and CORBA, among others. They just smelled wrong.

It could be that in Java’s case I’m mistaken. It could be that a language promoted by one big company to undermine another, designed by a committee for a “mainstream” audience, hyped to the skies, and beloved of the DoD, happens nonetheless to be a clean, beautiful, powerful language that I would love programming in. It could be, but it seems very unlikely.

Trevor Re: Java’s Cover | Berners-Lee Re: Java | Being Popular | Sun Internal Memo | 2005: BusinessWeek Agrees

Japanese Translation