Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

10
  • 3
    "Do not---I repeat: DO NOT---make the mistake of trying to rewrite everything from scratch" It kind of depends on the situation and the size of the project. You cannot say for sure that rewriting everything from scratch is always bad. I've been in plenty of projects where I decided to maintain the badly written mess as it is, then later realized that it would have been much better, faster & cheaper just to rewrite the damn thing from scratch, as that was what I had essentially been doing anyway, file after file, while hunting down bugs. Commented 2 days ago
  • 2
    One particular project I spent nearly 3 years at salvaging a trainwreck of a code base and the product is still glitchy and unsatisfactory. If I had rewritten it from scratch that would have taken at most a year and likely resulted in a much better product. It depends on your skill and experience of course - rookies are usually very bad at program design so writing something from scratch for a rookie will not necessarily mean that the new code is any better, just a different kind of mess. But at least maintaining your own mess is far easier than someone else's mess :) Commented 2 days ago
  • 5
    @Lundin: I agree that there are exceptions to that rule, and, yes, I have also done my share of from-the-scratch-rewriting. As you say, it depends on the situation. In my experience, "technical infrastructure" code is much easier to rewrite than "business logic" code where you can't say for sure whether that strange if condition is a bug or a deliberate change based on a long-forgotten, undocumented user requirement, which might or might not still be required. Commented 2 days ago
  • 3
    On that link Things You Should Never Do, Part I: Never listen to advice that begins with "Never ...". ... Commented 2 days ago
  • 7
    @Lundin "I think I would have been better off if I had rewritten it" is NOT THE SAME AS "I rewrote it and it worked great". There are hundreds of situations where "I think rewriting it would be less painful" to the one case of "rewriting it was less painful". The fundamental problem is both fixing and rewriting require fully understanding what the original code does. If you don't fully understand what the original code does, rewriting is a huge gamble. And working out how it works exactly is the hard part of fixing it. Rewriting pretends you can skip over that part. Commented yesterday