|Benefits||Certification||Join NAP||Articles||Events||Links||PCOE||About NAP||Contact Us||Privacy|
Game developer and lecturer Iain Lobb outlines the top 10 pitfalls that he sees beginners stumbling into time and again
When you’re learning to program, it goes without saying that you make a lot of mistakes. The problem is, sometimes you don’t know you’re making them. In my work teaching first year university students to code, I see the same errors come up over and over again, and they’re the same mistakes I made when I was learning. So here’s my list of the top beginner mistakes to avoid:
The number one mistake you can make as a beginner programmer is to think you’re not good enough, not smart enough: that you have the wrong type of brain, and you’ll just never get it. I believe that anyone can learn to program to at least a basic level, if they stick with it. Code will seem like an incomprehensible wall of alien language at first. That’s normal! But bit-by-bit you learn what each part does, and it’s not scary anymore, and then you see it’s really all very logical, when you know what it means. There’s definitely an element of natural talent to programming and logical thinking, but it’s massively outweighed by hard work and hours spent plugging away at your code, reading tutorials and looking-up documentation. Master your fear, or fear will be your master! Or something. I’d advise any beginner programmer to play with the drag-and-drop visual programming tool Scratch. It’s a brilliant way to learn programming concepts like loops, “if” conditionals, variables and arrays, without being put off by mistyping code. Because there’s no typing! It’s increasingly being used in schools to introduce programming, and I can’t recommend it highly enough.
I’m a big fan of self-documenting code – that’s code where the variable, function and class names, and overall architecture communicate the meaning of the code to other developers (and your future self!) without the need for lengthy comments. However, I do also see the value of commenting, especially where it flags a work-around for a specific issue that might not be obvious. What you don’t need to do, however, is write comments like this: “score += 5; // adds 5 onto the score”. What you would be doing there isn’t documenting your own code, but explaining how programming works. This might be a useful exercise when writing your first program, but it’s not something you should hang on to.
You can’t really blame beginners for this, as it only comes with experience, but once you get one or two years into programming, it’s really time to start learning some of the less common operators – they’re incredibly useful. For example, here are some to swat up on:
The phrase “I just lost [X] hours work” should not be in a developer’s vocabulary! There are so many good tools for automatic back-up and version control now, that there’s really no excuse to lose anything, even if you have a major computer malfunction, fire, burglary or other minor disaster. I work from my Dropbox folder, which automatically backs up my all my files, with version history – and when working with other developers or on open source projects, I also check my code into an SVN repository or Github. All these tools have free-to-use options.
Here’s one I was guilty of for far too long, and it’s an easy mistake to make. After a lot of persistence, you finally write some code that actually works! Your confidence grows, and before too long you’re teaching stuff to your friends and you feel you can take on the world! This is awesome, and you should enjoy that feeling of finally having the computer do what you want it to. But while you’re grinning your face off, banging out line after line of code, don’t forget that you’re still just learning. Maybe it’s time to start looking back at your old code and reflecting. Which parts of your code do you understand one hundred per cent, and where are you just copy-pasting? Maybe now’s the time to delve into that function marked “DO NOT TOUCH” and work out what the heck it does. I’ve been coding for 13 years, and in a lot of ways I still feel I’ve only just scratched the surface.
I hope you’ve enjoyed my list – and remember, it’s okay to find programming tricky – it is tricky! Happy programming! And don't forget you can vote for your biggest beginner prgramming mistakes on our Facebook page.
|Date||January 14, 2013|
|Biography||Iain Lobb is an award-winning game designer and developer who works freelance, makes independent games and lectures on the Digital Art and Technology degree at Plymouth University. He speaks at conferences around the world, and co-hosts The Creative Coding Podcast.|
|Copyright||© Future Publishing Limited, Beauford Court, 30 Monmouth Street, Bath BA1 2BW. All rights reserved. England and Wales company registration number 2008885. Reprinted with permission.|
|All logos, trademarks and registered trademarks are the property of their respective owners.|