Posted tagged ‘design pattern’

Bitter Java – by Bruce Tate / Manning

August 28, 2008

A few years ago when I first read “Refactoring: Improving the Design of Existing Code” by Martin Fowler & Kent Beck I realized how many mistakes I have made in my projects.
Now reading “Bitter Java” by Bruce Tate I am somehow in the same situation:
I wish I had this book a few years ago.

The book is really full of antipatterns and ways to avoid them. Understanding antipatterns will help software developers prevent and recover from situations like spaghetti codes or ineffective algorithms to name only some of them.

The focus of this book is Java antipatterns and how to eliminate or reduce them.
The book has 3 parts and 11 chapters, a detailed table of contents, also a detailed index and, as a plus, a bibliography for additional resources. The book contains also examples of Java code that address specific issues in corresponding contents.

In my opinion the book is addressed to intermediate Java programmers or advanced programmers which know Java very well but they develop without a clear set of patterns in mind so they might identify here a lot of common mistakes (antipatterns).

As I said, it has 3 parts.
The first one is about design patterns, antipatterns, and about the Internet standards /technologies used in  server-side Java. Part 2 covers the most largely chapters of the book and provides detailed antipatterns in Java programming: about servlet antipatterns , MVC antipatterns, JSP antipatterns , cache management (why use cache, how to use a cache, problems/solutions, synchronizing the cache),
memories issues (memory leaks, lapsed listener leaks, problems/solutions)
and  also a very interesting example of an antipattern for String manipulation and for Collections .

A nice chapter and very useful for me was the chapter that talks about antipatterns related to connections and coupling, pool of connections, how to reuse a connection, how to clean-up a connection , why and how to use XML in order to decouple, even when to use XML and when the XML tends to become rigid.

The second part concludes with a chapter dedicated to Java Beans: old EJB technology (not 3.0). My opinion is that this chapter should not be “refactored”, but completely rewritten in the next edition of the book. Without this chapter, the book even if it is written in 2002 has the same actuality in 2008.

Part 3 talks about coding standards guidelines and performance: the author explains why study the programming hygiene, why should always addict to a coding standard (for naming conventions, braces, indentations, comments, structure of a method and of a class), why adopt convention for testing and why build a good style guide.

The last two chapters address scalability & performance issues:  topologies for performance, workload management, session management, tuning.
As it starts, the book ends also with a chapter dedicated to patterns/antipatterns.
I think that the main reason to read this book is written by the author here in the last chapter:
“Good programmers learn from their mistakes, but that costs time. Great programmers learn from the mistakes of others”

If your Java project isn’t going well or think that your team took a wrong direction I highly recommend reading this book.

You may buy this book from here:

Or from

Ionel Condor,
JUG Cluj Napoca, ROMANIA