News for hackers. Stuff that matters.
Re:I've inherited 200K lines of spaghetti code—what now? by Kilimanjaro on Saturday August 04, 2012 @01:17PM (#4339003)
Dump it and rewrite it in ten thousand lines of beautifully crafted code.
Re:I've inherited 200K lines of spaghetti code—what now? by eps on Saturday August 04, 2012 @01:45PM (#4339088)
Also known as "Russian refactoring".

Every self-respecting Russian programmer will always try and convice you to rewrite everything from scratch. Regardless of the context. I'm pretty sure it's in their DNA.

Re:I've inherited 200K lines of spaghetti code—what now? by YuriNiyazov on Saturday August 04, 2012 @02:27PM (#4339208)
Where is it known as such? Googling "Russian refactoring" brings up nothing related.

This is not strongly exhibited amongst me and my friends. Maybe we are not self-respecting.

Re:I've inherited 200K lines of spaghetti code—what now? by huhtenberg on Saturday August 04, 2012 @03:19PM (#4339357)
You are young yet :) Virtually every Russian dev over 30-40 I know is like that. I am myself that way too. It always seems easier to redo from scratch than to waddle through someone else's code.
Re:I've inherited 200K lines of spaghetti code—what now? by zeroonetwothree on Saturday August 04, 2012 @03:33PM (#4339401)
This is true of non-Russians as well.
Re:I've inherited 200K lines of spaghetti code—what now? by eps on Saturday August 04, 2012 @05:10PM (#4339664)
Chill, comrade Yuri :) It's a joke. Though... not really.
Re:I've inherited 200K lines of spaghetti code—what now? by greenyoda on Saturday August 04, 2012 @02:53PM (#4339289)
He can't do that, since he doesn't have the hundreds of man-years of domain knowledge that the authors of the code have accumulated. As a software developer, he probably doesn't know the first thing about how a chemical plant works. ("The program itself is a physical model of a complex chemical processing plant; the team that wrote it has incredibly deep domain knowledge but little or no formal training in programming fundamentals.")

Understanding 200K lines of complex code well enough to be able to rewrite it is hard enough, even if it's just pure database or graphics software. If it's about something you know nothing about you're going to have to learn something about the domain first, just to understand if the output you're seeing is anywhere close to correct. You're going to need to know whether some odd behavior of the code is essential to its correctness and must be preserved, or an accident of its particular implementation which can be changed or removed.

Also, you can't just dump some system that people depend on to get their work done. You have to maintain it and fix bugs while writing its replacement. Given that he's just a lone developer and doesn't have the budget or authority to hire a large team of professional hackers to help him, his only chance for success is to start learning about the system, adding tests and making small refactorings.

Re:I've inherited 200K lines of spaghetti code—what now? by vineet on Saturday August 04, 2012 @02:44PM (#4339260)
Sorry, but this is really bad advice. It is very tempting to redo something from scratch, but in doing so you will end up spending a very large amount of time fixing issues and adding details that were already done in the original code.
Re:I've inherited 200K lines of spaghetti code—what now? by antidoh on Saturday August 04, 2012 @03:20PM (#4339362)
I think the advice was sarcastic.
Re:I've inherited 200K lines of spaghetti code—what now? by vineet on Saturday August 04, 2012 @03:23PM (#4339371)
Oh, In that case...

(I can't tell you how many times I have heard the same advice being given seriously)

Re:I've inherited 200K lines of spaghetti code—what now? by cjdentra on Tuesday August 07, 2012 @09:03AM (#4349851)
Oh yes, I have seen where re-writes are actually done. Developers start to talk about the lack of "scalability" and "maintainability" of the application with the best solution being to rewrite the app. I've also seen Java-to-Microsoft stack ports being bandied about. Generally it is a really bad idea but some of the decision depends on the language(s) preferred by the firm inheriting the app and the size of the app.
Re:I've inherited 200K lines of spaghetti code—what now? by TillE on Saturday August 04, 2012 @05:34PM (#4339742)
It can sometimes be the right approach. It's not a decision to be taken lightly, but it should be on the table.

Especially if your goal is not to duplicate the functionality of the old software precisely, but to provide a significant upgrade. It really depends on the requirements.

Re:I've inherited 200K lines of spaghetti code—what now? by antidoh on Saturday August 04, 2012 @03:25PM (#4339374)
Same.