Rock Star Josh Bloch
這是一篇前不久在JavaOne 2007期間(5月初)SDN(Sun Developer Network)對Joshua Bloch的訪談。我看了多遍,受益良多,就翻譯在了此處。由于本人英文水平有限,文中部分語句暫時無法得到準確的翻譯,故英文原文一并給出,請大家斟酌。(2007.06.12最后更新)Bio: Joshua Bloch, Google's chief Java architect and a former Distinguished Engineer at Sun Microsystems, won the prestigious Jolt Award from Software Development Magazine for his book, Effective Java Programming Language Guide. At Sun, he led the design and implementation of numerous Java platform features, including JDK 5.0 language enhancements and the award-winning Java Collections Framework. He holds a Ph.D. in computer science from Carnegie-Mellon University and is most recently the co-author, with Neal Gafter, of Java Puzzlers.
簡歷:Joshua Bloch,Google公司的首席Java架構師,也曾是Sun公司的杰出工程師。由于書籍Effective Java Programming Language Guide,他從Software Development Magazine那兒贏得了極負聲名的Jolt大獎。在Sun公司時,他領導設計并實現了眾多的Java平臺特性,包括JDK 5語言的提升以及獲獎的Java集合框架。他從卡納基-梅隆大學獲得了計算機科學博士學位。最近,他與Neal Gafter一起成為Java Puzzlers的合作作者。
Q: I've heard that at your doctoral thesis defense at Carnegie-Mellon, which was open to anyone for questions, you planted a long technical question with your mother that you answered flawlessly after saying, "Awww, Mom!" Is that true?
我聽說你了在卡納基-梅隆大學時謀劃的博士論文,這個論文為了尋求問題而被放開給每個人。你在你母親的幫助下弄出了一個很長的技術問題,在說出來之后,你的回答毫無瑕疵。
A:Yes. The question appeared to tear the work to shreds. My mom had fun with it, and so did I. Thesis defenses can be so dry. I did everything I could to inject a bit of levity into mine. I also answered another -- planted -- question with a rap, complete with recorded rhythm track. I had a boom box concealed under the desk during the talk.
是的。這個問題的出現將工作分成小塊。我媽媽喜歡它,我也是的。撰寫論文是如此的枯燥。我做每件事情時,都希望能夠給我自己的事情加入一點樂趣。我也回答了與RAP有關的另一個問題,使用一個記錄節奏跟蹤器完成。在談話的過程中,我將一個Boom Box(譯注:一種便攜式的音頻系統,一般由無線電、磁帶或CD播放器組成)藏在桌子下面。
上述一問一答,我確實無法準確翻譯。可能涉及到某個典故,并且語言很口語化。希望有朋友能夠教我 :-D
Q: You are currently busy revising Effective Java. Can you give us some hints about what will be in the second edition?
目前,你正在修訂"Effective Java"。你能否給我們一些關于可能出現在第二版中的內容的一些線索?
A: I'm trying very hard to preserve the tone of the first edition. I'm revising all the existing items in light of the J2SE 5.0 language changes and everything I've learned since 2001. I'm adding a few more items here and there, plus an entire chapter on generics. Also, I'm slanting the threads chapter toward java.util.concurrent.
我正在努力保持第一版的風格。我正修改的所有已經存在的條目都據于J2SE 5.0語言的變化,以及從2001年至今我所學習到的任何東西。我正在各處添加一些更多的條目,為泛型加入了一整章。為了java.util.concurrent包,我也會對多線程這一章進行傾斜。
Q: What are the most interesting or funny reactions you have gotten from readers of Java Puzzlers?
你已經從Java Puzzlers的讀者那兒得到的最有趣或最奇特的反應是什么?
A: Well, I got a letter from David Bacon thanking me for the copy I sent him and saying that it was the perfect thickness to raise his monitor up to the correct height. Then he sent me a picture of his intern's monitor with a copy of the book under it. I also thought it was pretty funny when our Japanese translator, Yoshiki Shibata, caught us falling into one of our own traps. It's described here, if you're curious.
我得到了David Bacon的一封信,感謝我送給了他一本該書,并且說那是一個使他的顯示器上升達到正確高度的理想厚度。后來他遞給我一張他的內部顯示器圖片,這本書就在顯示器的下方。我同樣認為我們的日文版譯者,Yoshiki Shibata,為趕上我們而落入了我們自己的一件行李中,是一件十分有趣的事情。就描述到這,如果你感興趣的話。
如果這兩件"趣聞"真的如我翻譯的那樣的話,我可真感到驚訝。關于第一件趣事,如果我是該書的作者,我會認為David的行為是對我的一種極大的諷刺--我的書是用來看的,不是用來墊顯示器的;關于第二件趣事,我認為就是Josh在"諷刺"(至少是無惡意的吧)那位可憐的日文譯者。不過,老外很開放的,也許這只是一些平常的"笑料"罷了。
Q: In June 2004, when you became chief Java architect at Google, you were put in charge of spreading and encouraging the use of Java technology there. How has it gone?
在2004年6月,當你成為了Google公司的首席Java架構師,你在那兒就被置于推廣和鼓勵Java技術應用的位置。后來如何了?
A: Very well indeed. We use the Java platform extensively in many of our products and internal applications. Of course, we use other languages too.
真的非常好。我們在我們的產品和內部應用中廣泛地使用Java平臺。當然,我們也使用其它的語言。
Q: Some people may not know that you identified a widespread bug affecting both Java and other languages that had gone unnoticed for half a century. Tell us about it.
有些人可能不知道你發起過一個分布廣泛地Bug影響,包括Java和其它語言,它已經被忽略達半個世紀之久了。告訴我們一些關于它的事情。
A: It wasn't really half a century. A quarter century maybe. And I didn't really identify it -- I propagated it into the Java platform libraries! Someone reported the bug to Sun. I don't know who it was, but I was shocked -- and amused -- by the bug. At Peter Norvig's urging, I wrote it up for the Google research blog. I guess it caused quite a stir in the blogosphere.
真的不是半個世紀,可能是25年。并且也確實不是我發起它的--我只是將它介紹到了Java平臺庫中。某個人向Sun報告了這個Bug。我不知道他是誰,但我被這個Bug震驚了--也覺得很有趣。受Peter Norvig的催促,我把它寫入了Google的研究Blog。我猜想它在Blog界引起了一陣震動。
Q: How do you feel about the open sourcing of the Java platform?
你怎么看Java平臺開源?
A: I think it's a good thing. It goes a long way toward easing the concerns of the open-source and research communities about the legal aspects of working with the platform. In many ways, it's always been a pretty open platform: free access to the source code, heck, even the bug database. But it's nice that Sun has gone all the way.
我認為那很好。在緩解開源和研究社區對工作于這個平臺的法律方面的擔心已經走過了很長一段路。在許多方面,它始終都是一個十分開放的平臺:自由的訪問源代碼,甚至是Bug數據庫。但非常好的是Sun已經完成了所有的工作。
Q: What advice would you give to a programmer new to the Java language?
對于一個新接觸Java語言的程序員,你有什么建議?
A: Write lots of code. Have fun with it! Collaborate with people who are more experienced than you and learn from them. Join an open-source project. Code reviews are a great way to learn. Don't be embarrassed when people find problems in your code. Fix them and have fun watching your code and your skills improve. Oh, yeah, and go buy a copy of Effective Java.
寫大量的代碼,并以它們為樂。與那些比你更有經驗的人一起協作,并向他們學習。加入一個開源項目。代碼回顧是一個很好的學習方法。當別人發現你的代碼中的問題時,不必感到尷尬。修復這些問題,并對于觀看你的代碼及對你技術的改進而感到高興。噢,是的,去買一本Effective Java。
Q: What do you think is the most inventive use of Java technology?
你認為對于Java技術最具創造性的應用是什么?
A: That's another tough one. I guess you can't go too far wrong with the Mars Rover. I was blown away by the images that it transmitted.
那是另一個棘手的問題。我猜想你不可能像Mars Rover(譯注:美國的火星漫游者飛行器,它的系統軟件使用Java編寫,這是Java發展歷程中的一件大事)那樣走得那么遠。我為它發射時的畫面所傾倒。
Q: What's the biggest misconception about Java technology?
對Java技術的最大誤解是什么?
A: What irks me most is that there are still people who think it's slow. That's ancient history. By J2SE 1.4, the platform was not appreciably slower than traditional compiled languages, and it just keeps getting faster. Both of the last two releases were impressive in this regard. You don't have to touch your program. Just download the new release, and your program will run significantly faster.
最讓我感到厭倦的是,仍然有人認為Java很慢。那已經很久以前的事了。到J2SE 1.4時,這個平臺就一點都不比傳統的編譯型語言慢了,并且它還在變得更快。最近發布的兩個平臺在這一點上令人影響深刻。你不用修改你的程序,只要下載最新的版本,你的程序就會明顯地運行地更加快。
Q: The Java class that you couldn't live without is...?
你離開就不能活的Java類是...?
A: I'm going to have to say LinkedHashMap, even if I did write it. It combines the speed of HashMap with the predictability of a sorted map.
我將不得不說就是LinkedHashMap,即使我寫出了它。它使用一個排序的映射預覽而結合了HashMap的速度。
Q: What's your favorite Java technology book?
你所喜歡的Java技術書籍是什么?
A: Modesty prevents me from answering this one directly, so I'll plug one of my favorite programming books that isn't specific to the Java language. Anyone who cares at all about bit twiddling should get their hands on Henry S. Warren's Hacker's Delight. It's the Bible of bit twiddling.
謙虛防止我直接地回答這個問題。所以我將指出我所喜歡的編程書籍之一并不特別關于Java語言。任何真正關注位運算的人都應該接觸過Henry S. Warren的"Hacker's Delight",它是位運算的"圣經"。
Another book that every programmer should read is Jon Bentley's Programming Pearls. It's a great book about "programming in the small," as relevant today as when it was first published in 1986.
另一本每位程序員都應該閱讀的書就是Jon Bentley的"Programming Pearls"。這是一本偉大的關于"小型編程"的書,它對今天的價值就如同1986年它第一次出版時一樣。
Q: Can you describe the process of writing code?
你能描述一下寫代碼的過程嗎?
A: For me, there are several distinct stages. The hardest part is figuring out what problem I'm really trying to solve. Once I do that, it's usually reasonably straightforward to envision the rough outlines of the solution. Then it's a "simple matter of programming" to make it real, including the tests, of course.
對于我,有幾種不同的情況。最困難的部分就是勾畫出我真正需要去解決的問題。一旦我做到了,常常就能相當直接地想像出解決方案的粗略輪廓。
Q: What's the next big technology revolution?
下一個大的技術革命是什么?
A: I'm really bad at predicting the future. It's clear that multicore machines will be mainstream in the very near future and that programs will have to change to take full advantage of them. I'm not betting on Software Transactional Memories (STMs) in the near term, but on high-quality multithreaded utilities, such as java.util.concurrent. Oh, yeah, and everything that isn't already on the web will be soon.
在預知未來方面,我真正的很差。清楚地是,在非常近的未來多核機器將成為主流,程序將不得不進行改變以充分利用它們。我不是在為軟件事務內存(STM)打賭,而是為高質量的多線程工具類,如java.util.concurrent。噢,是的,還沒有在Web上的每一件東西都將很快成真。
Q: What do you see as the most important Java technology API five years from now?
從現在開始的五年中,你將如何看待最重要的Java技術API?
A: The core APIs -- java.lang and java.util -- will still be very important. But java.util.concurrent and its offspring will be equally important.
核心API--java.lang和java.util--仍然將十分的重要。但是java.util.concurrent和它的后續者將變得同樣重要。
Q: If you could work on a dream project, what would it be?
如果你能在一個夢想的項目中工作,你希望它是什么?
A: A brand-new Java-like language atop the same virtual machine that is not compatible with the Java programming language. Rather than shoving yet more features into this language, I want a fresh start, but I want to leverage much of the work that has already gone into the platform. That means using the same virtual machine and providing some interoperability story with existing libraries.
一個嶄新的、與Java相似的語言,運行在一個相同的但與Java程序設計語言不兼容的虛擬機中。不要把這些特性擠到這個語言中,我想要一個新的開始。我想影響大量的已經進入這個平臺的工作。這就意味著,使用相同的虛擬機并為已有的類庫提供交互性功能。
關于Joshua對他所理想的項目的描述,我非常的迷惑,這段話仍然需要研究。
Q: What recent changes to the platform have made your life easier?
最近這個平臺的什么變化使你的生活變得更容易。
A: I hate to sound like a broken record, but java.util.concurrent. Also java.util.ArrayDeque and NavigableMap. The for-each loop is great, and so are generics, even if they do complicate things somewhat.
我很不喜歡說類似于破記錄之類的話,但對于java.util.concurrent要除外。java.util.ArrayDeque和NavigableMap也是的。For-Each循環很好,泛型也是如此,即使它們做了一些稍微復雜的工作。
Q: Where in the process of programming do you have the most fun?
編程中的哪個過程使你最有樂趣?
A: I enjoy many phases, from requirements analysis to debugging. Each of these phases presents me with brainteasers, and solving these brainteasers is what I like best. But nothing makes me feel better than building a reusable component and seeing it get reused.
我享受于許多的階段,從需求分析到調試。這些階段中的每一個都會呈現給我難題,而解決這些難題則是我最喜歡的。但沒有什么比構建一個可重用的組件并看到它被重用更讓我感到高興了。