I am developing on a system that is a bit difficult to work with. It is 99% undocumented, does not follow best practices and is fairly difficult to understand (globals galore, methods spanning 50 lines, eval abuse, etc.). Unfortunately, I am fairly new to the code base and I need to add functionality.
I am sure there is code in there that I could reuse, but I have to meet a deadline and am afraid that the time spent salvaging will end up with me rushing at the end. What is better in the long run? Part of me wants wants to reuse as much as possible, but another part says I should focus on writing the new functionality from scratch, at the risk of duplication (with a plan to refactor when I have more time to spend with the existing code)? I’m leaning towards the latter but wanted to hear some opinions.
Thanks!
http://www.joelonsoftware.com/articles/fog0000000069.html
http://discuss.joelonsoftware.com/default.asp?design.4.469415.13
http://www.joelonsoftware.com/articles/fog0000000007.html
http://www.paulgraham.com/hp.html
That being said, if there are small sections to clean up, that’s usually fine. Once you have been working on it for a while, you’ll have a better idea of where a strategic, localized rewrite will be most effective and least dangerous.
In a production code base, remember that keeping things status quo for the client is more important than getting new stuff out the door. It won’t stop your boss from yelling at you. But ask yourself how many times you’ve switched to an alternate product because of bugs, versus how many times you’ve done so because the enhancement you wanted wasn’t fast enough in an otherwise workable product.