Engineering Essentials

I see a lot of stupid stuff while developing software. I see it professionally, I see it in the open source world. I see some things over and over again. So here we go, a bunch of key concepts, anti-patterns, and miscellaneous crap that drives me batty.

  • Source control is actually easy to use, and is useful. CVS is free, play with it.
  • Source control keeps old revisions of code, you don’t need to keep them in the file as commented out blocks. Or worse, enclose them in if (0) { ... } or #if 0 ... #endif blocks.
  • A global or static hash/dict/HashTable does not a cache make. Caches have size bounding, expiration schemes, and locking semantics. What you’re creating is a memory leak and potential headache.
  • The solution in Java is usually not another singleton.
  • Deprecation is a nice thing to do.
  • “Fixed bug” is not a valid check-in comment. Neither is “changed code”.
  • You should do a cvs update before you test/check-in, because I don’t give a flying fuck how well your new code works against the copy of the source code you updated 2 weeks ago.
  • That thing you don’t understand and are misusing? There’s a book on it. I’m sure of it.
  • That thing you couldn’t find a book about? Google knows where an article is on it.
  • If you ever think, “Man, I can’t believe nobody has written a standard library to handle this problem! I’m going solve it!” you should stop coding. Someone probably already has solved it, and you just haven’t looked hard enough.
  • Not all your code is “library worthy”. Write it first as a local function. If it turns out that other people can use it, then and only then should you move it to a common library area.
  • A library should never be named after your business model. If you’re writing a finacial system, libfinance is the worst thing you can start with because everyone will justify that their new function is a part of dealing with finances, and belongs in libfinance. Within a very short time, it will become an unweildy, unmaintainable mess.
  • Stop being such a pussy. You’re a developer, rewrite it already!
  • Global variables are still a bad idea. Seriously. This is something that hasn’t changed since you took your first programming class.
  • Use a logging framework and provide meaningful log messages. Otherwise the operations guys will kill you in your sleep. It’s not a big deal for them. They’re already awake and angry because your shit broke and printed the phrase, “Something bad happened” to stderr.
  • A cron job that prints out “Completed successfully” every time it runs is right-out. The operations guys don’t like deleting messages all day that confirm that they don’t need to fix anything. How would you like it if the guy you work with stopped by every ten minutes to tell you he’s still breathing?

Archives