7 ms·
Write tests for every behavior the system currently exhibits. Then systematically comment out everything -- one function/block/class/whatever at a time -- maki
by stray 11y ago
Write tests for every behavior the system currently exhibits.
Then systematically comment out everything -- one function/block/class/whatever at a time -- making note of which tests break.
That should give you a better idea of how everything hangs together -- and uncover the parts that aren't even used anymore.
Almost any software that you inherit, that has been around for a while, will be a complete mess.
If you have time for a book, Michael Feathers' Working Effectively with Legacy Code will likely help a lot.
- jerf 11y ago"Write tests for every behavior the system currently exhibits." That's often harder than just bashing your head against the problem. Retrofitting code bases with any sort of unit testing is almost always a challenge on its own terms... one much easier when one has at least an idea of how it's working already. And that's after I apply the principle of charity and downgrade "every behavior" to "many behaviors of interest". It'd be great if it works, but I suspect it would only work when it's unnecessary anyhow because any code base amenable to that treatment wasn't that hard of a problem in the first place.
- stray 11y agoI am of course, making the assumption that OP knows what the software does -- but not how it goes about doing it.