君子藏器于身,待时而动。
--《周易》
:

Effective Java

Effective Java

作者: Joshua Bloch

出版社: 人民邮电出版社

出版时间: 2009-9

价格: 39.00元

ISBN: 9787115211316

【🔥扫码右侧二维码】

【📱扫码极速下载】浏览器自动唤起

💎独家资源·限时共享

作者简介:

Joshua Bloch是Google公司的首席Java构架师,也是Jolt图书大奖的获得者。他曾是Sun公司的杰出工程师和Transarc公司的高级系统设计师。Bloch带领着他的优秀团队,设计和实现过无数的Java平台特性,包括JDK5.0语言增强版和获奖的Java Collections Framework。

内容简介:

本书介绍了在java编程中78条经典的、实用性极高的经验规则,这些经验规则可以帮助开发人员来解决每天都有可能面对的大多数问题。书中对java平台设计专家所使用的技术的介绍,揭示了如何事半功倍地的编写清晰、健壮和高效的代码。本书是经典图书effective java的第2版,涵盖了java 5中的重要变化,并删除了一些过时的内容。本书所介绍的每条规则,都以简明易懂的语言来阐释,并通过示例代码进一步加以说明。 本书内容翔实,层次分明,是一本可以帮助技术人员更深层次理解java的参考用书。

目录:

1 introduction  1 2 creating and destroying objects 5 item 1: consider static factory methods instead of constructors 5 item 2: consider a builder when faced with many constructor parameters 11 item 3: enforce the singleton property with a private constructor or an enum type 17 item 4: enforce noninstantiability with a private constructor 19 item 5: avoid creating unnecessary objects 20 item 6: eliminate obsolete object references 24 item 7: avoid finalizers 27 3 methods common to all objects 33 item 8: obey the general contract when overriding equals 33 item 9: always override hashcode when you overrideequals 45 item 10: always override tostring 51 item 11: override clone judiciously 54 item 12: consider implementing comparable 62 4 classes and interfaces 67 item 13: minimize the accessibility of classes and members 67 item 14: in public classes, use accessor methods, not public fields 71 item 15: minimize mutability 73 item 16: favor composition over inheritance 81 item 17: design and document for inheritance or else prohibit it 87 item 18: prefer interfaces to abstract classes 93 item 19: use interfaces only to define types 98 item 20: prefer class hierarchies to tagged classes 100 item 21: use function objects to represent strategies 103 item 22: favor static member classes over nonstatic 106 5 generics 109 item 23: don't use raw types in new code 109 item 24: eliminate unchecked warnings 116 item 25: prefer lists to arrays 119 item 26: favor generic types 124 item 27: favor generic methods 129 item 28: use bounded wildcards to increase api flexibility 134 item 29: consider typesafe heterogeneous containers 142 6 enums and annotations 147 item 30: use enums instead of int constants 147 item 31: use instance fields instead of ordinals 158 item 32: use enumset instead of bit fields 159 item 33: use enummap instead of ordinal indexing 161 item 34: emulate extensible enums with interfaces 165 item 35: prefer annotations to naming patterns 169 item 36: consistently use the override annotation 176 item 37: use marker interfaces to define types 179 7 methods 181 item 38: check parameters for validity .. 181 item 39: make defensive copies when needed 184 item 40: design method signatures carefully 189 item 41: use overloading judiciously 191 item 42: use varargs judiciously 197 item 43: return empty arrays or collections, not nulls 201 item 44: write doc comments for all exposed api elements 203 8 general programming 209 item 45: minimize the scope of local variables 209 item 46: prefer for-each loops to traditional for loops 212 item 47: know and use the libraries 215 item 48: avoid float and double if exact answers are required 218 item 49: prefer primitive types to boxed primitives 221 item 50: avoid strings where other types are more appropriate 224 item 51: beware the performance of string concatenation 227 item 52: refer to objects by their interfaces 228 item 53: prefer interfaces to reflection 230 item 54: use native methods judiciously 233 item 55: optimize judiciously 234 item 56: adhere to generally accepted naming conventions 237 9 exceptions 241 item 57: use exceptions only for exceptional conditions 241 item 58: use checked exceptions for recoverable conditions and runtime exceptions for programming errors 244 item 59: avoid unnecessary use of checked exceptions 246 item 60: favor the use of standard exceptions 248 item 61: throw exceptions appropriate to the abstraction 250 item 62: document all exceptions thrown by each method 252 item 63: include failure-capture information in detail messages 254 item 64: strive for failure atomicity 256 item 65: don't ignore exceptions 258 10 concurrency 259 item 66: synchronize access to shared mutable data 259 item 67: avoid excessive synchronization 265 item 68: prefer executors and tasks to threads 271 item 69: prefer concurrency utilities to wait and notify 273 item 70: document thread safety 278 item 71: use lazy initialization judiciously 282 item 72: don't depend on the thread scheduler 286 item 73: avoid thread groups 288 11 serialization 289 item 74: implement serializable judiciously 289 item 75: consider using a custom serialized form 295 item 76: write readobject methods defensively 302 item 77: for instance control, prefer enum types toreadresolve 308 item 78: consider serialization proxies instead of serialized instances 312 appendix: items corresponding to first edition 317 references 321 index  327

相关推荐

追问
2025-03-04 9.3k
长安的荔枝
2025-03-05 4.8k

评论

2024-06-19 01:55:53
书虫小明发表
这本书真棒!作者精准地总结了 Java 编程中的关键原则,这些原则极其实用且易懂。通过阅读这些规则,我提升了代码的质量和效率,降低了错误率和复杂性。这本书是每个 Java 开发人员的必备之作,它为我们提供了在 Java 世界中航行的指南。
2024-06-19 01:55:53
Java 狂热者发表
作为一个经验丰富的 Java 开发人员,我强烈推荐《Effective Java》第二版。这本书涵盖了 Java 平台设计专家使用的关键技术,这些技术对于编写健壮、高效且可维护的代码至关重要。作者深入浅出地阐述了每条规则,并附上示例代码,让我可以轻松理解并将其应用到实际项目中。这本书绝对是 Java 开发人员的宝贵财富。
2024-06-19 01:55:53
程序员小凡发表
起初,我被《Effective Java》的厚度吓到了,但开始阅读后,我被书中内容的丰富性和实用性深深吸引了。作者通过 78 条经验规则,全面阐述了 Java 编程的最佳实践,覆盖了从基本语法到高级架构设计等方方面面。每一章都深入探讨一个特定的主题,并提供大量示例代码,让我可以轻松掌握和应用这些原则。
2024-06-19 01:55:53
代码优化师发表
《Effective Java》是一本不可多得的代码优化宝典。作者巧妙地将 Java 语言的特性与设计原则相结合,为我们提供了编写简洁、可读和高效代码的指导。本书中提到的每一条经验规则都经过精挑细选,并在实践中得到过验证,可以有效地减少代码冗余、提高运行效率和提升代码的可维护性。
2024-06-19 01:55:53
Java 探索者发表
阅读《Effective Java》是一次奇妙的探索之旅。这本书不是简单的理论堆砌,而是作者多年经验的智慧结晶。每一章都揭示了一个 Java 编程中鲜为人知的奥秘,让我对这门语言有了更深刻的理解。通过遵循本书的原则,我编写出更加优雅、健壮和可扩展的 Java 代码,大大提升了我的编程水平。
登录发表评论