Now that I'm an officially published author on the subject of computer programetery, I thought I'd pass on some of my hard won wisdom. Here, then, is everything I know about programming:
- Add more comments
- Never throw out working tested code
- Seriously, never throw out working tested code, no matter how bad it looks, it's full of bug fixes and stuff for situations you haven't even thought of yet.
- The bugs are in your code. If you think you've found a bug in the operating system, or the run time or the compiler or a library, I will bet you a whole Canadian dollar that you are wrong.
- It's really easy to write a whole lot of bad code, and really really hard to write a little bit of good code that does the same thing. For the love of K&R, stop, relax, and think before you start typing.
- If you've found a really clever way to do something, I will KICK YOUR ASS. Cut it out, you're not as smart as you think you are.
- Code lasts forever, you may think that you're writing a stupid one-off script, but the odds aren't bad it will still be in use 5 years from now.
- Optimizing your code to run faster is a waste of everyone's time, will introduce more bugs, and won't win you anything. Don't optimize until performance is actually a problem, and even then, it's probably better to try to get a faster computer.
- Add even more comments.