Posted by Michael Hunger on Nov 29, 2007 in
Uncategorized |
Last week I finally got the book. Implementation Patterns from Kent Beck. I’ve been waiting for it for quite a while.
The first thing I noticed was that the book is actually Java Best Practice Pattterns, although it doesn’t mention in in its title.
The book is a part of the condensed knowledge of an experienced developer how to write communicating, simple and flexible code. Its level is a bit high profile for new developers. Although I enjoyed to reflect my own work, I really liked many of the topics taken much further and discussed in greater scope and more precisely.
I would have wanted more structure in the flow of the book. Perhaps smaller chapters focused to some subtopic of the current chapters.
What I missed most in the book were references to the other important works in this context, developing software even at the language level is never isolated from the other forces and possibilities one has.
What I missed most were:
discussion of package concept, its usefulness for communication, structuring, documenting and visibility
a consistent example carrying through the book, either from the JUnit library or an extended version of the Performance Measurement appendix
Generics: used in many examples but not explained and no implementation patterns for them
Enum: very shortly discussed in the framework section but imho belong to the class and interface chapter, very important as type-safe alternative to constants, the constant object would be a
important accompanying concept
Annotations although you use them in examples and have surely used them a lot in JUnit
the immutable java.lang.*; objects which are the counterparts of the primitive types
going with that Autoboxing, its many advantages and problems together with varargs
explicit discussion of Packages as structuring element
more finger-pointing on potential concurrency problems, e.g. when sharing state, safe copy and the like
regarding to communication: principle of least surprise – consistent usage of patterns throughout an application and commonly accepted usage of language features (e.g. java naming schemes etc).
law of demeter
the danger of having overridable methods called in constructors and the necessity of
an explicit Chapter on Properties, e.g. published, encapsulated attributes, the pro and cons, problems with published fields, with a discussion of the Java-Beans concept
within the “Creation” Chapter a discussion on dependencies and dependency handling, publish them don’t publish them, the creational patterns shown
discussion of Martin Fowlers POJO notion
taking the language created by a framework or library further to the point where it covers its (small) domain -> further reading Martins DSL book
how to handle cross cutting concerns ? use a technology for this or provide the hooks yourself
discussion of Inversion of Control, using callbacks to transfer the flow of control to a framework having my own code executed in a certain context/environment (especially resource handling etc)
a more positive discussion of the final keyword (esp. for fields, locals, parameters) , it communicates a lot, helps to prevent a lot of errors (compiler catches them) and assures immutability
declaring classes and methods final is a very different side of the coin
A problem with the Appendix exampel is that it ignores some advice of the book, contains bugs and false assumptions. The statement that initializing collecitons with a size doesn not matter is wrong. Kent measured the wrong things to prove that.
I read the book twice since, writing a lot of notes in it (errata and commentary). I asked Kent to discuss the stuff and fortunately he agreed. So I hope to contribute to the evolution of the book.
I hope I don’t offend Kent with my long commentaries and errata lists. I like reviewing books. you get so much to think about and to take the auhtors thoughts further along the road.
Kent has set up a mailing list to discuss the content of the book and the importance of style. If one takes the metaphor furter, the values are the style, that is defined by the elements of style (i.e. princpiles) which get then implemented by the practices.