Bolsters Code-Related Rants (An ongoing collection)

Andrew Bolster

Researcher at the University of Liverpool, Founder/Director at Farset Labs

FFFFFFUUUUUUUU

  • Logging functions being called with just a variable and no comment as to what the hell it is

  • logging has functions more than logging.info, use them!

    • Debug = useful information if something breaks but isn’t interesting during normal operation

    • info = useful and generally interesting information

    • warn = something went wrong, indicating something should probably be refactored / fixed,_ but the system could recover from it._

    • error = oh dear jesus fuck the entire site evaporated into a swarm of zombie locusts, I better put something in the error log.

  • Commented out historical code! Using a version control system means you can go back to any point in the history of the codebase and see how we used to do something; you don’t need dozens of lines of extraneous code ‘just in case’

  • Checking in inoperable code to the default branch (I know I’m guilty of this sometimes too). If major changes to one section are being made, do it in a branch, that’s what branches are there for. Then, when the new functionality is stable, update your local code with respect to the default branch, then make sure** all the functionality still works** and only then commit and check it in to default

  • Non existent or orphan files; if you add a new file,hg add $filename before updating or committing, otherwise noone has any idea whats going on. Ditto removals of files, its hg remove $filename ; rm $filename, not the other way around.

You guys got any to add? I’ll be adding to this as I think of them… / come across them…

Published: February 12 2011

blog comments powered by Disqus