Mistakes will happen

Here are the out and out mistakes that have turned up since the book was published. Many thanks to the following for pointing out these problems:
  • Sam Aaron,
  • Gus Gollings
  • Dean Holdren
  • John Hohlen
  • Jochen Hayek
  • Gary L. Johnson
  • Michael Nah
  • Glenn Ritz
  • Brian Uri
  • Juri Vainonen
  • Howard Wong
  • The French translation team of Laurent Julliard, Mikhail Kachakidze and Richard (with an ‘i’) Piacentini
  • The Japanese translation team, especially Yumeto Yamagishi and Yutaka Sugano

Preface / Page xxii

The final line of code on this page is missing some parentheses. The correct version is:

  (divisor == 0) && puts('Division by zero')

Preface / Page xxiii

The logic in the final line of code on this page is incorrect. The correct version is:

  file.eof? && puts('Reached end of file')

Chapter 1 / Page 12

The example at the bottom of the page would probably be better if the sunday_drive method called the start_engine and stop_engine methods instead of using @engine directly.

Chapter 2 / Page 32

The example of the for loop at the bottom of the page would be much improved if it included an actual for loop. The proper code is:

array = ['first', 'second', 'third']

for element in array
  puts element

Chapter 2 / Page 47

The text just before the code example mentions the Account class. This should be the BankAccount class.

Chapter 3 / Pages 66 and 67

In the code examples at the bottom of pages 66 and 67, the output_report method should call the output_body_start and output_body_end methods.

Chapter 3 / Page 68

The sentence just before the code example references a variable called formatter. It should be report.

Chapter 4 / Page 89

There is an ‘end’ missing from the code example in the middle of the page.

Chapter 5 / Pages 99-100

The sample output should report Fred’s new salary as 90000.0, not 80000.0 as shown incorrectly in the book. So much for stone age accounting.

Chapter 5 / Page 100

The class in the lower right of the UML diagram is incorrectly labeled Employee. It should be either Payroll or TaxMan.

Chapter 5 / Page 103

The last sentence in the footnote incorrectly says that calling super without an argument list will result in the super class method being called with the parameters name, title, salary and payroll_manager. In fact, since payroll_manager is not part of the original argument list it would not be passed by any call to super.

Chapter 5 / Page 105

Although not strictly a typo, it would have been better if I had noted that the observer added in the second code example can’t be removed because the code does not save a reference to the observer.

Chapter 6 / Pages 122

The name of the method in the last sentence on this page is incorrect. The correct method name is total_number_basic_tasks.

Chapter 7 / Page 131

The class name ArrayIterator is misspelled in the last paragraph on this page.

Chapter 8 / Page 143

There is one thing too many in the last sentence on this page.

Chapter 8 / Page 159

The DeleteEmployee.execute method, should call system.delete_employee(@number) not system.add_employee(@number)

Chapter 10 / Page 190

In the middle of the page, the kind of athletics that your code should not require are mental, not metal.

Chapter 11 / Page 201

The last sentance of the second paragraph refers to @component when it really means @real_writer.

Chapter 11 / Pages 201-203

The text refers several times to an non-existant write method. The correct method name name is write_line.

Chapter 14 / Page 256

In Figure 14-2, the uppermost horizonal arrow head should be solid: A Director is not an instance of a ComputerBuilder; rather it has a reference to a ComputerBuilder.

Chapter 15 / Page 271

The second non-code sentence from the bottom of the page should read:
With Or we can find all of the files that are either MP3s or bigger than 1K in one shot:

Chapter 18 / Pages 318-319

Several of the code examples on these pages refer to a non-existant message.text attribute. The correct name is message.body.

Also the adapters on this page define a send method instead of the correct send_message method.

Chapter 18 / Page 328

The 2nd bullet on the page refers to the Rails view directory. The correct directory name is plural: views.

Chapter 18 / Page 328

The first sentence of the third bullet should read:
Rails applications typically use ActiveRecord to talk to the database.