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.
Version |
Location |
Description |
Submitted by |
Date submitted |
ePub |
Page ?
Chapter 9, Observer Pattern, code sample for "Model for List of Dependent Observers" |
I am unable to determine page number as Safari Books doesn't show page numbers.
you have a mysterious line of code in the example for Observer pattern which is simply:
i.e
Commenting the line out above allows code to run. And while I have your attention, there is a grammatical error:
"Stores a reference to the ConcreteSubject, implements an update interface for the Observer to ensure state is consistent with the Subject?s" is missing punctuation. It runs on to next sentence which doesn't make sense.
|
Anonymous |
Jul 21, 2013 |
Printed |
Page p. 227
reference #9 |
There is a typo in the author's surname. The correct spelling is "Maioriello".
|
James Maioriello |
Nov 02, 2013 |
Other Digital Version |
?
Module Pattern - JQuery Example |
I think there is a mistake in the following jQuery example:
function library( module ) {
$( function() {
if ( module.init ) {
module.init();
}
});
return module;
}
var myLibrary = library(function () {
return {
init: function () {
// module implementation
}
};
})();
The argument of the library function should be the new created library, so probably it should be:
function library( module ) {
$( function() {
if ( module.init ) {
module.init();
}
});
return module;
}
var myLibrary = library((function () {
return {
init: function () {
// module implementation
}
};
})());
Or alternatively:
function library( module ) {
$( function() {
if ( module.init ) {
module.init();
}
});
return module;
}
var myLibrary = library(function () {
return {
init: function () {
// module implementation
}
};
}());
|
Anonymous |
Feb 27, 2014 |
Other Digital Version |
middle of webpage: https://addyosmani.com/resources/essentialjsdesignpatterns/book/#detailflyweight |
The potential errors are located at https://addyosmani.com/resources/essentialjsdesignpatterns/book/#detailflyweight
Here is the code on the webpage:
"function testFlyweight(){
// The flavors ordered.
var flavors = new CoffeeFlavor(),
// The tables for the orders.
tables = new CoffeeOrderContext(),
// Number of orders made
ordersMade = 0,
// The CoffeeFlavorFactory instance
flavorFactory;
function takeOrders( flavorIn, table) {
flavors[ordersMade] = flavorFactory.getCoffeeFlavor( flavorIn );
tables[ordersMade++] = new CoffeeOrderContext( table );
}"
However, should flavors and tables be assigned arrays instead of assigning them "new CoffeeFlavor()" and "new CoffeeOrderContext()" like in the code? Shouldn't it be:
var flavors = []
and tables = []
?
Because "new CoffeeFlavor()" returns an object with methods getFlavor and serveCoffee, and "new CoffeeOrderContext()" returns an object with the method getTable. But in the code we see "flavors[ordersMade]" and "tables[ordersMade++]," where ordersMade is a number, originally assigned 0 (see code "ordersMade = 0,") which seems to only make sense if flavors and tables are arrays...
|
Anonymous |
May 22, 2016 |
|
C2S1
We Already Use Patterns Every Day |
I might be wrong, but when I ran the linked jsperf comparing getElementsByClassName and querySelectorAll, querySelectorAll was much faster: https://jsperf.com/getelementsbyclassname-vs-queryselectorall/5
However, the text states that getElementsByClassName is far faster.
Since you're talking about the facade pattern and jQuery use abstracting away this performance consideration, it's not a big deal, though vanilla JS gurus might do a double-take.
|
Thomas Danner |
Feb 27, 2018 |
PDF |
Page 15
Quote at the beginning of the chapter |
The quote: "A design pattern names, abstracts, and identifies the key aspects of a common design structure..." is originally from the Introduction -> What Is a Design Pattern? part in the GOF Design Patterns book.
|
Anonymous |
Aug 02, 2013 |
PDF |
Page 27
property myMethod2 |
Line:
console.log( "Caching is:" + ( this.myConfig.useCaching ) ? "enabled" : "disabled" );
should be:
console.log( "Caching is:" + ( this.myConfig.useCaching ? "enabled" : "disabled") );
|
Anto Jurkovic |
Oct 29, 2013 |
Printed |
Page 27
In myMethod2 |
I have question.
The Module Pattern:
In Object Literals
In myMethod2 there is line :
console.log("Caching is :"+ (this.myConfig.useCaching) ? "enabled" : "disabled");
But in output it showing : "enabled"
Why "Caching is enabled" not showing?
Thanks.
|
Sandip Patel |
Sep 11, 2019 |
PDF |
Page 31
end of basketModule |
basketModule ends with
}());
it should be
})();
|
Anto Jurkovic |
Oct 29, 2013 |
PDF, ePub |
Page 39
Code Block |
publicProperty: "I am also public"
needs a trailing comma.
publicProperty: "I am also public",
|
Brian Wilkinson |
Aug 22, 2013 |
Printed |
Page 101
end of 101, beginning of 102, August 2012 first print edition |
Here is the code on page 101 and 102 as well as on the webpage:
"function testFlyweight(){
// The flavors ordered.
var flavors = new CoffeeFlavor(),
// The tables for the orders.
tables = new CoffeeOrderContext(),
// Number of orders made
ordersMade = 0,
// The CoffeeFlavorFactory instance
flavorFactory;
function takeOrders( flavorIn, table) {
flavors[ordersMade] = flavorFactory.getCoffeeFlavor( flavorIn );
tables[ordersMade++] = new CoffeeOrderContext( table );
}"
However, should flavors and tables be assigned arrays instead of assigning them "new CoffeeFlavor()" and "new CoffeeOrderContext()" like in the code? Shouldn't it be:
var flavors = []
and tables = []
?
Because "new CoffeeFlavor()" returns an object with methods getFlavor and serveCoffee, and "new CoffeeOrderContext()" returns an object with the method getTable. But in the code we see "flavors[ordersMade]" and "tables[ordersMade++]," where ordersMade is a number, originally assigned 0 (see code "ordersMade = 0,") which seems to only make sense if flavors and tables are arrays...
|
Anonymous |
May 22, 2016 |
Printed, Other Digital Version |
Page 101
middle of page 101 in print book, also on github page https://gist.github.com/addyosmani/2668755 |
For the Flyweight coffee example, there's incorrect code on github and in the print book, but corrected code on addyosmani.com--
uncorrected on github and in print book:
https://gist.github.com/addyosmani/2668755
"getCoffeeFlavor: function (flavorName) {
var flavor = flavors[flavorName];
if (flavor === undefined) {
flavor = new CoffeeFlavor(flavorName);
flavors.push([flavorName, flavor]);
}
return flavor;
},"
corrected code located online at https://addyosmani.com/resources/essentialjsdesignpatterns/book/#detailflyweight
getCoffeeFlavor: function (flavorName) {
var flavor = flavors[flavorName];
if (typeof flavor === "undefined") {
flavor = new CoffeeFlavor(flavorName);
flavors[flavorName] = flavor;
length++;
}
return flavor;
},
|
Anonymous |
May 23, 2016 |
Printed, Other Digital Version |
Page 101
middle of page 101 in print book, also on github page https://gist.github.com/addyosmani/2668755 |
*I updated this report with a bit more code:
For the Flyweight coffee example, there's incorrect code on github and in the print book, but corrected code on addyosmani.com--
uncorrected on github and in print book:
https://gist.github.com/addyosmani/2668755
"function CoffeeFlavorFactory() {
var flavors = [];
getCoffeeFlavor: function (flavorName) {
var flavor = flavors[flavorName];
if (flavor === undefined) {
flavor = new CoffeeFlavor(flavorName);
flavors.push([flavorName, flavor]);
}
return flavor;
},"
corrected code located online at https://addyosmani.com/resources/essentialjsdesignpatterns/book/#detailflyweight
"function CoffeeFlavorFactory() {
var flavors = {},
length = 0;
getCoffeeFlavor: function (flavorName) {
var flavor = flavors[flavorName];
if (typeof flavor === "undefined") {
flavor = new CoffeeFlavor(flavorName);
flavors[flavorName] = flavor;
length++;
}
return flavor;
},"
|
Anonymous |
May 23, 2016 |
Printed |
Page 149
middle |
missing a [, so the printed book has this:
var shuffleColor = _.first(_.shuffle('#666','#333','#111']));
... should be this:
var shuffleColor = _.first(_.shuffle(['#666','#333','#111']));
|
gustavo palminha |
Sep 03, 2016 |