Sunday, May 17th, 2009
Recently I joined a debate started by the editor of Flashtuts+ regarding coding conventions. Now I’m a strong believer that if you’re going to code, you best do it right. Yet on a day to day level I still see sloppy code. Gone are the days of Actionscript 1 and 2 coding when you didn’t have to declare variable’s type or a function’s return value, but still people continue this in their coding of Actionscript 3.
The fun doesn’t stop there. I admit, when I first started coding yes I was very sloppy with my convention, but I’ve cleaned up my act, honest. With other languages such as PHP and JavaScript, you see how easy it is to just keep typing and typing and through any sort of convention out of the window. But when the client turns around as says: “Why can’t that be 3D?” you’re then going to have to go through all your sloppy code and make it 3D.
So convention pays, it really does. I got into Python a few months back and when I first had a look at it, my reaction was something along these lines: “What, no brace brackets? How the hell do they know what they’re editing?” and the answer was that Python uses very strict coding conventions.
In Python you have to tab correctly, you have to leave sufficient spaces after statements and so on. Looking back at it now, Python is beautiful. I’m not fully migrated from PHP though, but because of it’s rigidity it’s very easy to pick up and develop with, and more importantly modify and update.
So where does one go from this? Well the best places I found that help people use the correct conventions are different for each language:
If you have any suggestions or think I’m wrong, please comment. Because if I’m doing it wrong then I’d want to get it right!