2 ms·
What's the point of adding regression tests to spaghetti code? All you're doing is making it an even bigger pain in the ass to refactor. And at this stage he p
by mattmanser 9y ago
What's the point of adding regression tests to spaghetti code?
All you're doing is making it an even bigger pain in the ass to refactor. And at this stage he probably doesn't even properly understand the business logic behind the code anyway and will make duff tests.
I'm admittedly pretty meh about tests, never seen good ones that are flexible and actually test the functionality instead of the implementation. One of my client's actually had a contractor add a bunch of tests to some existing code that took him a month or two and caught a whole one bug in 4 years that would have probably been caught in QA any way.
Otherwise I generally agree, but you can refactor as you go, which I've done plenty of times. Depends on team size and how productive you are to the other devs, but you can single handedly refactor really bad sections and setup a general outline of how the code should be laid out within a year, though you need to start getting people on board.
- mattm 9y ago> What's the point of adding regression tests to spaghetti code? All you're doing is making it an even bigger pain in the ass to refactor Refactoring is changing the code to make it more understandable while keeping the functionality the same. That is the perfect time to add tests. Adding tests before refactoring will help someone understand the code first and will also let you know if you've broken something.