How To Deal With 200k Lines of Spaghetti Code 236
An anonymous reader writes "An article at Ars recaps a discussion from Stack Exchange about a software engineer who had the misfortune to inherit 200k lines of 'spaghetti code' cobbled together over the course of 10-20 years. A lengthy and detailed response walks through how best to proceed at development triage in the face of limited time and developer-power. From the article: 'Rigidity is (often) good. This is a controversial opinion, as rigidity is often seen as a force working against you. It's true for some phases of some projects. But once you see it as a structural support, a framework that takes away the guesswork, it greatly reduces the amount of wasted time and effort. Make it work for you, not against you. Rigidity = Process / Procedure. Software development needs good processes and procedures for exactly the same reasons that chemical plants or factories have manuals, procedures, drills, and emergency guidelines: preventing bad outcomes, increasing predictability, maximizing productivity... Rigidity comes in moderation, though!'"
Re:Farm out OP writing, too. (Score:4, Interesting)
I advise printing it out and posting it in the hall in printed form, annotated with contributors. Paper the walls with it. You would be surprised how much more efficient that makes a coder even if it's not ever read.
Also, for debugging sometimes you have to get down on the floor with 50 pages of fanfold and work it out. Decorum be damned. A PC only has so much vertical resolution and sometimes you need more than to peek at the code through a sliding window.
Re:...no (Score:4, Interesting)
In several iterations, disentangle and break the code into smaller and more understandable chunks.
After breaking the code into smaller chunks clean them up (code conventions, algorithms, ...) and reorganize as needed.
200K Lines not that much (Score:5, Interesting)
I have spent most of my career as a software developer inheriting and updating such spaghetti code bases. Here are few remarks and some of my experiences around this:
In summary, don't be too scared of a legacy spaghetti code base. These things can be understood well enough in time to refactor or port to a new platform.