Slashdot Mirror


Errata in Programming Books?

WgT2 asks: "I recently have set my mind to learning to code PHP. Not being a programmer, yet, I went out and got myself a book on the subject from a very trusted, at least in my eyes, publisher (and they still still are). So far so good. However once I got down to trying the code out myself I have found too much errata for someone who has just scratched the surface in learning the ins and outs of programming. I was wondering just how common place Slashdot readers have found errata in the code examples of programming books they have purchased?"

55 comments

  1. Publishers should hire college geeks to proof code by mildness · · Score: 1
    The original K & R C guide was legendary for it's coding errors.

    Why don't they care?

    Bill

    Also the chapter on pointers sucked ass.

    --
    bamph
  2. Frequently... by stefanlasiewski · · Score: 4, Interesting

    Tough subjects, tight deadlines, and the profit-first additude lead to bad books.

    I recently purchased Learning Java from Oreilly. Usually I've had a good experience with Oreilly books, but this one was horrible. Several of the examples in the first chapter of the book didn't work because they had typos!

    Few things are more frustrating then debugging a "Hello World" program that doesn't work. I went over every character, bit by bit, and my program matched their text exactly. I couldn't find the damn bug. Was I so stupid that I couldn't see the obvious? No! I viewed the Online Errata, and found that a zillion other people were having similar problems with examples throughout the book! Typos galore!

    If there are too many mistakes in the book, then let the publisher note. Return the book, get your money back, send a note to the publishers, and buy an alternative book.

    --
    "Can of worms? The can is open... the worms are everywhere."
    1. Re:Frequently... by Anonymous Coward · · Score: 0
      Sadly, this seems to be the trend with O'Reilly books. In trying to decide upon a book recently, I did some reading of the amazon comments for the book (though I buy my books from bookpool), and many of the O'Reilly books had comments about typos, code examples that didn't work, and even some formatting markup that made it into the book.

      My theory is that O'Reilly has decided to cash in on their popularity while they are still considered the dominant computer book publisher. The explosion of titles from O'Reilly indicates this and probably also explains the lapse in quality.

      Anybody have any inside info?

    2. Re:Frequently... by Monkelectric · · Score: 1
      I had a quick stint in the technical-book field and I can tell you, you are dead on the money!

      Much like the production process of films, TV, Music and Radio, book production is *COMPLETLEY* bankrupt. My own experience was, a well known publisher wanted to do a book on network programming and my friend and I were asked to submit a proposal. Long story short, they couldn't make up their mind -- they wanted a simple "network programming for dummies" type book, so we gave them that... Then that was too simple for them and they wanted something more indepth -- but still accessable. We responded with a proposal for "Practical Network Programming" which covered a little theory and about as much information as you would need to write any kind of normal application, but not much more. Then they changed their minds again and asked for something along the lines of a stevens book (if you dont know what a stevens book is thats ok. Stevens WROTE the TCP/IP RFC and his books are extremely detailed, weighing in at about 1200 pages, and are considered to be the definitive source of information on tcp/ip). After that we told them to f*** off.

      I find the problem I have is technical books are "wordy." Lots of words which dont accomplish anything :) Not surprisngly this is because authors are PAID BY THE PAGE.

      --

      Religion is a gateway psychosis. -- Dave Foley

  3. PHP by Anonymous Coward · · Score: 0

    Don't learn PHP first; you'll just join the ranks of amatuer programmers making webapps that get 0wned. Learn perl or Java or C. Somehow, PHP just always seems to make for shitty coders.

    1. Re:PHP by tha_mink · · Score: 2, Funny

      yeah...learn perl so when there is a REAL explosion at the punctuation factory, you'll know what to do.

      --
      You'll have that sometimes...
    2. Re:PHP by Anonymous Coward · · Score: 0

      +1 Funny. Should have saved my mod point

    3. Re:PHP by Anonymous Coward · · Score: 0

      What to learn first really depends on the environment in which you're learning, so you can't just throw out "learn X first". I found learning PHP first to be very helpful because, learning in isolation (at home, not for applicable work), the PHP community was very accessible with lots of amateur code and projects. From there, it was much easier for me to independently learn other languages like perl and C.

      Of course, the big caveat is that you then also should read a couple of extra books on good coding practices so you don't carry over the bad habits that might have infected you while slumming around amateur communities.

  4. It's very common by Hanashi · · Score: 2, Informative
    It's quite common to find errors in technical books. Some of them are simply typos, others are more complex. In the process of producing a book, the text goes through several hands. The author writes it, of course, then various editors all have their fingers in it. Generally they make it better (that's a plug, if my editors are reading 8-) but sometimes mistakes happen. Overall, writing a book is just such an enormous amount of work and there are so many people involved, mistakes are a given.

    Many (most?) books publish errata on their web pages or on their publisher's site. I've even got a few books that had printed errata folded up and stuck into the cover. I don't mind seeing a reasonable number of errors in a book, especially a very technically dense book, as long as I see that the author and/or publisher makes the errata sheets easily available. After all, we're all only human.

    --
    Check out my eclectic infosec blog at InfoSecPotpou
    1. Re:It's very common by Anonymous Coward · · Score: 0

      "After all, we're all only human."

      Well, all except Jon Katz...

    2. Re:It's very common by Telastyn · · Score: 1

      Indeed, especially on 'developing' languages like PHP. There's quite a bit of errata simply from syntax changes between when the book was published and 'current' version of the language. Most books will explicitly say "as of 3.14" or the such.

      btw: to learn PHP the best thing to do is to use their website. All of the functions are spelled out rather well.

  5. Don't know if I count... by Sentry21 · · Score: 1

    I was wondering just how common place Slashdot readers have found errata in the code examples of programming books they have purchased?

    I'm not really the most commonplace of Slashdot users, but I usually find errata by looking on the book's website, or trying the code. I suspect the more common-place of slashdotters use the same strategy.

    --Dan

  6. obligatory by Satai · · Score: 3, Interesting

    Someone has to make a Knuth joke. I tried, couldn't come up with anything. Come on people!

    Here's his errata.

    My favorite is the Random Number error. It took a while, but someone discovered that apparantly one of the portable random number generators behaves poorly during the first 2000 or so of each seed number. So, naturally, Dr. Knuth corrected it almost immediately.

    Never have I seen a man so humble that so amply deserved to be arrogant...

    1. Re:obligatory by Anonymous Coward · · Score: 0
      I doubt Donald Knuth spends all day reading slashdot, so your ass kissing is for naught.


      Although that would explain they delay in TAOCP volumes 4--7.

  7. I remember an old C graphics book I owned by dnight · · Score: 1
    The graphics routines were handwritten in ASM.

    I learned more debugging the errors in the printed code than I did in reading the frigging book.

    Twisted, huh?

  8. Thoughts from an O'Reilly Author by Anonymous Coward · · Score: 4, Interesting

    The book I wrote had quite a bit of errata with some simple topics, and not much on the hard topics. I simply didn't spend enough time on the first half of the book, and I regret it.

    What really killed my time was adding more content to the book than initially planned. I should have left it all out, but at the time I thought I had the rest of the book nailed down. I should have spent more time reviewing, and getting more feedback from the reviewers.

    If any of you write a book, be sure to stick to the initial plan, and do no more. You might even want to cut out some of the content... don't just write to add more pages to the book. That is one thing I hate about Wrox books, imho, and I did a little bit of that myself :-(

    Of course, there are always second printings, and second editions to incorporate the fixes, but that doesn't fix the disappointment of finding the errors in your own book the first time around.

    1. Re:Thoughts from an O'Reilly Author by MattCohn.com · · Score: 1

      From reading errors in O'Reilly books, I have to say it didn't bug me at all. Yes, I saw some (incorrectly matched start/end tags... etc.) but as I really already had the content down it wasn't a big deal.

  9. Don�t necessarily blame the author� by (H)elix1 · · Score: 2, Interesting

    More often than not, it is the editors who are at blame rather than the authors. First off, my bride was a technical writer. I'm still not quite sure what that means, but as an English / Math double major without any coding experience, some of the results were quite comical. A while back she was fixing the Engrish descriptions, code fragments, sql scripts, and a mix of other stuff. She went back to the developer because they possibly misspelled pseudo as sudo. She had the sense to not 'spell check' the scripts, but another friend who wrote a Perl book said his editors were not quite as thoughtful.

  10. Re:PHP [ OR ] by tha_mink · · Score: 1

    Or learn perl or c or java so you can join the ranks of people that answer a question like "I was wondering just how common place Slashdot readers have found errata in the code examples of programming books they have purchased?" with "Don't learn php".

    --
    You'll have that sometimes...
  11. Some authors plant the mistakes on purpose by Anonymous Coward · · Score: 0

    So you can learn how to debug.

    1. Re:Some authors plant the mistakes on purpose by larry+bagina · · Score: 1

      Yeah, I intentionally planted mistakes in my homework, too, just to make sure the teacher/ta was grading it correctly.

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

  12. One Recent Problem by TheWanderingHermit · · Score: 2, Informative

    I haven't done any programming in over a decade. I recently had to start learning a lot of new information and bought several stacks of books. I found the O'Reilly books to be VERY helpful. In the past I always found Sam's to be informative and helpful as well, but I found Sam's MySQL in 24 Hours to be rather frustrating because of little errors here and there.

    Above and beyond the errors, I don't know if it's because the book is a "in 21 Days" format or not, but I've found it rather frustrating and useless in the long run because it does not work well as a reference book and it seems there is A LOT that has been left out.

    I will not likely buy another book in any "in 21 Days" or "in 24 Hours" or any similar format again. While they may provide a quick intro, it seems to be a week format if you plan to continue in the subject.

    1. Re:One Recent Problem by Bradee-oh! · · Score: 2, Funny

      I will not likely buy another book in any "in 21 Days" or "in 24 Hours" or any similar format again. While they may provide a quick intro, it seems to be a week format if you plan to continue in the subject.

      I disagree. Isn't the "In 7 Days" format the week one?

      --
      "This is Zombo Com, and welcome to you who have come to Zombo Com" - www.zombo.com
  13. Re:Publishers should hire college geeks to proof c by orthogonal · · Score: 1

    Publishers should hire college geeks to proof code

    The original K & R C guide was legendary for it's coding errors.


    Perhaps slashdot posters should hire college English majors to proofread their posts.

    Let's face it, we all make mistkaes, even K&R. But The C Programming Language, has been continuously read and referenced by newbie and experienced coders alike since 1978 -- for twenty-five years.

    Apparently it's legendary for more than just what you dismiss as "coding errors".

  14. YMMV by gmajor · · Score: 1

    I had to learn Java quickly, and I used the same book. The programs I tried worked for me, although I did skip the programs in the first couple chapters.

    I absolutely love the book. Your mileage may vary.

  15. Re:Errata is wrong... by dpete4552 · · Score: 1

    what???

    --
    http://www.archive.org/details/ThePowerOfNightmares
  16. All right, I'll give it a try. by Henry+V+.009 · · Score: 2, Funny

    He's complaining about too much errata? Knuth's $2.56 checks were my goddamn college beer budget!

  17. Look to the publisher's site by babbage · · Score: 4, Informative
    Most (all?) of the publishers today will have a web site dedicated to each title, and the better ones (all again?) will have an errata page somewhere in there. Look for it. Consider basing purchasing decisions on the presence & quality of that errata page:
    • If it has such a page, and it's short (all books will have at least some typos -- that's life), then you're in good shape.
    • If it looks like the errata page is updated often, that's also a good sign -- it means the publisher is paying attention. That may be even better.
    • If it has an errata page, and it's really long, then maybe the book is just sub-par: be careful here.
    • If it has no errata page, the publisher is lying, or hasn't gotten around to it yet: be careful here, too.

    I don't know which book you got, but O'Reilly's Programming PHP has its own confirmed and unconfirmed errata pages. If this is the book you've got, feel free to go over the corrections noted on these pages and jot them down in your copy -- I've done that with a couple of my books, and would have missed many of the glitches without that hint. If you see an error that isn't on this page, O'Reilly offers a error submission form that you can use for that book (and others of course) -- so use it! If the publisher doesn't find out about these mistakes, they aren't going to get fixed. A good publisher will offer revised printings -- not that that helps you once you've got a copy, but it will prevent other learners from having to hit the same obstacles you did. :-)

    You can't, unfortunately, expect books to be perfect & pristine. (Well, maybe Knuth's books, but everyone else has to deal with typos & thinkos :-). You can, however, and should expect the publisher to own up to their little mistakes and offer you corrections on their site. Go find that info and get the fixes into your copy and you'll be a happier camper.

  18. Re:Errata is wrong... by Anonymous Coward · · Score: 0

    bleeve that's intended to be a wrenchingly misguided pun on 'erotica'...

  19. Errata Schmerrata by tres · · Score: 3, Insightful
    Errors in examples give you the responsibility of thinking about the code. You've got to understand what it is doing, rather than just mimicking the examples.

    Believe me, I've spent my fair share of time and frustration trying to debug bad examples. It took a long time to learn, but when I don't trust the author, I find that the errors are more challenging than frustrating.

    A couple of O'reilly books in particular, Steve Oualline's Practical C Programming and his Practical C++ Programming purposely have errors in the examples for just this reason.
    The difference is, Steve tells you that the errors are there. It's a good learning technique, and forces you to pay attention to the concepts rather than the examples.

    --
    Notes From Under *nix: blas.phemo.us
    1. Re:Errata Schmerrata by travail_jgd · · Score: 1

      "Errors in examples give you the responsibility of thinking about the code. You've got to understand what it is doing, rather than just mimicking the examples."

      It's a bad teacher that blames the student for not learning. For some people getting a correct example to function can be an achievement. After the mimicked code is functional, it can be used for experimentation (and learning).

      Also, putting in deliberate errors makes the book useless as a reference. If you can't quickly review a code fragment for some arcane syntax examples, then the book is useless once you have a grasp of the language.

    2. Re:Errata Schmerrata by The+Cydonian · · Score: 1

      Ah, but the difference is in pointing stuff out. I'd feel great if a book says, "Look, here's a code snippet that's supposed to do X, but doesn't. Why? (Answers at page 123)". It's a sort of exercise really, and as you pointed out, a good learning technique as well.

      That's not what the poster is talking about here. That said, I've rarely found technical problems that weren't fixed by a quick Google search, especially in the Google Groups section.

    3. Re:Errata Schmerrata by tres · · Score: 2, Interesting

      I have two kinds of programming books on my shelves. One kind is an introductory book, the other is a reference. My reference books I use all the time. But the introductory books are darn near disposable. After reading them, they become paperweights. Don't get me wrong, they are a necessary part of learning, but after I've learned what they have to give, it's a rare case that I might pick them up again.

      The reference books I have are always a source of new information. These always seem to be much more accurate than the introductory books in the code examples that are given.

      The point I'm trying to make is not that the student has done something wrong, but that the student should not trust the author of an introductory book. Interpreting the information with a sceptical eye means that the student, rather than being frustrated by mistakes, can look at the mistakes in code as a challenge.

      It may make someone feel good to have made something that works, but in the end, feel-good programs don't really teach you that much. It's the concepts behind the program that are important.

      I agree that experimenting really does a good job of teaching, but experimentation is going above and beyond what the book has to offer.

      --
      Notes From Under *nix: blas.phemo.us
    4. Re:Errata Schmerrata by MisterFancypants · · Score: 1

      There's some truth to what you've written, but you're looking at it from someone who is already a programmer. A total newbie who first encounters programming through an error-riddled introductory book could be put off from coding forever due to frustration. If you know nothing of programming and the hello world in your coding 101 book is fucked up, you just don't have the tools to figure out why at that point, and won't for a long while yet.

  20. Translated manuals by ptaff · · Score: 1

    Errors in book happen all the time, but it seems like translation make it worse...

    I own a couple of coding books translated in french - it's even weirder. Sometimes the variables in the code get translated, sometimes the step-by-step explanations get out-of-sync and the variables change names, well you get the point.

    Do translators know they're translating code or are book businesses really hiring cheap labor?

    Then, after reading stacks and stacks of books and lines and lines of code that talk about arrays, floats, strings, you find yourself faced with tableaux, nombres à virgule flottante, chaînes de caractères. It just doesn't feel right.

    I mean, it's like translating a russian-chinese dictionnary in english!

    1. Re:Translated manuals by moc.tfosorcimgllib · · Score: 1

      Usually the Grad students try to get direction only to find the professor to busy to help. They eventually go with their best judgement. Also, since there are usually several grad students working on one book (Each pulls different chapters/sections to do, get things done faster), communication in the group is key to getting it done properly.
      The disappearing sentence is a good example of that. A translated page takes up more space than the untranslated version, so Student1 needs to talk to Student2 to merge the pages seemlessly. Student2 is on vacation in Milan with his girlfriend until the night before the deadline because he did all his work early. So Student1 decides the last half of the sentence wasn't that important anyway.

      The problem lies in proofreading. No one ever wants to proofread boring technical manuals. When was the last time you pulled another co-worker hand-made tech manual on a piece of code to proofread it just-in-case?

  21. Favorite statement by michael_cain · · Score: 2, Interesting
    Many years ago (pull it off of the "old textbook" shelf, copyright is... 1976, I am getting so old), Kernighan and Plauger wrote "Software Tools." One of my favorite statements made in the introduction is
    Every program in this book has been run and carefully tested, directly from the text itself, which is in machine-readable form.
    I suppose some of the code fragments can't be checked this way, but at least testing the bigger pieces of code can be automated. Of course, this assumes that at some point the files are turned over to the publisher who does not mess with them any more. Not a safe assumption -- I wrote an article for an IEEE journal and approved the "final" version, which was then mangled by another editor and sent to press. I spent weeks trying to explain to people that I could write better than that...
    1. Re:Favorite statement by Anonymous Coward · · Score: 0
      I and some friends actually used a lot of the Tools code (it's good to have friends at an IBM shop when you want to transfer a 9-track tape to floppies). We spent even more time reading and discussing the code. The only error that I remember any of us ever finding was in the one bit of non-executable code: a few lines where they showed how a key piece of code would have looked if FORTRAN supported recursion. I believe it was one of those off-by-one boundary errors.

      Naturally, the rather more complex working code that managed a stack to simulate recursive calls was flawless. I don't believe I have ever before or since encountered a book containing significant code that was as good in this regard. The average modern "code" book is barely good enough to use as toilet paper in comparison.

  22. And they are using WINDOWS!!! by Fished · · Score: 0

    Recently, I got the O'Reilly Struts book. I was astonished to see that all the screen shots were taken on Windows! Now, this may not seem absurd to the younger generation, but I was reared on O'Reilly books that were decidedly ... non-Windows oriented. Yes, you could use Windows, but only to get to a Real Computer. A Real Computer, of course, was one that ran UUCP out of the box. Anyway, I was surprised. Suppose it was foolish of me to be, but I was.

    --
    "He who would learn astronomy, and other recondite arts, let him go elsewhere. " -- John Calvin, commenting on Genesis 1
  23. Not much of a problem by __aafkqj3628 · · Score: 1

    As a big reader (and reviewer) of technical books, they usually aren't much of a problem for me as material I already know can patch the code (and usually it's as basic as misspelling a keyword of something trivial like that).

    I've never once had to look up errata for the book because of coding errors (although for a couple of Wrox books that had pages and pages of code, I couldn't be bothered debugging the code and downloaded it).

  24. yeah, but... by Tumbleweed · · Score: 1

    my favourite thing is when the errata page has fixes to errors that aren't even IN the book. Ugh.

    A thought - it might be better to buy a book that is a second or later edition, rather than a first. My reasoning is that 1) the book was good enough (or at least sold well enough) to justify more than one edition, and 2) errors in the previous edition may be more likely to have been corrected in the subsequent edition(s).

    For sure, check that the book (and the edition you're looking at) has an errata page at the publisher's (or author's) website before buying.

  25. Re:Publishers should hire college geeks to proof c by mildness · · Score: 1
    The thought that flew over your head was that the K&R C book had many editors. In 1983 the EDITORS pissed me off by not having some low level geek like yourself type all the K&R code in and try it.

    Grok?

    Bill

    --
    bamph
  26. Java for Dummies (first edition) by Fritzed · · Score: 1

    Several years ago I bought Java for Dummies, the first edition of the book. I don't believe I ever made it past the 3rd Chapter or so because only about half of the Code Examples were working correctly. It was so bad, I dropped Java and went back to C and have only recently tried another attempt at Java. I even tried the CD that came with the book and several (although not as many) of the examples on that did not even work. I ended up throwing it all away and I haven't bought a Dummies book since.

    -> Fritz

    --
    Spooooon!!!!!
  27. The absolute Worst by haplo21112 · · Score: 1

    I had a Pascal Text book in college, that was riddled with errors. Syntax, logic, bugs, overflows...the code samples were just nasty...

    The worst part is it was very appearent that the professor had no idea, since she just rattled off the same mistakes as part of the lecture.

    Luckly I had already had Pascal in high school with a good instructor...I flew through the class while others struggled due to the crappy book...

    --
    Power Corrupts,Absolute Power Corrupts Absolutely, leaving one person(group)in charge is absolutely corrupt.
  28. May not be coding in the book by Merlin_1102 · · Score: 2, Informative

    Personally I have come across few typing errors in books (then again I RARELY try any of the code they offer in books). I personally have several PHP books and if you are just starting to learn PHP please be aware that the language goes through like 4 updates a month or something like that. I remember when I first tried to learn PHP I attempted some of the code and it would not work. This was because from the time the book was published to the time I got it the PHP language had changed. Some of the defaults were changed etc... so things did not work the way i intended them to (changing it so all variables were not global by default drove me nuts until I firgured out what was wrong).

    Basically the point I am trying to make is that with PHP some times the problem may not be with errors in the code, but may be with the fact that the language has changed and no longer supports what you are trying to do... Having saying this if you cannot get a "Hello World" Program to work then I would be a bit suspicious as to whats wrong.

  29. Errors are great by NateKid · · Score: 1

    I find that figuring out the errata beforehand really lends to a deeper understanding of the subject matter. It is a great way to "dialogue" with the text as opposed to passively absorbing it.

    And I always email the author if he asks for errors. That way he might mention me in the acknowledgements section and my googlekarma will skyrocket!

  30. Errata can ruin your life by Anonymous Coward · · Score: 0

    Some of these errata can ruin your career. I haven't managed to ace a PHP job interview since the great "Hello, Borld" misprint of 98. I hoping a quick scan of "Design Batterns" will rectify my buzzword potential for the next interview.

    1. Re:Errata can ruin your life by Anonymous Coward · · Score: 0

      This joke had real botential but ultimately went mowhere.

  31. Other types of books by Quill_28 · · Score: 1

    It is not just in programming books.

    This same thing is fairly common in cookbooks.

    Many of the recipes in cookbooks if you actually follow the directions and ingredient list exactly, would not come out right.

    So when your double fudge walnut chocolate upside down cake doesn't taste right it might not be your fault.

  32. K & R errors, mostly due to printer by green+pizza · · Score: 1

    According to K & R, all of the code in The C Programming Language has been tested from the original text. However, the minimum wage printers often removed all or parts of punctuation marks and the such, thinking they were not originally intended to be on the printing plates.

    Also, K & R have an EXCELLENT errata page:
    http://cm.bell-labs.com/cm/cs/cbook/2ediffs .html

  33. Re:Publishers should hire college geeks to proof c by oh · · Score: 1
    Publishers should hire college geeks to proof code

    I was once a student of Rob Pike ,author of "The Unix Programming Environment with Brian Kernighan (the K in K & R). They were at the time writing The Practice of Programming again with Kernighan.

    The course notes for this subject were basically the chapters of the book. He asked all his students to read through the code examples and let him know if there were any problems. I don't know if we can claim all the credit (I found some errors in the early chapters) but this book has a very short errata page.

    Mind you I can't remember a code example where they got sizeof(char) wrong!!
    --
    Democracy isn't about no one telling you what to do. It's about everyone telling you what to do.
  34. Errata directory by joeljkp · · Score: 1

    I've considered starting up an errata directory, where readers, authors, et c. could submit their errata to be compiled into one easy-to-search database. A useful idea?

    --
    WeRelate.org - wiki-based genealogy
  35. It is common by decep · · Score: 1

    I'm not really a coder or developer, although I know some perl. I believe this is rather a common occurance. The examples in books are there more or less to give a reference on how you should approach a problem rather than a real working example. I seem to remember reading a C++ book in college that actually said this in the front of the book.

    Hey, at least you are catching errors. You are better off than the people that did not catch them.