Today I had to tear apart and refactor one of core pieces of tool I’m working on. Oh, and I had to do it fast.
At first, I was like: “Hey, you can’t change that, it was supposed to stay the way it is now!”. Next I started to refactor, changing one by one, all the pieces I needed to change in order to achieve desired effect. I was refactoring, compiling, testing… and again refactoring, compiling, testing…. And ultimately when all tests were once again green – I knew I was done. I felt confident.
Thanks to TDD and good design I had, I was able to change big piece of code very quickly, and without causing everything to fall apart. I’ve read about how TDD gives you confidence, how good design helps, I’ve been there before, but in this moment when I was starring at all green tests, it all felt so apparent, it was almost magical.