Appendix . Items Corresponding to First Edition

First Edition Item Number

Second Edition Item Number, Title

1

1, Consider static factory methods instead of constructors

2

3, Enforce the singleton property with a private constructor or an enum type

3

4, Enforce noninstantiability with a private constructor

4

5, Avoid creating unnecessary objects

5

6, Eliminate obsolete object references

6

7, Avoid finalizers

7

8, Obey the general contract when overriding equals

8

9, Always override hashCode when you override equals

9

10, Always override toString

10

11, Override clone judiciously

11

12, Consider implementing Comparable

12

13, Minimize the accessibility of classes and members

13

15, Minimize mutability

14

16, Favor composition over inheritance

15

17, Design and document for inheritance or else prohibit it

16

18, Prefer interfaces to abstract classes

17

19, Use interfaces only to define types

18

22, Favor static member classes over nonstatic

19

14, In public classes, use accessor methods, not public fields

20

20, Prefer class hierarchies to tagged classes

21

30, Use enums instead of int constants

22

21, Use function objects to represent strategies

23

38, Check parameters for validity

24

39, Make defensive copies when needed

25

40, Design method signatures carefully

26

41, Use overloading judiciously

27

43, Return empty arrays or collections, not nulls

28

44, Write doc comments for all exposed API elements

29

45, Minimize the scope of local variables

30

47, Know and use the libraries

31

48, Avoid float and double if exact answers are required

32

50, Avoid strings where other types are more appropriate

33

51, Beware the performance of string concatenation

34

52, Refer to objects by their interfaces

35

53, Prefer interfaces to reflection

36

54, Use native methods judiciously

37

55, Optimize judiciously

38

56, Adhere to generally accepted naming conventions

39

57, Use exceptions only for exceptional conditions

40

58, Use checked exceptions for recoverable conditions and runtime exceptions for programming errors

41

59, Avoid unnecessary use of checked exceptions

42

60, Favor the use of standard exceptions

43

61, Throw exceptions appropriate to the abstraction

44

62, Document all exceptions thrown by each method

45

63, Include failure-capture information in detail messages

46

64, Strive for failure atomicity

47

65, Don’t ignore exceptions

48

66, Synchronize access to shared mutable data

49

67, Avoid excessive synchronization

50

69, Prefer concurrency utilities to wait and notify

51

72, Don’t depend on the thread scheduler

52

70, Document thread safety

53

73, Avoid thread groups

54

74, Implement Serializable judiciously

55

75, Consider using a custom serialized form

56

76, Write readObject methods defensively

57

77, For instance control, prefer enum types to readResolve

 

78, Consider serialization proxies instead of serialized instances

 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.154.143