点此搜书

当前位置:effectivejava影印版pdf电子书下载 > 其他书籍
effectivejava影印版
  • 作 者:
  • 出 版 社:
  • 出版年份:2222
  • ISBN:
  • 标注页数:0 页
  • PDF页数:267 页
  • 请阅读订购服务说明与试读!

文档类型

价格(积分)

购买连接

试读

PDF格式

15

立即购买

点击试读

订购服务说明

1、本站所有的书默认都是PDF格式,该格式图书只能阅读和打印,不能再次编辑。

2、除分上下册或者多册的情况下,一般PDF页数一定要大于标注页数才建议下单购买。【本资源267 ≥0页】

图书下载及付费说明

1、所有的电子图书为PDF格式,支持电脑、手机、平板等各类电子设备阅读;可以任意拷贝文件到不同的阅读设备里进行阅读。

2、电子图书在提交订单后一般半小时内处理完成,最晚48小时内处理完成。(非工作日购买会延迟)

3、所有的电子图书都是原书直接扫描方式制作而成。

1 Introduction 1

2 Creating and Destroying Objects 5

Item 1: Consider providing static factory methods instead of constructors 5

Item 2: Enforce the singleton property with a private constructor 10

Item 3: Enforce noninstantiability with a private constructor 12

Item 4: Avoid creating duplicate objects 13

Item 5: Eliminate obsolete object references 17

Item 6: Avoid finalizers 20

3 Methods Common to All Objects 25

Item 7: Obey the general contract when overriding equals 25

Item 8: Always override hashCode when you override equals 36

Item 9: Always override to String 42

Item 10: Override clone judiciously 45

Item 11: Consider implementing Comparable 53

4 Classes and Interfaces 59

Item 12: Minimize the accessibility of classes and members 59

Item 13: Favor immutability 63

Item 14: Favor composition over inheritance 71

Item 15: Design and document for inheritance or else prohibit it 78

Item 16: Prefer interfaces to abstract classes 84

Item 17: Use interfaces only to define types 89

Item 18: Favor static member classes over nonstatic 91

5 Substitutes for C Constructs 97

Item 19: Replace structures with classes 97

Item 20: Replace unions with class hierarchies 100

Item 21: Replace enum constructs with classes 104

Item 22: Replace function pointers with classes and interfaces 115

6 Methods 119

Item 23: Check parameters for validity 119

Item 24: Make defensive copies when needed 122

Item 25: Design method signatures carefully 126

Item 26: Use overloading judiciously 128

Item 27: Return zero-length arrays, not nulls 134

Item 28: Write doc comments for all exposed API elements 136

7 General Programming 141

Item 29: Minimize the scope of local variables 141

Item 30: Know and use the libraries 145

Item 31: Avoid float and double if exact answers are required 149

Item 32: Avoid strings where other types are more appropriate 152

Item 33: Beware the performance of string concatenation 155

Item 34: Refer to objects by their interfaces 156

Item 35: Prefer interfaces to reflection 158

Item 36: Use native methods judiciously 161

Item 37: Optimize judiciously 162

Item 38: Adhere to generally accepted naming conventions 165

8 Exceptions 169

Item 39: Use exceptions only for exceptional conditions 169

Item 40: Use checked exceptions for recoverable conditions and run-time exceptions for programming errors 172

Item 41: Avoid unnecessary use of checked exceptions 174

Item 42: Favor the use of standard exceptions 176

Item 43: Throw exceptions appropriate to the abstraction 178

Item 44: Document all exceptions thrown by each method 181

Item 45: Include failure-capture information in detail messages 183

Item 46: Strive for failure atomicity 185

Item 47: Don't ignore exceptions 187

9 Threads 189

Item 48: Synchronize access to shared mutable data 189

Item 49: Avoid excessive synchronization 196

Item 50: Never invoke wait outside a loop 201

Item 51: Don't depend on the thread scheduler 204

Item 52: Document thread safety 208

Item 53: Avoid thread groups 211

10 Serialization 213

Item 54: Implement Seriali zable judiciously 213

Item 55: Consider using a custom serialized form 218

Item 56: Write readobj ect methods defensively 224

Item 57: Provide a readResol ve method when necessary 230

References 233

Index of Patterns and Idioms 239

Index 241

购买PDF格式(15分)
返回顶部