Shape your mind

TDD is to coding style as yoga is to posture. Even when you’re not actively practicing, having done so colors your whole life healthier.

This morning, coding a demo app of minimal quality, I caught myself using TDD-style coding even without writing tests. Start with the simplest functionality. Then add another one. Then reorganize the code to be cleaner.

Do not write code from top to bottom. Software is not written in files and lines; it is written feature by feature. Write code one functionality at a time, not one line at a time.

Yoga puts our body in good shape, teaches us to hold ourselves with confidence and relaxation, and this diffuses into every motion we make, every posture we take.

TDD teaches a mind-shape that is useful for coding, even when we are not writing tests.