Posted on July 15, 2008 by Tommy McGuireHas anyone else noticed that many of the books from Apress are really not very good?
if (firstLink.getAttribute('href') =='search.html')
firstLink.setAttribute('href') = 'http://www.google.com';
This code immediately follows a paragraph saying,
The DOM specifications provide two methods to read and set attributes---getAttribute() and setAttribute(). The getAttribute() method takes one parameter---the attribute name; setAttribute() takes two parameters---the attribute name and the new value.
On the one hand, the code has clearly been formatted by a non-programmer, someone who has no particular experience with reading or writing code. (Of course, the paragraph doesn't sound like it was written by someone with no particular experience reading or writing.) On the other hand, it's just wrong. Not only does it not match the text, it is just wrong.
Similar problems plagued the Apress O'Caml book, which had simply atrocious code examples and was very poorly written.
I have heard many good reviews of the Apress Common Lisp book (and have a copy on my to-read shelf along with a couple of other Apress books which I have not noticed being so bad). But after these examples, I am dubious.
[Edit: added the missing "not".]