Obvious Tip 1: Short Circuiting Logic While Debugging
Posted January 20th, 2009; 0 comments.
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.
puts('! OVERRIDING SOME LOGIC !') if true || some_method_that_may_or_may_not_return_true? ... end
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.
Sorry, comments are closed for this article.