Agile Java Errata
- 14
- Technically, the Agile Java definition of encapsulation is that of information hiding. A more precise definition of encapsulation is "the inclusion of both the methods and the data within an object." The Agile Java definition is still correct but is closer to the more generalized definition of encapsulation: "the incl1usion of one thing within another so that the included thing is not apparent." (See http://whatis.com.)
- 14
- In the first paragraph, "I send you a message to you" should read "I send you a message."
- 45
- The first sentence of the first paragraph is more accurately written as: "In the second statement, Java assigns the memory address of this returned String object to a String local variable, defined on the left hand of the statement as
studentName." - 45
- The caret in the first compilation error listing should appear directly beneath the letter
sinstudent.getName(). - 17
- The footnote reference should be [Fowler2003], not [Fowler2000].
- 62
- "Exercises appear at the end of lesson" should read "Exercises appear at the end of each lesson."
- 77
- In the first paragraph, replace:
Each time thegetNumberOfStudentsmessage is sent
with:
Each time thegetAllStudentsmessage is sent
- 77
- In Figure 2.4, the variable names listed in the table to the right should read
student1andstudent2. - 80
- Second to last sentence on the page, "CourseSesson" should be "CourseSession."
- 91
- The header for the page should read "Deprecation Warnings," not "Depreciation Warnings."
- 100
- The reference to TestPawn in exercises 1 should be changed to PawnTest.
- 101
- The reference to TestPawn in exercises 7 should be changed to PawnTest.
- 113
- In the third bullet, replace:
testReportconstructs its own CourseSession object
with:
testRosterReportconstructs its own CourseSession object
- 116
- In the code for
testCreateDate, replace:
Calendar calendar = new GregorianCalendar();
with:
GregorianCalendar calendar = new GregorianCalendar();
(I haven't talked about assignments to the interface type yet.) - 120
- replace:
If you haven't already done so, remove thetestReportmethod from CourseSessionTest
with:
If you haven't already done so, remove thetestRosterReportmethod from CourseSessionTest
- 120
- replace:
you can decompose the code inwriteReport
with:
you can decompose the code ingetReport
- 121
- At the start of the third paragraph, replace:
move thestudentinfopackage down a level so that it is in a package namedsis.reportinfo.
with:
move thestudentinfopackage down a level so that it is in a package namedsis.studentinfo.
- 123
- In the last paragraph, first sentence, replace:
from the code in thereportspackage
with:
from the code in thereportpackage
Also make the same replacement in the second paragraph on the page. - 139
- The first sentence of the 2nd paragraph should read "The CourseSessionTest method
testCount..." - 141
- The code should use the newer construct
session = createCourseSession();instead ofCourseSession.create(...) - 144
- In the third paragraph, "Supplies a a shortcut" should read "Supplies a shortcut."
- 169
- The first sentence of the first paragraph should read "You can use interfaces to break dependencies..."
- 170
- In the sidebar "More on this," replace:
In the StudentcompareTomethod
with:
In the CourseSessioncompareTomethod
- 180
- The Student class declaration should not include the clause
implements Comparable<Student> - 186
- The text in the first paragraph:
"Modify the Student code to obtain grade points by sending the gradePointsFor message"
should read:
"Modify the Student code to obtain grade points by sending the getGradePointsFor message" - 187
- The Student class declaration should not include the clause
implements Comparable<Student> - 199
- In the final paragraph in the Maps section, replace
Add a new class named ReportCardTest to the sis.reports package.
with:
Add a new class named ReportCardTest to the sis.report package. - 202
- The last sentence in the first paragraph should read "As a subclass, each of RegularGradingStrategy and HonorsGradingStrategy obtain all of the behaviors of BasicGradingStrategy."
- 228
- In the proposed example code, replace:
Session session = createSession(new Date());
with:
Session session = createSession("", "", new Date());
Better yet would be to add a createSession helper method that takes no arguments. - 228
- The first line in the second paragraph:
"The test method testCourseDates appears in both SessionTest subclasses."
should probably read:
"The need to verify the end date for a course is captured in tests for both subclasses: testEndDates in SummerCourseSessionTest and testCourseDates in CourseSessionTest." - 234
- The
whileloop example uses a StringBuffer instead of a StringBuilder. This really isn't a problem since we've already discussed StringBuffer, but under J2SE 5.0 you will probably want to prefer use of the new StringBuilder class. - 234
- The
tokenizemethod at the bottom of the page should be namedsplit. - 235
- Eliminate the line comment from the first code listing.
- 238
- In the
forloop statement inisPalindrome, the code should read:
forward++, backward--)i.e. with two hyphens (minus signs) after
backward. (It actually does have two hyphens, but the typeface used makes them appear as one.) - 242
- Fibonacci is a bad, bad example to use for recursion. Write a test that determines fib(100) and see how long it takes.
- 246
- The footnote should refer to BitSet, not "BitSit."
- 273
- "CheckedExceptinos" should be "CheckedExceptions."
- 338
- After adding
testKeys,getMessagesmethod should be changed topublic. - 342
- In Table 9.1, the entry for "range" is blank (and "range" should be in the sans serif font). The entry should read "Creates an enum set initially containing all of the elements in a from-to enum range."
- 372
- The story icon should appear beside the following paragraph, the one that starts with "You must assign passwords to students..."
- 374
- In the last paragraph, replace java.util.SecureRandom with java.security.SecureRandom.
- 441
- In the first code listing on the page, the assertion should read:
assertTrue(classes.contains("sis.testing.SuiteBuilderTest.class")); - 444
- Add the following code to the listing:
public TestSuite suite() { TestSuite suite = new TestSuite(); for (String className: gatherTestClassNames()) { Class klass = createClass(className); suite.addTestSuite(klass); } return suite; } - 479
- "The end balance should be $0." should read "The end balance should be $20."
- 528
- "You can quickly add some time safety" should be "You can quickly add some type safety"
- 597
- The bottom compartment in the diagram shown in Figure 6 should read "South." Duh.
- 690
- In the second line of the static initializer, the string literal should end with
\\ninstead of\\. - 693
- The method
getErrorOutputshould returnerrorOutput.toString(), notoutput.toString(). - 705
- With respect to the definition for encapsulation, see the errata entry above for page 14.
- 733
- [Bloch2001] should show Bloch, Joshua as the author of Effective Java Programming Language Guide
Site Search
Jeff on Twitter
Jeff Langr at LinkedIn
Latest Changes
-
Our Books
(2013-03-20) -
News: Beta Publication of Modern C++ Programming with TDD
(2013-03-20) -
New blog post, "A Story Isn't a Feature"
(2013-03-20) -
New blog post, "C++11: Using Lambdas to Support a Times-Repeat Loop"
(2013-03-20) -
New blog post, "C++11 Via TFL (Test-Focused Learning): The Range-Based For Loop"
(2013-02-19)


