J2EE AntiPatterns

by Bill Dudney, Stephen Asbury, Joseph Krozak, Kevin Wittkopf (2003)
Review date: May, 2009
Summary

An anti-pattern catalog for J2EE, that's what this book is. It sure delivers on its name. Roughly 50 anti-patterns and 40 refactorings are divided into ten chapters:

  1. Distribution and Scaling
  2. Persistence
  3. Service-based Architecture
  4. JSP Use and Misuse
  5. Servlets
  6. Entity beans
  7. Session EJBs
  8. Message-driven Beans
  9. Web Services
  10. J2EE Service

The list above includes pretty much all of J2EE. Apart from that, the book doesn't really contain any other text than on the patterns and refactorings.

Each chapter contains three to eight patterns described in a style not entirely different from GoF. Each pattern has a "front page" where a brief summary, containing lines such as "Also Known As", "Refactorings", and "Anecdotal Evidence" is given. Then follow the details organized around sections like "Background", "General Form" , "Symptoms and Consequences", "Refactorings", "Variations", and "Example". In fact, there are more sections for every pattern, but those are the ones that matter.

After the patterns come the refactorings, and the book ends with a pattern catalogue.

Opinion

My very first impression of this book was wtf, simply put. The anti-patterns in the first chapters are, in my opinion, not patterns at all, rather general architecture considerations. I was very disappointed, but kept reading, which was worth it! The book proved itself already in chapter two, by listing the DataVision pattern. This particular anti-pattern arises in cases where a poor database model drives the code in the layers above, the consequences of which are rather obvious. It was also here that I discovered the authors' love for colorful pattern and refactoring names. DataVision has friends called "Stifle", "Crush", and "Pack". Nobody should question the beauty of the name "Exodus", which is given a refactoring that appears later in the book. Of course, this is a record in "claim for fame", but I forgave that.

Ok, weak start and a plethora of colorful names. What else? Well... Sometimes too much text on trivial topics. Sometimes you get the feeling that you're reading the same things over and over again, as they seem to reappear in different sections. Also, some refactorings are very thoroughly explained, even though their mere names pretty much reveal what they do. Anyway, we let that pass, since we can't really blame authors for thoroughness.

Like in any book, you find things with which you don't agree. One of such things was the authors' lenient attitude about throwing more hardware at problems. Not a very creative solution.

A final complaint would be about the book's age. It's really, really J2EE, and thus a bit out of fashion. However, there are patterns in there that are transferable to never technologies. I'll get back to that soon.

What's good then? Well, it's a bit embarrassing, but this is the first book that has managed to clarify some J2EE concepts for me. By definition, it's about design by counterexample, which is very rare and valuable, since most books assume the form of tutorials covering the happy paths, not to mention the tutorials you find online. I could spend hours writing about the poor quality of online "hello world" tutorials!

So, the majority of the patterns describe concrete J2EE design solutions, and how to reason about them. It's also evident that the authors have been around and seen a few things. This makes this book completely stuffed with design/architecture experience.

I mentioned previously that the book is a bit out-of-date by concentrating so heavily on EJB 2.x and sometimes EJB 1. This is not so bad. First of all, many of us still maintain such solutions, secondly many of the patterns and issues are directly transferable to newer frameworks, such as Spring, that face the same problems, but without J2EE's rigorousness. In particular the material in the chapters about persistence and session beans is easily applied today.

A recurring insight is that patterns of today become the anti-patterns of tomorrow, and that one person's pattern is another's antipattern.

Given the easy of reading this book, I really recommend it, if you have worked, ore are working with J2EE. I promise some insights and a lot of chuckling while finding the designs applied in the systems you work with.

Who should read this book

People who maintain legacy EJB code will probably find the patterns in this book painfully applicable to the codebases they're maintaining. Those who've plowed through the vanilla EJB architecture books may find an antipattern approach refreshing.




News

  • 2015-09-29

    It's been almost one and a half year since I reviwed a book! I've been too absorbed by Writing my own. Anyway, I'm back with Jeff Patton's relatively...
  • 2014-01-04

    New category! Performance! Reviewed The Every Computer Performance Book. Check it out!
  • 2013-09-10

    Reviewed a book that' slightly less technical, but much more fun to read. It's I.T. Confidential.
  • 2013-08-13

    Reviewed yet another book on Visual Studio 2012 and TFS. I also created a "Microsoft" category and moved the other TFS book there from the "Tools"...
  • 2013-08-05

    Updated the FAQ. Included information about getting a book reviewed.