4 ms·
But what do you do if your initial codebase is crap. You literally cannot test until you refactor 50% of it into something semi-sensible.
by Aeolun 7y ago
But what do you do if your initial codebase is crap. You literally cannot test until you refactor 50% of it into something semi-sensible.
- popinman322 7y agoThen refactor 50% of it.
- NortySpock 7y agoShort version: you find very small things that you can write tests around (pulling messy logic out into testable functions, writing tested utilities that replace dirty hacks, etc.) and start building your testing framework starting with that. Long version: Working Effectively with Legacy Code Book by Michael C. Feathers
- brianwawok 7y agoIt’s almost always bad as a new guy to come in and start refactoring. There are lots of weird if checks to deal with a vendor that returns bad data over the api every Sunday night. Your new clean code is going to crash and burn in all of these cases.
- Hendrikto 7y agoThat is not an argument against unit testing. That is an argument for applying it from the beginning…