Errata for Refactoring
Here are the current known errors in the Refactoring book.
Many thanks to Mike Anderson, Alex Aptekman, Beth Egan Bradtke, Greg Cohoon, George Cowan, John Dale, Dion Dock, Jutta Eckstein, Paul Haahr, John Hollister, Heinz Kabutz, Bernd Kahlbrandt, Bart Koestner, Jung-joon Kim, Mark Kinzie, Hamish Lawson, Hwijae Lee, Jaeik Lee, Marc Lepage, Ron Lusk, Rory Molinari, Anthon van der Neut, Orjan Petersson, Jon Reid, Oliver Rode, Phil Rodgers, Gavin Scott, Patricia Shanahan, Pradyumn Sharma, Joel Smith, Ellen Spertus, Dawie Strauss, Frank Tip, Madhavi Tolety, Bill Wake and Hirohide Yazaki for spotting and telling me about these errors
Errors in the eighth (and later) printing
Page 2:
In the first paragraph "and identifies the type movie" should read "and identifies the type of movie".
Page 12:
I've been asked for more information about the double to int rounding. It happens when you have a compound assignment. In other words
int foo=1;
foo += 1.5;
compiles, as it is equivalent to
int foo = 1;
foo = (int) (foo + 1.5);
I haven't looked into the rationale behind this. (see Java Language Specification, section 15.26.2)
Page 40:
In the code examples on pages 40 and 41 the references to the field _name
should instead be _title
Page 98:
The method testReadAtEnd
is incorrect. I looked at my source files and found the method there to say
public void testReadAtEnd() throws IOException {
int ch = -1234;
for (int i = 0; i < 141; i++)
ch = _input.read();
assertEquals("read at end", -1, _input.read());
}
Another reason to be glad that these days I'm auto-inserting source code!
Page 115:
In the third line, "rerun" should be "return"
Page 120:
In the solution statement the phrase "Replace all references to the temp with the expression" should be replaced with "Replace all references to the temp with the new method"
Page 121:
This was an incorrect fix to an earlier error. In the last line of the mechanics the refactoring 'Replace Temp with Inline Temp' should read 'Inline Temp'. The same problem occurs on page 122.
Page 153:
In the second para, third line "As discussed in Lea by section..." should read "As discussed in Lea in section...."
Page 176:
In the second para, (a step in the mechanics) "change the getting method" should read "change the setting method"
Page 185:
In the second paragraph "biwise xor" shoudl read "bitwise xor"
Page 222:
At the bottom of the page I make the method getCode
private. I obviously can't do that while any clients of BloodGroup are using the method.
Page 225:
The first mention of the create
method is missing the static keyword.
Page 240:
On this page and on later pages I use the method isNotEligibleForDisability. Since my spell checker doesn't look at code it didn't tell me that the correct spelling is Eligable.
Page 301:
There are problems with the example, see the discussion in RemoveSettingMethod.
Page 363:
The references to the refactorings on this page are cross referenced with chapter references rather than the usual page references. Worse still, the chapter for Extract Class should be Chapter 7.
Errors in the fifth through eighth printing
Page 2:
In the first paragraph "and identifies the type movie" should read "and identifies the type of movie".
Page 12:
I've been asked for more information about the double to int rounding. It happens when you have a compound assignment. In other words
int foo=1;
foo += 1.5;
compiles, as it is equivalent to
int foo = 1;
foo = (int) (foo + 1.5);
I haven't looked into the rationale behind this. (see Java Language Specification, section 15.26.2)
Page 25 :
Caption on fig 1.7 "Sequence diagram before extraction..." should be "Sequence diagram after extraction..."
[Corrected in the 8th Printing]
Page 40:
In the code examples on pages 40 and 41 the references to the field _name
should instead be _title
Page 76 :
3rd para in "Duplicated Code". "in both classes then Pull Up Field (320)" should read "in both classes then Pull Up Method (322)"
[Corrected in the 8th Printing]
Page 98:
The method testReadAtEnd
is incorrect. I looked at my source files and found the method there to say
public void testReadAtEnd() throws IOException {
int ch = -1234;
for (int i = 0; i < 141; i++)
ch = _input.read();
assertEquals("read at end", -1, _input.read());
}
Another reason to be glad that these days I'm auto-inserting source code!
Page 115:
In the third line, "rerun" should be "return"
Page 120:
In the solution statement the phrase "Replace all references to the temp with the expression" should be replaced with "Replace all references to the temp with the new method"
Page 121 :
In the last step of the mechanics, I say to use Replace Temp with Query (120), this should be replaced with a reference to Inline Temp (119). Otherwise I'd get a recursive refactoring. The problem continues in the example on page 122 where again the cross reference should be to Inline Temp (119). This was fixed incorrectly in the 8th printing (see below)
[Corrected in the 8th Printing]
Page 121:
This was an incorrect fix to an earlier error. In the last line of the mechanics the refactoring 'Replace Temp with Inline Temp' should read 'Inline Temp'. The same problem occurs on page 122.
Page 153:
In the second para, third line "As discussed in Lea by section..." should read "As discussed in Lea in section...."
Page 176:
In the second para, (a step in the mechanics) "change the getting method" should read "change the setting method"
Page 176 :
In the method numberOfOrdersFor
the line that reads if (each.getCustomerName().equals(customer)) result++;
should read if (each.getCustomer().equals(customer)) result++;
[Corrected in the 8th Printing]
Page 177 :
In the first state of the method setCustomer
the line that reads _customer = new Customer (customer);
should read _customer = new Customer (arg);
[Corrected in the 8th Printing]
Page 185:
In the second paragraph "biwise xor" shoudl read "bitwise xor"
Page 219 :
"In a paragraph at around the middle of page, the sentence "...need a new method that returns the code" should read "...need a new method that returns an instance of the new class."
[Corrected in the 8th Printing]
Page 222 :
"In the crossed out code, the method "public int getBloodGroup() {"
should be "public int getBloodGroupCode() {"
(I had just renamed it!)"
[Corrected in the 8th Printing]
Page 222:
At the bottom of the page I make the method getCode
private. I obviously can't do that while any clients of BloodGroup are using the method.
Page 225:
The first mention of the create
method is missing the static keyword.
Page 240:
On this page and on later pages I use the method isNotEligibleForDisability. Since my spell checker doesn't look at code it didn't tell me that the correct spelling is Eligable.
Page 285 :
The before code contains a rather more serious error than the refactoring is meant to help with as the assertion is always executed.
The before code should read:
void setValue (String name, int value) {
if (name.equals("height")) {
_height = value;
return;
}
if (name.equals("width")) {
_width = value;
return;
}
Assert.shouldNeverReachHere();
}
[Corrected in the 8th Printing]
Page 301:
There are problems with the example, see the discussion in RemoveSettingMethod.
Page 313 :
The line of code that says
Assert.isTrue("amount too large", amount > _balance);
is in error as the sense of the boolean is the wrong way round. A better line would be
Assert.isTrue("sufficient funds", amount <= _balance);
[Corrected in the 8th Printing]
Page 324 :
In the top code example the line double chargeAmount = charge (lastBillDate, date)
should read double chargeAmount = chargeFor (lastBillDate, date)
. (I got the method name inconsistent with the diagrams.)
[Corrected in the 8th Printing]
Page 328 :
In the motivation paragraph "Pull Down Method" should read "Push Down Method". (This is what happens when I don't use links for everything!)
[Corrected in the 8th Printing]
Page 363:
The references to the refactorings on this page are cross referenced with chapter references rather than the usual page references. Worse still, the chapter for Extract Class should be Chapter 7.
Errors in the fourth printing
Page xx :
"Joshua suggested the idea of code sketches" should read "Joshua Kerievsky suggested the idea of code sketches"
[Corrected in the 5th Printing]
Page 2:
In the first paragraph "and identifies the type movie" should read "and identifies the type of movie".
Page 12:
I've been asked for more information about the double to int rounding. It happens when you have a compound assignment. In other words
int foo=1;
foo += 1.5;
compiles, as it is equivalent to
int foo = 1;
foo = (int) (foo + 1.5);
I haven't looked into the rationale behind this. (see Java Language Specification, section 15.26.2)
Page 25 :
Caption on fig 1.7 "Sequence diagram before extraction..." should be "Sequence diagram after extraction..."
[Corrected in the 8th Printing]
Page 40:
In the code examples on pages 40 and 41 the references to the field _name
should instead be _title
Page 76 :
3rd para in "Duplicated Code". "in both classes then Pull Up Field (320)" should read "in both classes then Pull Up Method (322)"
[Corrected in the 8th Printing]
Page 98:
The method testReadAtEnd
is incorrect. I looked at my source files and found the method there to say
public void testReadAtEnd() throws IOException {
int ch = -1234;
for (int i = 0; i < 141; i++)
ch = _input.read();
assertEquals("read at end", -1, _input.read());
}
Another reason to be glad that these days I'm auto-inserting source code!
Page 115:
In the third line, "rerun" should be "return"
Page 120:
In the solution statement the phrase "Replace all references to the temp with the expression" should be replaced with "Replace all references to the temp with the new method"
Page 121 :
In the last step of the mechanics, I say to use Replace Temp with Query (120), this should be replaced with a reference to Inline Temp (119). Otherwise I'd get a recursive refactoring. The problem continues in the example on page 122 where again the cross reference should be to Inline Temp (119). This was fixed incorrectly in the 8th printing (see below)
[Corrected in the 8th Printing]
Page 121:
This was an incorrect fix to an earlier error. In the last line of the mechanics the refactoring 'Replace Temp with Inline Temp' should read 'Inline Temp'. The same problem occurs on page 122.
Page 153:
In the second para, third line "As discussed in Lea by section..." should read "As discussed in Lea in section...."
Page 176:
In the second para, (a step in the mechanics) "change the getting method" should read "change the setting method"
Page 176 :
In the method numberOfOrdersFor
the line that reads if (each.getCustomerName().equals(customer)) result++;
should read if (each.getCustomer().equals(customer)) result++;
[Corrected in the 8th Printing]
Page 177 :
In the first state of the method setCustomer
the line that reads _customer = new Customer (customer);
should read _customer = new Customer (arg);
[Corrected in the 8th Printing]
Page 185:
In the second paragraph "biwise xor" shoudl read "bitwise xor"
Page 193 :
"to declare that interval window implements Observable" should read "to declare that interval window implements Observer" [Corrected in the 5th Printing]
Page 219 :
"In a paragraph at around the middle of page, the sentence "...need a new method that returns the code" should read "...need a new method that returns an instance of the new class."
[Corrected in the 8th Printing]
Page 222 :
"In the crossed out code, the method "public int getBloodGroup() {"
should be "public int getBloodGroupCode() {"
(I had just renamed it!)"
[Corrected in the 8th Printing]
Page 222:
At the bottom of the page I make the method getCode
private. I obviously can't do that while any clients of BloodGroup are using the method.
Page 225:
The first mention of the create
method is missing the static keyword.
Page 240:
On this page and on later pages I use the method isNotEligibleForDisability. Since my spell checker doesn't look at code it didn't tell me that the correct spelling is Eligable.
Page 261 :
In Ron's story, 4th para, "Of course, as soon as you being inspecting..." but should be "Of course, as soon as you begin
inspecting..."
[Corrected in the 5th Printing]
Page 285 :
The before code contains a rather more serious error than the refactoring is meant to help with as the assertion is always executed.
The before code should read:
void setValue (String name, int value) {
if (name.equals("height")) {
_height = value;
return;
}
if (name.equals("width")) {
_width = value;
return;
}
Assert.shouldNeverReachHere();
}
[Corrected in the 8th Printing]
Page 300 :
In the mechanics section the field should be made final at the end
of process not at the begining.
[Corrected in the 5th Printing]
Page 301:
There are problems with the example, see the discussion in RemoveSettingMethod.
Page 307 :
"Another reason to be wary of class.forName is that..."
should be:
"Another reason to be wary of Class.forName is that..." (Class should have a capital C)
[Corrected in the 5th Printing]
Page 307 :
"I can use a differenct approach...."
should be:
"I can use a different approach..." (spelling) [Corrected in the 5th Printing]
Page 311 :
"If the exception us checked, adjust the callers..."
should be:
"If the exception is checked, adjust the callers..."
[Corrected in the 5th Printing]
Page 313 :
The line of code that says
Assert.isTrue("amount too large", amount > _balance);
is in error as the sense of the boolean is the wrong way round. A better line would be
Assert.isTrue("sufficient funds", amount <= _balance);
[Corrected in the 8th Printing]
Page 324 :
In the top code example the line double chargeAmount = charge (lastBillDate, date)
should read double chargeAmount = chargeFor (lastBillDate, date)
. (I got the method name inconsistent with the diagrams.)
[Corrected in the 8th Printing]
Page 328 :
In the motivation paragraph "Pull Down Method" should read "Push Down Method". (This is what happens when I don't use links for everything!)
[Corrected in the 8th Printing]
Page 333 :
"arguments are needed by the labor item, and some are not"
should be: "some arguments are needed..." (missing word) [Corrected in the 5th Printing]
Page 346 :
"Whenever we see two similar method" should be: "Whenever we
see two similar methods" (plural) [Corrected in the 5th Printing]
Page 346 :
"The statement method prints statements" should be: "The
statement
method prints statements" (font) [Corrected in the 5th Printing]
Page 363:
The references to the refactorings on this page are cross referenced with chapter references rather than the usual page references. Worse still, the chapter for Extract Class should be Chapter 7.
Errors in the third printing
Page xx :
"Joshua suggested the idea of code sketches" should read "Joshua Kerievsky suggested the idea of code sketches"
[Corrected in the 5th Printing]
Page 2:
In the first paragraph "and identifies the type movie" should read "and identifies the type of movie".
Page 12:
I've been asked for more information about the double to int rounding. It happens when you have a compound assignment. In other words
int foo=1;
foo += 1.5;
compiles, as it is equivalent to
int foo = 1;
foo = (int) (foo + 1.5);
I haven't looked into the rationale behind this. (see Java Language Specification, section 15.26.2)
Page 25 :
Caption on fig 1.7 "Sequence diagram before extraction..." should be "Sequence diagram after extraction..."
[Corrected in the 8th Printing]
Page 40:
In the code examples on pages 40 and 41 the references to the field _name
should instead be _title
Page 76 :
3rd para in "Duplicated Code". "in both classes then Pull Up Field (320)" should read "in both classes then Pull Up Method (322)"
[Corrected in the 8th Printing]
Page 98:
The method testReadAtEnd
is incorrect. I looked at my source files and found the method there to say
public void testReadAtEnd() throws IOException {
int ch = -1234;
for (int i = 0; i < 141; i++)
ch = _input.read();
assertEquals("read at end", -1, _input.read());
}
Another reason to be glad that these days I'm auto-inserting source code!
Page 115:
In the third line, "rerun" should be "return"
Page 120:
In the solution statement the phrase "Replace all references to the temp with the expression" should be replaced with "Replace all references to the temp with the new method"
Page 121 :
In the last step of the mechanics, I say to use Replace Temp with Query (120), this should be replaced with a reference to Inline Temp (119). Otherwise I'd get a recursive refactoring. The problem continues in the example on page 122 where again the cross reference should be to Inline Temp (119). This was fixed incorrectly in the 8th printing (see below)
[Corrected in the 8th Printing]
Page 121:
This was an incorrect fix to an earlier error. In the last line of the mechanics the refactoring 'Replace Temp with Inline Temp' should read 'Inline Temp'. The same problem occurs on page 122.
Page 153:
In the second para, third line "As discussed in Lea by section..." should read "As discussed in Lea in section...."
Page 176:
In the second para, (a step in the mechanics) "change the getting method" should read "change the setting method"
Page 176 :
In the method numberOfOrdersFor
the line that reads if (each.getCustomerName().equals(customer)) result++;
should read if (each.getCustomer().equals(customer)) result++;
[Corrected in the 8th Printing]
Page 177 :
In the first state of the method setCustomer
the line that reads _customer = new Customer (customer);
should read _customer = new Customer (arg);
[Corrected in the 8th Printing]
Page 185:
In the second paragraph "biwise xor" shoudl read "bitwise xor"
Page 193 :
"to declare that interval window implements Observable" should read "to declare that interval window implements Observer" [Corrected in the 5th Printing]
Page 219 :
"In a paragraph at around the middle of page, the sentence "...need a new method that returns the code" should read "...need a new method that returns an instance of the new class."
[Corrected in the 8th Printing]
Page 222 :
"In the crossed out code, the method "public int getBloodGroup() {"
should be "public int getBloodGroupCode() {"
(I had just renamed it!)"
[Corrected in the 8th Printing]
Page 222:
At the bottom of the page I make the method getCode
private. I obviously can't do that while any clients of BloodGroup are using the method.
Page 225:
The first mention of the create
method is missing the static keyword.
Page 240:
On this page and on later pages I use the method isNotEligibleForDisability. Since my spell checker doesn't look at code it didn't tell me that the correct spelling is Eligable.
Page 241 :
In the code examples at the bottom of the page, the method isEligibleForDisability
should be isNotEligibleForDisability [Corrected in the 4th Printing]
Page 261 :
In Ron's story, 4th para, "Of course, as soon as you being inspecting..." but should be "Of course, as soon as you begin
inspecting..."
[Corrected in the 5th Printing]
Page 285 :
The before code contains a rather more serious error than the refactoring is meant to help with as the assertion is always executed.
The before code should read:
void setValue (String name, int value) {
if (name.equals("height")) {
_height = value;
return;
}
if (name.equals("width")) {
_width = value;
return;
}
Assert.shouldNeverReachHere();
}
[Corrected in the 8th Printing]
Page 300 :
In the mechanics section the field should be made final at the end
of process not at the begining.
[Corrected in the 5th Printing]
Page 301:
There are problems with the example, see the discussion in RemoveSettingMethod.
Page 307 :
"Another reason to be wary of class.forName is that..."
should be:
"Another reason to be wary of Class.forName is that..." (Class should have a capital C)
[Corrected in the 5th Printing]
Page 307 :
"I can use a differenct approach...."
should be:
"I can use a different approach..." (spelling) [Corrected in the 5th Printing]
Page 311 :
"If the exception us checked, adjust the callers..."
should be:
"If the exception is checked, adjust the callers..."
[Corrected in the 5th Printing]
Page 313 :
The line of code that says
Assert.isTrue("amount too large", amount > _balance);
is in error as the sense of the boolean is the wrong way round. A better line would be
Assert.isTrue("sufficient funds", amount <= _balance);
[Corrected in the 8th Printing]
Page 315 :
The problem statement should read "You are throwing an exception
on a condition the caller could have checked first" (the refactoring applies to all exceptions, not just checked ones)
[Corrected in the 4th Printing]
Page 324 :
In the top code example the line double chargeAmount = charge (lastBillDate, date)
should read double chargeAmount = chargeFor (lastBillDate, date)
. (I got the method name inconsistent with the diagrams.)
[Corrected in the 8th Printing]
Page 328 :
In the motivation paragraph "Pull Down Method" should read "Push Down Method". (This is what happens when I don't use links for everything!)
[Corrected in the 8th Printing]
Page 333 :
"arguments are needed by the labor item, and some are not"
should be: "some arguments are needed..." (missing word) [Corrected in the 5th Printing]
Page 346 :
"Whenever we see two similar method" should be: "Whenever we
see two similar methods" (plural) [Corrected in the 5th Printing]
Page 346 :
"The statement method prints statements" should be: "The
statement
method prints statements" (font) [Corrected in the 5th Printing]
Page 363:
The references to the refactorings on this page are cross referenced with chapter references rather than the usual page references. Worse still, the chapter for Extract Class should be Chapter 7.
Errors in the first and second printings
Page xx :
"Joshua suggested the idea of code sketches" should read "Joshua Kerievsky suggested the idea of code sketches"
[Corrected in the 5th Printing]
Page 2:
In the first paragraph "and identifies the type movie" should read "and identifies the type of movie".
Page 12:
I've been asked for more information about the double to int rounding. It happens when you have a compound assignment. In other words
int foo=1;
foo += 1.5;
compiles, as it is equivalent to
int foo = 1;
foo = (int) (foo + 1.5);
I haven't looked into the rationale behind this. (see Java Language Specification, section 15.26.2)
Page 25 :
Caption on fig 1.7 "Sequence diagram before extraction..." should be "Sequence diagram after extraction..."
[Corrected in the 8th Printing]
Page 37 :
"Class rental" should be "class Rental" (capitalization) and "class
movie" should be "class Movie" (capitalization)
[Corrected in the 3rd Printing]
Page 40:
In the code examples on pages 40 and 41 the references to the field _name
should instead be _title
Page 48 :
The second line: "class Rental..." should be: "class Movie..." [Corrected in the 3rd Printing]
Page 70 :
Steve McConnell's last name is misspelled in two places. [Corrected in the 3rd Printing]
Page 76 :
3rd para in "Duplicated Code". "in both classes then Pull Up Field (320)" should read "in both classes then Pull Up Method (322)"
[Corrected in the 8th Printing]
Page 82 :
The sentence "If you add a new clause to the switch, you have to find all these switch, statements and change them." The second comma should be removed.
[Corrected in the 3rd Printing]
Page 85 :
"Replace Delegation with Inheritance (355)" in Inappropriate Intimacy should be "Replace Inheritance with Delegation (352)" [Corrected in the 3rd Printing]
Page 92 :
On Figure 4.1 the line from TestSuite to Test should be an association
not a generalization (see diagram below). Also the
package name should be junit.framework.
[Corrected in the 3rd Printing]
Page 92 :
In the test file for the example, George Headley's career total was actually 2190 test riuns.
[Corrected in the 3rd Printing]
Page 98:
The method testReadAtEnd
is incorrect. I looked at my source files and found the method there to say
public void testReadAtEnd() throws IOException {
int ch = -1234;
for (int i = 0; i < 141; i++)
ch = _input.read();
assertEquals("read at end", -1, _input.read());
}
Another reason to be glad that these days I'm auto-inserting source code!
Page 115 :
In the second sentence, "oustanding" should be "outstanding"
[Corrected in the 3rd Printing]
Page 115:
In the third line, "rerun" should be "return"
Page 120:
In the solution statement the phrase "Replace all references to the temp with the expression" should be replaced with "Replace all references to the temp with the new method"
Page 121 :
In the last step of the mechanics, I say to use Replace Temp with Query (120), this should be replaced with a reference to Inline Temp (119). Otherwise I'd get a recursive refactoring. The problem continues in the example on page 122 where again the cross reference should be to Inline Temp (119). This was fixed incorrectly in the 8th printing (see below)
[Corrected in the 8th Printing]
Page 121:
This was an incorrect fix to an earlier error. In the last line of the mechanics the refactoring 'Replace Temp with Inline Temp' should read 'Inline Temp'. The same problem occurs on page 122.
Page 153:
In the second para, third line "As discussed in Lea by section..." should read "As discussed in Lea in section...."
Page 176:
In the second para, (a step in the mechanics) "change the getting method" should read "change the setting method"
Page 176 :
In the method numberOfOrdersFor
the line that reads if (each.getCustomerName().equals(customer)) result++;
should read if (each.getCustomer().equals(customer)) result++;
[Corrected in the 8th Printing]
Page 177 :
In the first state of the method setCustomer
the line that reads _customer = new Customer (customer);
should read _customer = new Customer (arg);
[Corrected in the 8th Printing]
Page 185:
In the second paragraph "biwise xor" shoudl read "bitwise xor"
Page 193 :
"to declare that interval window implements Observable" should read "to declare that interval window implements Observer" [Corrected in the 5th Printing]
Page 219 :
"In a paragraph at around the middle of page, the sentence "...need a new method that returns the code" should read "...need a new method that returns an instance of the new class."
[Corrected in the 8th Printing]
Page 222 :
"In the crossed out code, the method "public int getBloodGroup() {"
should be "public int getBloodGroupCode() {"
(I had just renamed it!)"
[Corrected in the 8th Printing]
Page 222:
At the bottom of the page I make the method getCode
private. I obviously can't do that while any clients of BloodGroup are using the method.
Page 225:
The first mention of the create
method is missing the static keyword.
Page 240:
On this page and on later pages I use the method isNotEligibleForDisability. Since my spell checker doesn't look at code it didn't tell me that the correct spelling is Eligable.
Page 241 :
In the code examples at the bottom of the page, the method isEligibleForDisability
should be isNotEligibleForDisability [Corrected in the 4th Printing]
Page 261 :
In Ron's story, 4th para, "Of course, as soon as you being inspecting..." but should be "Of course, as soon as you begin
inspecting..."
[Corrected in the 5th Printing]
Page 285 :
The before code contains a rather more serious error than the refactoring is meant to help with as the assertion is always executed.
The before code should read:
void setValue (String name, int value) {
if (name.equals("height")) {
_height = value;
return;
}
if (name.equals("width")) {
_width = value;
return;
}
Assert.shouldNeverReachHere();
}
[Corrected in the 8th Printing]
Page 300 :
In the mechanics section the field should be made final at the end
of process not at the begining.
[Corrected in the 5th Printing]
Page 301:
There are problems with the example, see the discussion in RemoveSettingMethod.
Page 307 :
"Another reason to be wary of class.forName is that..."
should be:
"Another reason to be wary of Class.forName is that..." (Class should have a capital C)
[Corrected in the 5th Printing]
Page 307 :
"I can use a differenct approach...."
should be:
"I can use a different approach..." (spelling) [Corrected in the 5th Printing]
Page 311 :
"If the exception us checked, adjust the callers..."
should be:
"If the exception is checked, adjust the callers..."
[Corrected in the 5th Printing]
Page 313 :
The line of code that says
Assert.isTrue("amount too large", amount > _balance);
is in error as the sense of the boolean is the wrong way round. A better line would be
Assert.isTrue("sufficient funds", amount <= _balance);
[Corrected in the 8th Printing]
Page 315 :
The problem statement should read "You are throwing an exception
on a condition the caller could have checked first" (the refactoring applies to all exceptions, not just checked ones)
[Corrected in the 4th Printing]
Page 324 :
In the top code example the line double chargeAmount = charge (lastBillDate, date)
should read double chargeAmount = chargeFor (lastBillDate, date)
. (I got the method name inconsistent with the diagrams.)
[Corrected in the 8th Printing]
Page 328 :
In the motivation paragraph "Pull Down Method" should read "Push Down Method". (This is what happens when I don't use links for everything!)
[Corrected in the 8th Printing]
Page 333 :
"arguments are needed by the labor item, and some are not"
should be: "some arguments are needed..." (missing word) [Corrected in the 5th Printing]
Page 346 :
"Whenever we see two similar method" should be: "Whenever we
see two similar methods" (plural) [Corrected in the 5th Printing]
Page 346 :
"The statement method prints statements" should be: "The
statement
method prints statements" (font) [Corrected in the 5th Printing]
Page 355 :
first line of section "Motivation", "...Replace Delegation with Inheritance (355)" should read "Replace Inheritance with Delegation (352)" [Corrected in the 3rd Printing]
Page 363:
The references to the refactorings on this page are cross referenced with chapter references rather than the usual page references. Worse still, the chapter for Extract Class should be Chapter 7.
Page 390 :
"...vivc.edu" should be "uiuc.edu" [Corrected in the 3rd Printing]
Page 405 :
Parse tree for program should have "hello" (method name) in lower-case.
[Corrected in the 3rd Printing]
Page 405 :
Last box on bottom right should have "Hello World" (not "out") [Corrected in the 3rd Printing]
Page 414 :
Reference to JUnit in the URL "compuserv" should be "compuserve"
[Corrected in the 3rd Printing]
Corrected version of fig 4.1 on page 92.
***** 아름다운프로님에 의해서 게시물 복사 + 카테고리변경되었습니다 (2003-12-18 17:27)