Design Patterns Java Workbook

 

 

 
 
Here is a list of errors in the first and second printings of "Design Patterns Java Workbook" that you should correct in your copy of the book. (And please accept my apologies for these errors.)

First and second printings (and thanks to Carlos Roberto Vieira da Silva for pointing out the differences):

  • On page 106, Mediator: At the top of the page, change "methods in PlaceATub" to "methods in PlaceATub_1". (Thanks to Alain Perry.)
  • On pages 115-129 (chapter 11), Proxy: Both the first ImageIconProxy and the second ImageIconLoader improperly call Swing methods (pack(), setImage()) from a non-GUI thread; they should use SwingWorker to be safe. Furthermore, ImageIconProxy exhibits a potential race condition: if the image icon is still loading while the GUI calls repaint() and paintIcon(), those methods may be using a partially constructed image. (Thanks to Joshua Hoke for pointing these out.)
  • On page 124, Mediator: In Figure 11.5, change the RocketImple() method to RocketImpl(...). (Thanks again to Alain.)
  • On page 188, Prototype: In Figure 18.3, change the MachineSimulation() constructor to MachineSimulator(). (Thanks again to Alain.)
  • On page 294, Decorator: Change the write() method near the top of the page to be write(cbuf[off + i]). (Thanks to Matt G. Ellis.)
  • On page 316, Iterator: In the last sentence of the first paragraph, change "the type Firework.Itr" to "the type FireworkList.Itr". (Thanks one more time to Alain!)
  • On page 416, Solution 22.5: Remove the d:Door argument from the status() method of the DoorState class. (Thanks again to Matt.)
  • On page 442, UML at a Glance: In Figure C.1 change double:price to price:double. (Thanks to John R. Daily)

First printing:

  • On page 27, Adapter: In Figure 3.6, move the i:int argument from getColumnCount() to getColumnName(). (Thanks to Simon Bennett for pointing this out.)
  • On page 53, Composite: In Figure 5.2, change the MachineComponent class's method to be getMachineCount(). (Thanks to Wagner Truppel for this catch.)
  • On page 58, Composite: In the last line of code on the page, change the public isTree(Set s) method to have protected visibility. (Thanks to Wagner Truppel.)
  • On page 62, Composite: In Figure 5.8 and in the corresponding Figure 8.4 in the Solutions (page 370), change the Alternation class to ProcessAlternation. (Thanks to Claus Nielsen.)
  • On page 91, Observer: In Figure 9.2, modify the burnPanel() and thrustPanel() methods in the ShowBallistics_1 class to have type return type BallisticsPanel_1. (Thanks to Wagner Truppel.)
  • On page 112, Mediator: In Figure 10.6, modify the getTubs() method in the Machine class to have return type Set. (Thanks to Wagner Truppel.) Also change the Mediator class's setMachine() method name to just set. (Thanks to Thierry Matusiak.)
  • On page 128, Proxy: Near the end of the first paragraph, change Rocket_Impl to be RocketImpl_Stub. (Thanks to Thierry Matusiak.)
  • On page 251, Command: Drop the first line of code on the page that sets an unused local fileMenu variable. (Thanks to Wagner Truppel.)
  • On page 256, Command: In Challenge 24.4, change the method name from setShutdownHook() to setMarkMoldIncompleteHook(). (This one I found myself!)
  • On page 265, Interpreter: In the second paragraph, change HasMoreMaterial to HasMaterial. (Thanks to Wagner Truppel.)
  • On page 359, Solutions: Strike the third-to-last bullet that erroneously suggests that an abstract class can be protected or private. (Thanks to Shun Nin Lau for pointing this out.)
  • On page 373, Solution 6.3: Change the MachineDriver interface and its implementors to have methods getQueueMax():int, start(), and stop(). Add a getQueue() method to the MachineController class. (Thanks to Alec Noronha for finding this.)
  • On page 384, Solution 10.4: Add to the Tub() constructor the statement this.mediator = mediator; (Thanks to Wagner Truppel.)

 

back to...
 

Copyright 1994-2020, William C. Wake - William.Wake@acm.org