I have always been trying to find better ways to express the benefits of adopting test-driven developement. Recently I have found one great way of expressing it:
Testing before coding is like cheating.
I really like this idea.
Back in child time, sometimes I just hoped that I could have known the answers before all the exams. Unfortunately I never had. I never had that luxary. We can never know the result of an exam until we take it. If we can know the answer beforehand, we will always get perfect score.
Programming is just like taking an exam. We never know what will be the exact behavior of a program before the program is implemented. If we want to cheat in this business, we will have to know exactly what will be the program’s behavior. Is it possible? Test-driven development gives us exactly this luxary. By testing before coding, we effectively get the answer first and finish it later. We know what the result will be, and we adhere to that result to finish the work. Isn’t that great? We cheat honorably.
This is the first time that I can be proud of and feel honorable in cheating. I test before I code.