Old 04-02-2008, 08:35   #1 (permalink)
Hunch
Grumpy old man
 
Hunch's Avatar
 
Join Date: Oct 2007
Location: North Japan
Posts: 1,617
Not so bulletproof Mr. Keith

Picked up a copy of Jeremy Keith's Bulletproof Ajax because I'd heard it wasn't bad and I thought I'd see what his take on it was.

Found a stonking error on page 26.

Text reads as follows:

Quote:
It's important that something happens inside the curly braces to change the condition so that it eventually evaluates to false. Otherwise the loop will carry on forever. Here, the alert statement will be looped 5 times:

var i = 0;
while ( i < 5 ) {
alert (x);
x++;
}

Talk about ironically (and erroneously) illustrating your very point.
  Reply With Quote
Old 04-02-2008, 08:59   #2 (permalink)
MikeMackay
Everything is fine.
 
MikeMackay's Avatar
 
Join Date: Feb 2005
Location: Witham & London
Posts: 778
Send a message via MSN to MikeMackay Send a message via Skype™ to MikeMackay
Ha ha ha, well found. There's usually an errata page for the book where people can submit any errors found in it, but I can't find one for this book!

- Mike
  Reply With Quote
Old 04-02-2008, 09:08   #3 (permalink)
sub
Shitcasket™
 
sub's Avatar
 
Join Date: Jul 2005
Location: Brighton
Posts: 3,976
Send a message via MSN to sub Send a message via Skype™ to sub
Excellent. I'll have to rub his face in it when I see him.
He couldn't recommend the book highly enough when we first met!
__________________
  Reply With Quote
Old 04-02-2008, 09:12   #4 (permalink)
Hunch
Grumpy old man
 
Hunch's Avatar
 
Join Date: Oct 2007
Location: North Japan
Posts: 1,617
Yeah I found his errata page just before I posted, but it was blank, so I sent him a report. I'm (sort of) a Sussex boy myself actually - went to 6th form in Brighton back in the day.
  Reply With Quote
Old 04-02-2008, 09:51   #5 (permalink)
iblastoff
gotsa a malanga!
 
iblastoff's Avatar
 
Join Date: Apr 2006
Location: ottawa, canada
Posts: 489
ehhh. i would say 100% of all technical text in books have errors/typos in them.
__________________
  Reply With Quote
Old 04-02-2008, 10:08   #6 (permalink)
pgo
misanthrope
 
pgo's Avatar
 
Join Date: Jan 2005
Posts: 12,273
Written by a human being afterall. Great book.
__________________
  Reply With Quote
Old 04-02-2008, 10:32   #7 (permalink)
Mr Fred
Magazines™
 
Mr Fred's Avatar
 
Join Date: Mar 2003
Location: Glasgow..
Posts: 11,340
so whats going on then?
  Reply With Quote
Old 04-02-2008, 11:55   #8 (permalink)
pgo
misanthrope
 
pgo's Avatar
 
Join Date: Jan 2005
Posts: 12,273
Typos.
__________________
  Reply With Quote
Old 04-02-2008, 15:16   #9 (permalink)
combat sheep
Trained to Kill.
 
combat sheep's Avatar
 
Join Date: Oct 2006
Location: Southport, UK
Posts: 308
Send a message via MSN to combat sheep
how cool are you to find the mistake, maybe you should write a book called even more bullet proof ajax
  Reply With Quote
Old 04-02-2008, 15:17   #10 (permalink)
herkalees
Semantics, yay.
 
herkalees's Avatar
 
Join Date: Nov 2005
Location: Salem, Massachusetts
Posts: 1,106
"bullet proofer ajax"
__________________
  Reply With Quote
Old 04-02-2008, 18:30   #11 (permalink)
Hunch
Grumpy old man
 
Hunch's Avatar
 
Join Date: Oct 2007
Location: North Japan
Posts: 1,617
Quote:
Originally Posted by Mr Fred
so whats going on then?

It's a bit of code called a while loop. Basically it does the same operation over and over until a particular condition is satisfied, and it stops looping. In this case when a variable called 'i' (a stored value) reaches 5, the loop will exit and the program will continue. However in this case, the value of i never increases and always stays at its initial value of zero (he keeps adding to another variable called 'x' instead). Basically this code will keep causing the browser to produce endless popup alert boxes forever. Although I haven't tried it, it would probably annoy someone who tried to run it because alert boxes tend to control the mouse focus on OSs like Windows, so it might be difficult to kill.

The irony is that in the paragraph leading up to it, he warns about how mistakes in loops can make them endlessly repeat and then goes and makes that very same mistake.
  Reply With Quote
Old 05-02-2008, 05:40   #12 (permalink)
Bill Posters
trouble free and loverlee
 
Join Date: Mar 2003
Location: YooKay
Posts: 2,937
Quote:
it would probably annoy someone who tried to run it
…which Keith, presumably didn't.

I understand deadlines and all that malarkey, but I always find it odd that tech authors don't run every scrap of code they print/recommend before committing it to the book.
  Reply With Quote
Old 06-02-2008, 07:12   #13 (permalink)
Hunch
Grumpy old man
 
Hunch's Avatar
 
Join Date: Oct 2007
Location: North Japan
Posts: 1,617
I suppose he probably thought something that simple wouldn't need checking.
  Reply With Quote
Old 06-02-2008, 07:43   #14 (permalink)
haku
shiro
 
haku's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,214
Most likely.

My boss tasked me with learning to make yahoo widgets this week. So I downloaded the developers kit and was going through the reference manual, and found a few errors. Maybe Yahoo should take that offer from microsoft - it looks like they cant afford to hire proofreaders!
  Reply With Quote
Old 07-02-2008, 06:44   #15 (permalink)
Hunch
Grumpy old man
 
Hunch's Avatar
 
Join Date: Oct 2007
Location: North Japan
Posts: 1,617
Occasional proofreading errors I can cope with. I actually did a certain amount of freelance proofreading when I first came to Japan and it is very difficult to spot every single last mistake.

But when an author specifically issues advice about a problem, even going so far as to describe it as "important" and then fucks up and makes the very same mistake less than an inch further down the page, it just makes him look stupid.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8