DEV Community

Discussion on: What was your TDD aha moment?

Collapse
 
derek profile image
derek

My "AHA" moment was when I realized it was like exercising... it's a lifestyle(ish)

  • Just like exercising, I don't want to do it because I'm lazy. But I'm well aware of the future benefits and ROI. Future benefits like making refactoring easier, or easier to onboard people and have them contributing without worrying too much about regressions, and it can also make development faster depending on what you're implementing algorithm, API, etc.

  • I have to plan ahead and make time for it; ie. it's like squeezing in a work out by forcing myself to wake up an hour or two earlier. So when giving or negotiating time estimates I have to factor this in (lots of padding).

  • I have to make goals/game plan, ie: target weight or body fat == targeted code coverage or amount of tests.

  • Just like when ever I'm trying to get back into shape/form, the beginning always sucks. But for me I just keep focusing on my goals and the exercise or test that is in front of me at the time.

  • Just like exercising, sometimes I miss a few days or break routine now and again; it's okay, it happens. But at least I'm cognizant and I try to get back on track, and it's always easier to get back on track if the time interval wasn't that long. This holds true for tests, sometimes we have to stop or skip to get things done or moving to hit deadlines. But as long as there's a pattern and some tests in place it's a bit easier to get back on track (this is generally true, not always).

  • I also use my exercising habit/pattern as motivation to continue testing. In example, I tell myself if I can force myself to workout I can force myself to write these tests.