4 ms·
> First you write unit tests for the existing code, so you understand the problem domain. Then you can start changing things and you'll know if you broke someth
by BeetleB 4y ago
> First you write unit tests for the existing code, so you understand the problem domain. Then you can start changing things and you'll know if you broke something because your unit tests will fail.
In many projects this is a fantasy. I've yet to work on a C++ project where one could add (useful) unit tests to existing code without rearchitecting. If you don't design your code to use unit tests to begin with it won't be easy to add them later.
Python, sure. C++: no way