Beware of Bad Tutorials

by Mike 8. August 2011 18:37

You know what really bugs me? Copying and pasting code. Why? Because sometimes you, or a friend, get a first hand lesson on how evil it can be...

Why just the other day I was asked to take a look at some code for an XNA 2D camera class. Fair enough, I've written one or five in my day, what's the problem? He sends me to the site where I see ugly double-spaced code snippets littering the page. I ask him if he copied and pasted. He said yes so I did the same. I could complain about the formatting of the code, but that's not really a problem here so I won't. What I will complain about, however, is the numerous errors in the code. Missing using statements. Missing variable declarations. Missing or mismatched braces leading to code outside of a method body. Method calls with spelling errors. Seriously, there were a ton of errors in this article which was supposed to be teaching less experienced people how to make a 2D camera. I feel sorry for the beginners trying to sort out the code for themselves...

And, the most unholy copy/paste error I've encountered thus far: Replacing a hyphen (-) with a DASH (I don't even know how to make a dash without Word doing it for me) so you get the awesome error message in Visual Studio telling you the "-" is unexpected. WTF do you mean I can't subtract scalar values within an if? How's a less experienced debugger going to figure that out? They look the same in the editor. Why? Why would the author do this to his/her readers? What do you mean that MathHelper.ToRadions isn't a valid function call?

Everyone makes mistakes now and then. An error or two in a tutorial is acceptable. 10+ errors over the course of 50 lines of code is not.</rant>

Tags: , ,

Comments (1) -

John
John
11/16/2011 2:28:48 AM #

Hi ,

Great post, it gives me good info. Thanks for sharing.

Comments are closed

About Me

Contact Email: last name backwards + 84 + at symbol + verizon [dot] net
Messenger: last name backwards + at symbol + retrostorm [dot] com

Month List

Page List

    Money = Motivation

    Feel free to send me some cash if I helped you out in some way and you want to show your apprecation. I could really use some help over here. Thank you comments are okay, but, they don't pay the bills. Every dollar helps and you'd be surprised at how much work I get done when there's money involved.

    Click the button below. :)