When my party of three ran our first Class IV river, we found that many of
the paddling methods that had worked for us in the past were no longer sufficient.
When we ran a series of waterfalls called Five Falls, a few of us went over the first
rapid backward. One person flipped and had to swim ashore. Another flipped and
was rescued mere feet away from the start of the most dangerous rapid on the
river. We quickly learned to scout, ask questions, and understand where the trou-
blesome spots were likely to be. We needed to dive into the details.
In Part 2, we introduce common Java-based antipatterns in detail. We demon-
strate the problems through poor Java examples. Variations of our ongoing
application, a bulletin board system, are used throughout the topic. We will
iteratively improve it in chapters 3 through 8. We will attack antipatterns
related to basic model-view separation, caching, memory management, con-
nections, and EJB s.
As we dive into the details, we will see two central themes: resource man-
agement and organization. Server-side Java programmers must come to terms
with efficient management of connections, memory, files, and threads. Signifi-
cant portions of whole books have been written on this subject. Noted author
and Java guru John D. Mitchell warns that “the lack of clear thinking and
design in dealing with resources in Java is the crux issue for server-side Java
folks.” Indeed, several of the chapters focus on a single resource or technique
for resource optimization. Chapter 6 (on memory management) and