TDD is good for your happiness and well-being

“Flow”, by Mihaly Csikszentmihalyi, is one of the pioneering books in the field of Positive Psychology, i.e. researching about what makes people happy and productive, instead of focusing of psychological diseases.

One of the key concepts in the book is that for an experience to be enjoyable, it has to be challenging at the right level, and in the process you experience growth and become more “complex”. Therefore, one of the criteria of an enjoyable activity is that it gives feedback about how well one is doing, so that one can evaluate progress, and adjust one’s course of action to improve.

That’s why TDD (Test Driven Development) is good for your happiness and well-being. By writing a test first, and then the code to pass the test, you’re getting feedback that you’re making progress. Then at the refactoring stage of the “Red-Green-Refactor” cycle, it is essentially a chance for you to not only improve the code base, but also improve yourself as a coder. During a work day, every passing test counts as a tiny win in my mind, and they add up positively.

Speaking from personal experience of coding without TDD, TDD has definitely made coding more enjoyable for me than ever before.

discussion by DISQUS
Add New Comment