Test Driven Development (TDD) is like exercising. It’s a lot of work, and you don’t see the results day-to-day, but you’ll be thankful you did it a few months later when you suddenly have rock-hard abs.

I was learning rspec, the Ruby testing framework, this week at Dev Bootcamp, and it really wasn’t that bad. The rspec syntax is pretty simple, and using it forces you to really think about every line of code that you write.

I also ended up refactoring a lot earlier than I usually do (RED => GREEN => REFACTOR!), which made my code A LOT cleaner right from the start. It actually put me more in touch with the DRY (Don’t Repeat Yourself) Ruby mantra, as I was obsessed with not repeating myself both in my production and test code.

While it might seem almost unnecessary to use rspec or another testing framework (Jasmine is the JavaScript one!) for small projects, it’s important to realize that small projects can quickly become big and complicated ones in the future.

This point was really drilled into us by the founder of Dev Bootcamp, Shereef Bishay, when he told us that he lost three years of his life because he didn’t do TDD. When Shereef started his previous company, BetterMeans.com, he wanted to get his product out as fast as possible, so he didn’t do TDD.

However, as he kept adding more and more features, the project became unmanageable to the point where he was afraid to add any more code, because every time he would add something, something else would break. In addition, as BetterMeans was getting more and more popular, he would get emails from developers who wanted to contribute. But as soon as they looked at the code, they were overwhelmed and were no longer interested.

The hardest thing about TDD, just like with exercising, is getting into the habit of doing it. I’m starting this habit today.

Enjoy the article? Join over 20,000+ Swift developers and enthusiasts who get my weekly updates.