As a summary, I'd like to stress the point of TDD + Refactoring == true. They are so very much in symbiosis. In order to be able to use refactoring in a safe way, you must carry out extensive tests. If you don't, you will introduce bugs and/or you will prioritize not making any changes simply for the sake of maintainability, because the risk of introducing bugs is just too large. And when you stop making changes because of maintainability, your code has slowly started to degrade. At the same time, in order to use TDD, you will have to carefully guard your code and keep it clean all the time by applying refactoring. Also, isolate your unit tests with the help of stubs and mocks. If you don't also guard the test code, that code has started to degrade. TDD + Refactoring is a totally different way of writing code compared to what most of us learned in school. If you give it a real try, it will totally rock your world, and you won't go back. With these tools on the belt, we are ready for an architecture discussion. |