Autonomous Machine

Obvious Tip 1: Short Circuiting Logic While Debugging

Who hasn't forced a conditional statement one way or the other to force part of a complicated system to always trigger during a bout of (potentially late night, potentially ill-advised) hackery? I've learned the hard way to always take the twenty seconds to add a warning so I don't forget to remove the hack. Of course, specs are going to fail if I forget to, but it's easy to spend time looking in the wrong places for a fix to something as sturdy as if statements.

if true || some_method_that_may_or_may_not_return_true?

Make sure to put the reminder outside the conditional. Depending on what you're working on, you can use a framework logger if you have one. I used puts above because the code I'm working on (which sparked this entry) is standalone.