Your skill will accomplish
what the force of many cannot
Effective Javaby Steve_p (Priest)
|on Sep 21, 2002 at 07:20 UTC||Need Help??|
Item Description: Yes, I said Java. It is, however, the best practical OO programming book. Period.
Although I know there are several who frequent this site that also cross over to Java, let's forget about the Java in the title and replace it with "Object Oriented Programming." Despite programming with OO technologies for for several years, I picked up so much information from this book that it was almost embarasing.
The author, Joshua Bloch, is definately not a slouch as an author for this book. One of the core architects of Java, he has definately had experience in OO design and implementation issues. This, for me, was a minor part in establishing credibility. Its when he criticizes the poor design of certain parts of the Java libraries, even areas that he worked on, that he scored points with me.
The first three chapters are pretty much Java specific, so I will not cover them here, but they are definately worth knowing if you program with Java.
In Chapter 4 - Classes and Interfaces, the book turns more general OO topics that I found useful not only for Java, but for other languages, including Perl. The discusions regarding favoring immutable classes, compositions, and avoiding inheritance are lessons I had learned the hard way, but I had not seen in print. It was very nice to see someone smarter than I saying that inheritance breaks encapsulation, and that years of avoiding inheritance on my part was justified.
Chapter 5 - Substitutes for C Constructs was also a very useful chapter for the OO Perl programmer. The examples are fairly straight forward, but the section on enums is worth its weight in gold. Bloch successfully pounds many enum-based designs I've seen in the past (including my own) into the dirt. While some of it gets a bit heavy on the Java side when discussing typesafe, serializable enums, Bloch gives enough advice that the information is usable for just about any programmer.
Chapter 6 - Methods is a chapter full of practical advice that I rarely find in practice, until bugs start creeping in. Advice such as "Check parameters for validity", "Make defensive copies when needed" (especially important when using references), documenting your exposed API can not be stressed enough to new (and many old) programmers.
Chapter 7 - General Programming contains a lot of advice that again can be transfered to just about any language. The advice to "Know and use the libraries" is one that I am reminded of every day. Some of the ideas regarding avoiding strings made me think a lot about my own use of string. The section on limiting the scope of local variables caused me a lot of grief since I came into programming through Pascal and COBOL.
The remaining topics go back towards a Java related scope discussing threads, serialization, and exceptions. The one piece of advice that would apply elsewhere ties into the discussions throughout the book regarding immutable classes. Since immutable classes are, well, immutable, they are thread safe.
Essential Java has quickly become one of my most refered to books on my bookshelf. It should be required reading for any Java programmer, and much of the information in the book would be a benefit to any programmer.
Update: Fixed Title. Aaargh! That's what I get for writing this at 2 am after two pots o' coffee.