The Importance Of Planning
So I’m working on the next version of my Visualiser, and by version I mean Uber Rewrite Of Ultimate Doom. The weaknesses of the original are becoming rapidly apparent and there comes a point where you just have to cut your losses and use your experience to start over. So I have a set of goals in terms of how I go about coding this new one so I don’t repeat history. I know most of these are common sense taught to us early on, but how many pay attention seriously unless made to by company policy? Turns out having things bite you on the ass is quite a motivation.
- Create the interface (class definitions etc) before writing any implementation. Having the interface driven by your need to fix things you’ve already done isn’t a good solution.
- In addition to the above, comment/document everything before writing the implementation. Having a contract to stick to helps a lot.
- Don’t assume the running environment has 32-bit integers and single-byte characters. This isn’t an issue right now, but being able to compile for unicode or run reliably on other architectures (most notably 64-bit systems) is pretty much a requirement for any serious application that wants to stay alive in the future.
- Don’t don’t don’t use C coding style in C++. Seriously, never. Just don’t. You have the STL and shiny new language features for a reason, use them.
In addition to the above, drink lots of caffeine and play U2, Aerosmith or other such music loud while coding. Metallica, Muse or anything off Guitar Hero is far too distracting and makes you want to pick up your own guitar.
Come to think of it, that last note might just apply to me, though I think it should be a requirement for all coders to be addicted to caffeine. Certainly beats other drugs in terms of not killing you off (except the inevitable bone weakening and teeth destruction inherent in cola).