Errata

Prefactoring

Errata for Prefactoring

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Other Digital Version 51
3

I'm looking at the PDFCHM .chm file: the section is the comment on paragraph 3 of 5.5 More Than One

There is an included reviewer comment:
"
[*] A reviewer noted that this is not true in languages such as Ruby and Groovy, which support closures. Closures let you apply arbitrary operations to generic collections without resorting to creating a specific collection class.
"

I think that this comment is a misapprehension about the intention of the design principle. The design principle is that if specific functions are applied to a collection of objects during the operation of the system, those functions should be encapsulated by creating a class that has those functions as members and holds the collection of child objects. In other words the collection is a proper business domain concept and therefore gets its own class.

The comment implies that this is not necessary in languages that use closures, with the further implication that the principle does not apply in those languages so that the closures could be created and used arbitrarily. Instead, I think that if the collection (set of objects + functions applied to the set) is a proper business domain concept, those closures should be implemented in a specific class or library (depending on what the language uses) that still encapsulates the concept.

In other words: whereas the principle is addressing OO (encapsulation of responsibility and hiding implementation detail), the comment focuses on a technical/language/syntax solution (that if misused would increase coupling).

Regards,
Will

Willllllllll  Aug 03, 2009 
Printed Page 150
Last Paragraph (code example)

The first if statement, according to the spec on page 149, should be:

if (number_of_rentals_in_last_month > 6)

instead of:

if (number_of_rentals_in_last_month > 5)

"I want to give a 5% discount if a customer rented _more_than_six_ CDDiscs in the past month ..."

Anonymous