3 ms·
If the bad code is still tested, it can easily be changed to be "good code". If you have good code, but untested, you have no way of refactoring the code withou
by diggan 12y ago
If the bad code is still tested, it can easily be changed to be "good code". If you have good code, but untested, you have no way of refactoring the code without actually knowing that you making it better.
- sheepmullet 12y agoBad code with unit tests cannot easily be changed to "good code". Most unit tests of bad code are very brittle. Consider changing the permissions system in the article: All a typical rushed set of unit tests would do in this case is form a brittle specification. In fact in my career I've never seen bad code + good tests unless the tests were added at a later date (typically by another developer trying to do what they can to stop code rot). On the other hand it is a joy and straightforward to add unit tests to good code and typically they are much less brittle.