Published during: July 2012

Just a quick note to the world: beware of leftover makefiles if you restructure a project in Eclipse CDT. Eclipse will happily create new makefiles with the appropriate information in them when you restructure you code – if, for example, you move source and header files into their own directories instead of being in one big blob at the root – but it won’t delete the old ones. As a result, you’re likely to see that ever-so-informative make: *** No rule to make target calcVCE.o', needed by cplus2.exe'. Stop. message that make generates when it’s looking for a file it can’t find. The old makefile is still hanging around, and Eclipse happily tries to run make against it. The easy solution is just to delete all your old makefiles when restructuring code and let Eclipse CDT rebuild them for you from scratch.

# Good Programming in 3 Simple Rules

In the last few years, I have seen a little great code, some good code, a lot of mediocre code, and overwhelming amounts of bad code. (A shocking amount of my own code from previous years – especially when I was just starting – goes in the last two categories, alas.) The longer I have been at it and the more I have read (whether random articles on the web or the excellent Code Complete), the more I have concluded that good programming is simple. Incredibly hard, but simple. In fact, it is so simple, that you can sum it up in three short, easy to remember rules:

1. Write code for people, not for computers.
2. Don’t repeat yourself.
3. Only do one thing at a time.