8

This question:

Should older code be updated to use newer language constructs, or should outdated constructs be sticked with?

was closed as a duplicate of this question, a canonical locked question about refactoring old code:

I've inherited 200K lines of spaghetti code — what now?

Despite receiving enough votes to be closed, and enough of those close votes to close as a duplicate, there is some disagreement about whether the question should be closed or not.

What should be done with this question?

  • Reopen.
  • Remain closed as a duplicate.
  • Close for a different reason.
  • Something else.
2
  • While I was typing this up a moderator unilaterally answered this meta question implicitly, so I guess the point is moot.
    – user22815
    Mar 27, 2017 at 17:50
  • 8
    No, it's not moot. It's good to have a discussion if there's disagreement.
    – Thomas Owens Mod
    Mar 27, 2017 at 18:29

2 Answers 2

9

I hit up this question in the review queue and reopened it.

Even though there may be mostly an answer in the "duplicate", it's hard to find and doesn't focus on the particular problem at hand. Reading through the "duplicate", it talks about having a style guide with templates and conventions and guidelines for using the infrastructure and tools (which would include compilers and languages).

However, this "duplicate" doesn't address updating these conventions as the environment changes or how you manage software that was written as these conventions apply. I don't think the current answer does that well, either. I'd like to see an answer to the new question about good practices for maintaining and revising the things mentioned in the "duplicate" and how to have legacy code under a previous revision of the conventions live with new code written under a current revision of the conventions.

These questions are definitely related. I think the top answer in the "duplicate" is worth reading. But once you have those things which help manage large and complex source code, there's no guidance for revising as time goes on. I think that's what is being looked for in the new question.

1

This is a good question that is relevant to the systems engineering development life cycle. However, I feel the duplicate candidate adequately answers it, so it should remain closed as a duplicate.

The original question states:

I happen to want to make some enhancements in a still-functional code that was written a long time ago, before the programming language it is written in grew in features. In theory, the whole project uses the up-to-day version of the language, however this particular module (and in fact, many other modules) are still written in the older dialect.

The crux of the issue is "this is old code that works, but is written in a different way than other modules."

From the accepted answer at the dupe target:

Quick Tips for Good House-Keeping

  • When in hotfix-mode, based on a customer support request:
    • It's usually a best practice to NOT go around fixing other issues, as you might introduce new ones unwillingly.
    • Go at it SEAL-style: get in, kill the bug, get out, and ship your patch. It's a surgical and tactical strike.
  • But for all other cases, if you open a file, make it your duty to:
    • definitely: review it (take notes, file issue reports),
    • maybe: clean it (style cleanups and minor violations),
    • ideally: refactor it (reorganize large sections and their neigbors).

This is a checklist of approaches to take when editing old code. Specifically, the "all other cases" section answers the original question by saying, paraphrased, "go ahead and clean it up as time permits, and use official review channels (put it in a bug tracker, for example) to track what you are doing and what might need regression testing."

I get it that the dupe-target answer is huge. It is super-long and includes information that is not relevant here. However, it does contain an answer to the question, which should remain closed as a duplicate.

1
  • 2
    Disagree. The Dupe Target is a veritable thesis. Yes, it covers almost everything a novice could think to ask about codebase maintenance. No, it does not provide effective (e.g. succinct) guidance for the OP's question. Perhaps most significantly, the nature of the questions seem different enough that a person searching with one mindset might not likely click into the other's question.
    – Ian
    Apr 5, 2017 at 23:20

You must log in to answer this question.