So there was an error in my code. Now I am no stranger to the odd bug(or 10), so there I was staring at the code.
I had been stepping through the code. I had put in various var_dump statements. But could I find the problem! No.
So I called over to my colleague Lee, and asked him to sit down to see if he could find the problem.
So there we were staring at the screen like two unwise monkeys, the sweat dripping off our brows as we tried to find where the problem lay.
“what you need to do” said a voice from behind us “is fail fast.”
We looked round and there was Tay, another good friend, looking at the screen over our shoulders.
“eh” said Lee and I at the same time.
“well” said Tay, “If your code encounters a problem, it should fail straight away, maybe log the error as well. That way you can find the problem sooner, and fix it quicker”
Lee and I looked at each other.
“I think you might need to refactor your code mate” said Lee.
Do you write code that fails fast? I would love to hear how so why not leave a comment.