Tag Archives: Java

Review – Design Patterns in Java

Design Patterns in Java. Steve Metsker and William C. Wake. Addison-Wesley, 2006. I won’t review my own book, but I will summarize:

This is a workbook-style book, updating Steve’s earlier Design Patterns Java Workbook and Design Patterns in C#. It covers the same 23 patterns as Design Patterns, but adds some different perspective and a number of challenges to help you make sure you understand the patterns. It’s targeted to intermediate programmers, though more advanced programmers who want to brush up on patterns might consider it also. (May, ’06)

Review – Refactoring Workbook

Refactoring Workbook, William Wake. Addison-Wesley, 2003.

[Consider this a summary rather than a review my own book.] My goals were to create a workbook that helps people practice recognizing smells (problems) and learn to apply important refactoring techniques. There's a "smell finder" inside the covers to help lead you from symptoms to solutions. The table of contents and the book's home page are here.
(April, '06)

Pattern Patter: Anonymous Subclass with Instance Initializer

In JUnit Recipes, JB Rainsberger points out this idiom:

static final Set s = new HashSet() {{
  add("this");
  add("that");
  add("another");
}};

(JB points to an article by Paul Holser, which cites Dave Astels’ Test-Driven Development as the source.)

What’s it do? The new HashSet(){}; part creates an anonymous subclass (a new type of HashSet without any name). The inner braces are an instance initializer, run before the constructor (implicit and empty) of our new class. So this code creates a new Set, and fills its contents.

Napkin Look-and-Feel

The Napkin look-and-feel is designed to look like it's drawn on a napkin. The idea is that when the UI is at prototype level, the screens look that way. What a clever idea!

Most LAFs leave me a bit cold – they're changing things for the "cool" factor, not for any user benefit. This one is different – there's a reason for it. Two thumbs up!