4 ms·
I've noticed this as well. You simply can't start from scratch. The first thing you do is make sure you have good tests built around our old code base. Then yo
by nonane 16y ago
I've noticed this as well. You simply can't start from scratch.
The first thing you do is make sure you have good tests built around our old code base. Then you slowly start refactoring/rewriting pieces out. After every small refactoring round run your tests and make sure everything is working. The key is to break down the rewrite into small steps and make sure you have a full functioning product at each step. This might even mean that you need to write code that will be removed after a couple of refactoring iterations.
- toumhi 16y agoThis is what Michael Feathers calls 'seams' in his book, Working With Legacy Code. Often, you have to do exploratory testing, that is, you don't really know the requirements but you make tests that the current code passes. Then you can refactor it. That way, current code behavior won't be changed. Very good read, if you need to deal with legacy code and you don't know where to start. http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052 http://www.amazon.com/Working-Effectively-Legacy-Michael-Fea...
- auxbuss 16y agoWish I could vote you up a few more times on this. Mike Feathers called them characteristic tests. Sure, run them as unit tests, but get them under CI right away too. Test everything that moves all the time. This type of work, and this approach, appeals to a limited set of people, though. It's painstaking, detailed work. The other problem is that businesses don't understand its value, and don't want to pay for it, ime. I've seen two companies go down not paying attention in this area, and two more who are currently dying. Course, if the thing was under test to start with then things would be so much simpler ;)