`
Eastsun
  • 浏览: 309733 次
  • 性别: Icon_minigender_1
  • 来自: 天津
社区版块
存档分类
最新评论

《Effective Java》: Joshua Bloch访谈

阅读更多
  原文地址Effective Java: An Interview with Joshua Bloch
  翻  译Eastsun

  The most anticipated book among Java developers over the past few years has been the second edition of Effective Java by Joshua Bloch. The book was finally launched during JavaONE this year. I caught up with Josh and discussed the book, the changes in industry since the last edition and his thoughts on closures.
  在最近几年来,Java开发者最期待的技术书籍莫过于Joshua Bloch的《Effective Java》第二版了。该书在今年的JavaOne大会上正式发布。我(Eastsun注:指James Sugrue)对Josh进行了采访,我们谈到了这本书,自从上一版以来业界发生的变化以及他对闭包的看法。

  James Sugrue: The book was made available at JavaONE. Did you do any technical sessions to coincide with the release?
  James Sugrue: 这本书是在JavaOne大会上发布的,你是否做了一些技术讲座以配合这个发布?
  Joshua Bloch: I did two sessions. On was directly related to the book. It was called "More Effective Java." It was largely devoted to enum types (Items 30-34, 77), but also included a mnemonic for the use of bounded wildcard types (Item 28) and a guide to lazy initialization (Item 71).
  Joshua Bloch: 我有两个讲座。一个与这本书直接相关,叫做"More Effective Java"。主要是关于枚举类型(条目 30-34, 77),以及一些关于如何使用通配符(条目 28)。还有一个关于延迟初始化的讲座。(条目 71)

  Sugrue: What changes have been added to bring to book up to date?
  Sugrue: 在该书的新版中有那些变化?
  Bloch: I added two chapters, one on Generics, and another on Enums and Annotations. Also I added items describing best practices for each of the new language features in Java 5 (for-each loop, autoboxing, varargs, static import). I changed the title of the Threads chapter to Concurrency and rewrote it to reflect programming in the java.util.concurrent era (where the basic abstractions are tasks and executors, rather than threads, wait and notify). There's a table on page 1 that points you to all of this material.

In addition to adding material on features that were added to the platform since the first edition of the book, I added items or modified existing ones to reflect the evolution of best practices. For example, I added an item describing the Builder pattern (Item 2), and one describing the Serialization Proxy pattern (Item 78). I went over every line of every item, and did my best to make sure they were up to date.

  Bloch: 我增加了两章。一章是关于泛型,另一章是关于Enum与Annotation;还增加了一些讲述Java5中新增的语言特性最佳实践的条目。我将Threads一章的标题修改为Concurrency,并且针对java.util.concurrent重写了该章。在该书的第一页有一个列表指出了这些变化。
  除了自该书第一版以来Java平台上新添的特性以外,我还增加或修改了一些条目以反映最佳实践的演化。譬如,我增加了一个讲述Builder模式的条目(条目 2)以及一个讲述Serialization Proxy模式的条目(条目 78)。我仔细检查了书里面的每一条的每一行,尽我最大的努力确保它们反映出当前最新的变化。

  Sugrue: Is it fair to consider this as a whole new book?
  Sugrue: 我们是否可以把它看做全新的一本书?
  Bloch: No! I did my best not to change the character of the work. I hope it feels like an old friend to readers of the first edition.
  Bloch: 不,恰恰相反。我尽量不改变这本书的整体感官,我希望第一版的读者看到该书时就像遇到了老朋友。

  Sugrue: Since the first book in 2001, what key changes have you observed in Java development?
  Sugrue: 自从2001年发布该书的第一版以来,你认为在Java开发领域有那些关键性的变化?
  Bloch: The biggest changes are the rise of modern IDEs, such as Eclipse, IntelliJ, and NetBeans, and static analysis tools, such as FindBugs. Agile techniques, which were just making inroads in 2001, have become mainstream.
  Bloch: 最大的变化是现代IDE的增长,例如Eclipse、IntelliJ以及Netbeans。还有静态分析工具,如FindBugs。敏捷技术在2001年的时候才刚刚起步,而现在已经成为主流。

  Sugrue: Effective Java is seen as one of the most important books for Java. Considering it's popularity, were you wary of making any changes to such a well established book?
  Bloch: Very much so. That's why I tried so hard not to change the character of the book. Of course I had to cover all of the new material, and I had to critically examine everything I said in the first edition. But I did everything in my power to make sure that nothing got hurt in the process. I hope I succeeded, but I won't know for sure until I've heard from readers of the second edition.

  Sugrue: Every developer should read this book - but some might not be able to make time. For those, if you were to promote just one message from the book what would it be?
  Sugrue: 每一个Java开发者都应该阅读这本书,但可能有一些人没有充裕的时间。对于这些人,你能否简单介绍一下你这本书的主旨?
  Bloch: I was asked the same question the very first time I was interviewed about Effective Java, back in June 2001. This is what I replied: Always strive to write simple, clear, and correct programs. It is penny wise and pound foolish to do otherwise. Style does matter. It pays real dividends in terms of correctness, usability, robustness, and maintainability. Also, it's way more fun to write good programs than bad ones.
  I still believe every word.

  Bloch: 我第一次被采访关于《Effective Java》的时候也被问到了这个问题,那还是2001年。这是我当时的回答:力求写简单、清晰、正确的代码,而不是其它。代码风格很重要,它能在团队中对代码的正确性、可用性、鲁棒性以及可维护性产生实际的效用。同样,写好的代码比差的代码可以带来更多的快乐。
  我依然坚信这些。

  Sugrue: What is the most common fault in Java developers in your opinion?
  Sugrue: 你认为Java开发者普遍易犯的错误是什么?
  Bloch: Like most programmers, we have a natural tendency to optimize our code even when we should know better. Our attempted optimizations don't always make the code run faster. Sometimes they just make it more complicated.
  Bloch: 大多数程序员都有一个自然的倾向,在开始写代码时就试图优化以提高性能。但我们这种企图并不总是有用,甚至在某些时候只会把程序复杂化。

  Sugrue: The book includes hints for class and interface design. In one paragraph, can you describe a guideline for a good design?
  Sugrue: 这本书里有一些关于类与接口设计的建议。你能否简单的讲述一下你对于良好设计的指导准则?
  Bloch: I apologize if this sounds trite, but each class should do one thing, and do it well. There's a great litmus test: can you, in one short, clear noun phrase, describe what an instance of the class represents? If not, you should probably spend more time thinking about the design.
  Bloch: 我讲的东西可能没有什么新意,那就是每一个类只应该做一件事情,并且把它做好。这儿有一个很好的检验方法:你能否用一个简短的、明了的名词短语描述这个类的实例所代表的东西?如果不能,那你可能需要多花一些时间考虑一下你的设计了。

  Sugrue: Scripting on top of the JVM has become very popular over the past year or so. What do you think of it?
  Sugrue: 在这些年来,JVM上的动态语言变得流行起来。你是怎么看待这个现象呢?
  Bloch: I'm a pragmatist. Often it's the easy way to get things done, and that makes it good. Of course you should write your scripts with all the care that you write your programs, because they'll have to be maintained in parallel with the programs.
  Bloch: 我是个实用主义者。使用动态语言通常使解决问题变得更加容易,这很好。当然使用动态语言也要注意一些问题,因为它们需要与其他代码共同被维护。

  Sugrue: What is your opinion on the inclusion Closures in Java 7?
  Sugrue:  你如何看待Java7中将要引入的闭包?
  Bloch: As readers of the first edition know, I value simplicity and clarity above all else. So it should come as no surprise that I don't want to see anymore major additions to the Java programming language. It's already as complex as a language should be. If Java programmers want to use features that aren't present in the language, I think they're probably best off using another langauge that targets the JVM, such a Scala and Groovy.
  Bloch: 正如该书第一版读者所了解的那样,我一直将简洁与清晰放到首要位置。因此我不希望看到Java在语言上有太大的变化,Java语言现在已经很好,不应该变得更加复杂。如果Java程序员想使用那些Java语言里面所不具有的特性,我认为他们最好是去使用JVM上的其他语言,譬如Scala与Groovy。(Eastsun注:在另一个访谈中Bloch提到他也很喜欢闭包,但是他认为当前流行的那些闭包提议过于复杂,会破坏Java语言的简洁性。事实上,他支持在Java中采用Bob Lee, Doug Lea,Josh Bloch三人所提出的CICE方式;但Java之父Gosling则希望采用另一个更加彻底同时也更加复杂的实现方式:BGGA)

  Sugrue: To Java developers your book is seen as a bible. Can you recommend any other books to sit alongside yours on the developer's bookshelf?

  Bloch: Sure. For concurrency, I recommend Java Concurrency in Practice by Goetz, Peierls, et al. For bit twiddling, go with Hacker's Delight, by Henry S. Warren. A couple of classics that only improve with age are Frederic P. Brooks's The Mythical Man Month, and Jon Bentley's Programming Pearls. And every programmer should read Strunk and White's The Elements of Style. Not only will it make you a better writer (which is an important part of being a software engineer) but it will make you a better programmer. Programming and writing have a lot in common: both are about expressing yourself clearly and concisely.
分享到:
评论
9 楼 Feiing 2008-05-23  
听说 YuLiMin 在翻译第二版 ?
8 楼 Eastsun 2008-05-23  
seen 写道
为什么直到现在还有人喜欢翻译成鲁棒性

这个...不好么?
我不知道鲁棒性与健壮性那个更常用。
不过我蛮喜欢“鲁棒”这个词
7 楼 seen 2008-05-23  
为什么直到现在还有人喜欢翻译成鲁棒性
6 楼 fujohnwang 2008-05-23  
引用
Programming and writing have a lot in common: both are about expressing yourself clearly and concisely.

I like these words,hehe
5 楼 lonelyblue 2008-05-23  
颜色真的超难看................


Edit: 好看多了
4 楼 lordhong 2008-05-23  
大哥...你也没有怎么翻译啊...冷~~~Orz...
3 楼 lordhong 2008-05-23  
我来做好人...字体黑白版...


The most anticipated book among Java developers over the past few years has been the second edition of Effective Java by Joshua Bloch. The book was finally launched during JavaONE this year. I caught up with Josh and discussed the book, the changes in industry since the last edition and his thoughts on closures.
  在最近几年来,Java开发者最期待的技术书籍莫过于Joshua Bloch的《Effective Java》第二版了。该书在今年的JavaOne大会上正式发布。我(Eastsun注:指James Sugrue)对Josh进行了采访,我们谈到了这本书,自从上一版以来业界发生的变化以及他对闭包的看法。

  James Sugrue: The book was made available at JavaONE. Did you do any technical sessions to coincide with the release?
  James Sugrue: 这本书是在JavaOne大会上发布的,你是否做了一些技术讲座以配合这个发布?
  Joshua Bloch: I did two sessions. On was directly related to the book. It was called "More Effective Java." It was largely devoted to enum types (Items 30-34, 77), but also included a mnemonic for the use of bounded wildcard types (Item 28) and a guide to lazy initialization (Item 71).
  Joshua Bloch: 我有两个讲座。一个与这本书直接相关,叫做"More Effective Java"。主要是关于枚举类型(条目 30-34, 77),以及一些关于如何使用通配符(条目 28)。还有一个关于延迟初始化的讲座。(条目 71)

  Sugrue: What changes have been added to bring to book up to date?
  Sugrue: 在该书的新版中有那些变化?
  Bloch: I added two chapters, one on Generics, and another on Enums and Annotations. Also I added items describing best practices for each of the new language features in Java 5 (for-each loop, autoboxing, varargs, static import). I changed the title of the Threads chapter to Concurrency and rewrote it to reflect programming in the java.util.concurrent era (where the basic abstractions are tasks and executors, rather than threads, wait and notify). There's a table on page 1 that points you to all of this material.

In addition to adding material on features that were added to the platform since the first edition of the book, I added items or modified existing ones to reflect the evolution of best practices. For example, I added an item describing the Builder pattern (Item 2), and one describing the Serialization Proxy pattern (Item 78). I went over every line of every item, and did my best to make sure they were up to date.
  Bloch: 我增加了两章。一章是关于泛型,另一章是关于Enum与Annotation;还增加了一些讲述Java5中新增的语言特性最佳实践的条目。我将 Threads一章的标题修改为Concurrency,并且针对java.util.concurrent重写了该章。在该书的第一页有一个列表指出了这些变化。
  除了自该书第一版以来Java平台上新添的特性以外,我还增加或修改了一些条目以反映最佳实践的演化。譬如,我增加了一个讲述 Builder模式的条目(条目 2)以及一个讲述Serialization Proxy模式的条目(条目 78)。我仔细检查了书里面的每一条的每一行,尽我最大的努力确保它们反映出当前最新的变化。

  Sugrue: Is it fair to consider this as a whole new book?
  Sugrue: 我们是否可以把它看做全新的一本书?
  Bloch: No! I did my best not to change the character of the work. I hope it feels like an old friend to readers of the first edition.
  Bloch: 不,恰恰相反。我尽量不改变这本书的整体感官,我希望第一版的读者看到该书时就像遇到了老朋友。

  Sugrue: Since the first book in 2001, what key changes have you observed in Java development?
  Sugrue: 自从2001年发布该书的第一版以来,你认为在Java开发领域有那些关键性的变化?
  Bloch: The biggest changes are the rise of modern IDEs, such as Eclipse, IntelliJ, and NetBeans, and static analysis tools, such as FindBugs. Agile techniques, which were just making inroads in 2001, have become mainstream.
  Bloch: 最大的变化是现代IDE的增长,例如Eclipse、IntelliJ以及Netbeans。还有静态分析工具,如FindBugs。敏捷技术在2001年的时候才刚刚起步,而现在已经成为主流。

  Sugrue: Effective Java is seen as one of the most important books for Java. Considering it's popularity, were you wary of making any changes to such a well established book?
  Bloch: Very much so. That's why I tried so hard not to change the character of the book. Of course I had to cover all of the new material, and I had to critically examine everything I said in the first edition. But I did everything in my power to make sure that nothing got hurt in the process. I hope I succeeded, but I won't know for sure until I've heard from readers of the second edition.

  Sugrue: Every developer should read this book - but some might not be able to make time. For those, if you were to promote just one message from the book what would it be?

  Bloch: I was asked the same question the very first time I was interviewed about Effective Java, back in June 2001. This is what I replied: Always strive to write simple, clear, and correct programs. It is penny wise and pound foolish to do otherwise. Style does matter. It pays real dividends in terms of correctness, usability, robustness, and maintainability. Also, it's way more fun to write good programs than bad ones.

  I still believe every word.
  Sugrue: What is the most common fault in Java developers in your opinion?

  Bloch: Like most programmers, we have a natural tendency to optimize our code even when we should know better. Our attempted optimizations don't always make the code run faster. Sometimes they just make it more complicated.

  Sugrue: The book includes hints for class and interface design. In one paragraph, can you describe a guideline for a good design?

  Bloch: I apologize if this sounds trite, but each class should do one thing, and do it well. There's a great litmus test: can you, in one short, clear noun phrase, describe what an instance of the class represents? If not, you should probably spend more time thinking about the design.

  Sugrue: Scripting on top of the JVM has become very popular over the past year or so. What do you think of it?

  Bloch: I'm a pragmatist. Often it's the easy way to get things done, and that makes it good. Of course you should write your scripts with all the care that you write your programs, because they'll have to be maintained in parallel with the programs.


  Sugrue: What is your opinion on the inclusion Closures in Java 7?
  Bloch: As readers of the first edition know, I value simplicity and clarity above all else. So it should come as no surprise that I don't want to see anymore major additions to the Java programming language. It's already as complex as a language should be. If Java programmers want to use features that aren't present in the language, I think they're probably best off using another langauge that targets the JVM, such a Scala and Groovy.

  Sugrue: To Java developers your book is seen as a bible. Can you recommend any other books to sit alongside yours on the developer's bookshelf?

  Bloch: Sure. For concurrency, I recommend Java Concurrency in Practice by Goetz, Peierls, et al. For bit twiddling, go with Hacker's Delight, by Henry S. Warren. A couple of classics that only improve with age are Frederic P. Brooks's The Mythical Man Month, and Jon Bentley's Programming Pearls. And every programmer should read Strunk and White's The Elements of Style. Not only will it make you a better writer (which is an important part of being a software engineer) but it will make you a better programmer. Programming and writing have a lot in common: both are about expressing yourself clearly and concisely.
2 楼 Eastsun 2008-05-23  
唔,看来还是改一下吧
1 楼 lordhong 2008-05-23  
字体颜色好难看阿~~~

相关推荐

    Joshua Bloch访谈录.doc

    他们共同撰写了《Java Puzzlers》一书,而Bloch还著有广受欢迎的《Effective Java》。他们的经验和见解对Java开发者具有很高的参考价值。 总之,这场访谈揭示了技术发展与个人成长之间的关系,强调了深入理解编程...

    Joshua Bloch 所著《Effective Java 第二版》一书的源代码.zip

    Joshua Bloch 所著《Effective Java 第二版》一书的源代码有效的 Java 示例这是 Joshua Bloch 编写的《Effective Java 第二版》一书的来源。除包名称外,其他均未修改。原始源代码可从...

    Joshua Bloch 所著《Effective Java 第二版》一书摘要.zip

    Joshua Bloch 所著《Effective Java 第二版》一书摘要这是我对 Joshua Bloch 所著《Effective Java 第 2 版》的总结。我在学习时会用到它,也可以作为快速参考。它并不是这本书的独立替代品,所以如果你真的想学习...

    读书笔记:Effective Java 中文版(第2版)总结 (美)Joshua Bloch 著.zip

    读书笔记:Effective Java 中文版(第2版)总结 (美)Joshua Bloch 著

    Google首席工程师Joshua Bloch谈如何设计优秀的API

    Google首席工程师Joshua Bloch,作为Java语言和库的主要设计师之一,对API设计有着深厚的理解和丰富的经验。在他的讨论中,我们可以提取出以下几个关键知识点: 1. **明确目标**:API设计首先要明确其目标和用途。...

    effective-java:我正在关注Joshua Bloch撰写的有效Java一书

    《有效Java》是由著名程序员和Java专家Joshua Bloch撰写的一本经典编程书籍,它为Java开发者提供了许多实用且深入的编程建议,旨在帮助我们编写出更高效、更可靠、更易于维护的Java代码。这本书包含了37个条目,每个...

    Effective Java第三版1

    《Effective Java》是Java编程领域的一本经典著作,由Joshua Bloch撰写,该书的第三版继续提供了关于如何编写高效、优雅、可维护的Java代码的指导。以下是基于给出的目录和部分内容提取的一些关键知识点: ### 第一...

    java项目开发资源.docx

    Java是一种广泛使用的编程语言,特别适合于跨平台的应用程序开发。以下是一些Java项目开发资源,可以帮助开发者从基础到高级阶段进行学习和... - 《Effective Java》(作者:Joshua Bloch)。 5. **开源项目和库**:

    1_Effective_Java_2nd_Edition_proglib_java_Joshua_

    《Effective Java》是Java编程领域的一本经典著作,由知名程序员和计算机科学家Joshua Bloch撰写。这本书的第二版深入探讨了如何编写高效、可维护的Java代码,并提供了许多实用的编程指南和最佳实践。以下是根据标题...

    EffectiveJava:有效的 Java 示例

    《EffectiveJava》是Java开发领域的经典著作,由Joshua Bloch撰写,提供了许多关于如何编写高效、可维护和设计良好的Java代码的实用建议。这本书的第2版在原有的基础上进行了更新,以适应Java语言的新发展。现在,...

    effective-java.pdf

    标题“effective-java.pdf”与描述“effective-java.pdf”表明本文档是关于Java编程实践的指南,且内容可能来自于一本名为《Effective Java》的书籍,该书是由Joshua Bloch编写,被广泛认为是Java编程的权威指南。...

    Effective-Java:Effective Java中文版第二版示例代码

    《Effective Java》是Java开发领域的经典著作,由Joshua Bloch撰写,中文版第二版更是深受广大Java开发者喜爱。这本书提供了许多实用的编程实践和经验教训,帮助开发者编写出更高效、可维护的Java代码。这里我们将...

    effectiveJava课件分享

    在编程领域,特别是Java开发中,"Effective Java"是一本非常经典的书籍,由Joshua Bloch撰写,书中提出了一系列最佳实践和设计原则,以帮助开发者编写出更高效、更安全的代码。根据提供的标题和描述,我们将探讨三个...

    effective java 读书笔记

    《Effective Java》是Java开发领域的经典著作,作者Joshua Bloch深入浅出地阐述了编写高效、健壮的Java代码的技巧和最佳实践。以下是对该书部分内容的详细解释: 1. **产生和销毁对象** - Item1:静态工厂方法相比...

    LF_EffectiveJava:买的书籍看完必须把原始码运行完,加上自己的理解注释

    《Effective Java》是Java开发领域的一本经典著作,由Joshua Bloch撰写,它提供了许多实用的编程建议和最佳实践,旨在帮助开发者写出更高效、更安全、更可维护的Java代码。在这个LF_EffectiveJava项目中,我们可以...

    2009年的JavaOne大会上,Joshua Bloch和Neal Gafter又为我们带来的7道谜题

    在2009年的JavaOne大会上,知名Java专家Joshua Bloch和Neal Gafter共同提出了一系列有趣的编程谜题,旨在挑战参会者对Java语言特性的理解。这些谜题涵盖了一些核心概念,例如字符串处理、集合操作以及迭代器的实现。...

    Effective Java.zip

    《Effective Java》是一本经典Java编程指南,作者是Joshua Bloch,这本书深入探讨了如何编写高质量、高效、可维护的Java代码。以下是对压缩包中各章节主要知识点的详细阐述: 1. **第2章 创建和销毁对象** - 单例...

    effective-java 配套代码

    《Effective Java》是Java开发领域的一本经典著作,由Joshua Bloch撰写,书中提出了一系列编程最佳实践和设计模式,帮助开发者写出更高效、更可靠、更易于维护的Java代码。配套代码`effective-java-examples-master`...

    java源码测试-effective-java:读EffectiveJava(中文版第3版)阅读源码测试案列

    《Effective Java》是Java开发领域的经典著作,由Joshua Bloch编写,中文版第三版的出版为Java开发者提供了深入理解语言特性和最佳实践的机会。这本书包含了一系列编程实践和设计模式,旨在帮助程序员写出更高效、更...

Global site tag (gtag.js) - Google Analytics