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!'"
...no (Score:4, Funny)
no comment...
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.
Re:...no (Score:5, Insightful)
I disagree. For 200K lines of code, You immediately start a new project to produce the next major release of said code.
200,000 lines of code is a large project, but very do-able for even with a small team or one person. Although you could go in an attempt to tighten up code in smaller chunks, the very fact that this code was written over the course of many years, probably by many authors and styles, means it probably follows no standard to general layout, declarations, etc. (hence the spaghetti).
I would simply support what's there with only a break-fix policy, and immediately start documenting all aspects of it's functionality to rebuild it from the bottom up. The very fact that this code would have so many styles would mean most of it would have to be re-written and documented anyway.
Document the functionality, re-implement with standard code to guidelines, include any feature enhancements that may exist, release new version.
Re: (Score:2)
What's more, there may well be libraries to do some of the functionality. According to the article, it's written in G2 which is all but obsolete. Find a modern language that more closely matches G2's functionality and move to that.
Re:...no (Score:5, Informative)
G2 is being called virtually obsolete. I looked up G2 in Wilipedia comparison of programming languages http://en.wikipedia.org/wiki/Comparison_of_programming_languages [wikipedia.org] and it is listed as:
Language: G2
Intended use: Application, inference, expert system
Paradigms: common graphical development and runtime environment, event-driven, imperative, object-oriented
Plus the search on G2 shows there is a G2++. So what does obsolete mean to those calling it obsolete?
btw, I'm an RPG programmer and I've been writing tons of new business software every day for the last 23 years, the whole time the language has been declared obsolete.
Now get off my lawn.
Re: (Score:2)
G2 is being called virtually obsolete. I looked up G2 in Wilipedia comparison of programming languages http://en.wikipedia.org/wiki/Comparison_of_programming_languages [wikipedia.org] and it is listed as:
Language: G2
Intended use: Application, inference, expert system
Paradigms: common graphical development and runtime environment, event-driven, imperative, object-oriented
Plus the search on G2 shows there is a G2++. So what does obsolete mean to those calling it obsolete?
btw, I'm an RPG programmer and I've been writing tons of new business software every day for the last 23 years, the whole time the language has been declared obsolete.
Now get off my lawn.
So basically similar to LabView? I'd be inclined to re-write this all in LabView rather than try to rewrite this all in traditional software programming.
Re: (Score:3)
One person given 200KLOC of complex spaghetti to rewrite though, if with little documentation outside of the code, and software that doesn't lend itself to automated testing, where the spaghetti logic is of consequence to the business.. that could be a very, very long project (years, easily).
Re: (Score:3)
Yes and no. Part of the complexity of a new program is missing here. The full functionality is mapped out, albeit they will have to have to glean some functionality from the code and most from the end users. That's a huge boon as long as the end users can effectively comminicate or demonstrate that functionality.
In short, the map is already written and scope creep can be largely minimized with some proper expectations and management.
Re: (Score:2)
I would guess 10-20 years.
Re:...no (Score:4, Insightful)
Re:...no (Score:4, Informative)
Isnt this how Netscape died?
According to Joel Spolsky [joelonsoftware.com]...
Good luck with that (Score:2, Insightful)
Your employer probably isn't interested in spending the time and money on a re-write. Nor are the clients going to be interested in waiting that long for new features, either.
You will be made to figure it out and add features, or you will be shown the door.
Re: (Score:2)
As the other responder said, this doesn't appear to be the case for this particular project in TFA. However, you're right, what you describe is normal for most projects. The way to handle it is this: since management isn't interested in doing a re-write, you just do your best trying to figure it out, which of course is not going to be very successful. Keep making excuses about how bad the code is when deadlines fly by. All this time, be sure to be looking for a new job on Dice.com. As long as you're ma
Re: (Score:2)
Re: (Score:2)
Yep. Kids, I recommend finding another major while you still can. I hear medicine is still a pretty good field, and pays much better than this.
Re: (Score:2)
Sometimes the code in question is too broken to keep and refactor; you just need to burn it.
Re: (Score:2)
Re: (Score:2)
I'd do completely opposite.
I'd drop the old code 99-100%. Start from top to bottom, document everything and perhaps even use some other, modern, programming language.
The resulting code base is almost certainly lot less than 100k lines (+ comments & documentation, depends how you calculate these).
Re: (Score:2)
Re:...no (Score:5, Informative)
A break-fix policy is simply stating you will support code to fix any breaks in functionality, while denying any enhancement requests. In short, the only changes you make to the old code would be to fix production issues.
It lets you focus efforts on implementing new code while avoiding supporting enhancements on the old code.
Re: (Score:2)
That's a great policy to have. I wish that Linux distros and various apps were developed like that. I only upgrade for the bug fixes and the security fixes.
Re: (Score:2)
I'm fortunate to have an environment where upper management understands and supports that sometimes deprecating a codebase is more desirable than supporting two code bases in parallel. It can take a LOT of pressure off of a development team to allow them to focus properly on the task at hand. All code eventually gets 'dirty' as it ages. A clean slate with an eye for the big picture (hindsight) can prove invaluable for supportability.
In my opinion, when you are spending more time trying to make code work wit
Re: (Score:2)
"I wish that Linux distros and various apps were developed like that."
Like Debian Stable, you mean?
Re: (Score:2)
"I don't know enough about Debian to comment."
But still you *do* comment. You said "I wish that Linux distros and various apps were developed like that" (adding just security updates to otherwise stable software), when it's obvious you didn't take the time to learn if that's already the case or not.
Re: (Score:2)
So you want a distro that only does bug fixes and security fixes, but doesn't end up with old software? How does that work?
Re: (Score:2)
I don't know. I'd have to look carefully. I'm under the impression that Debian Stable is quite old, and that the desktops that are available are also quite old.
Errr, well, yes... that's what you asked for. You can't have it both ways. If you specify that you want only bug-fixes and not new functionality, you can't then complain when you get just bug fixes and no new functionality.
The current Debian Stable (Squeeze) is a very capable distribution, and whilst it doesn't have the very latest versions of Gnome and KDE (as per your specification) they are more than modern enough for everyday use.
"Cobbled together over 10-20 years . . . ?" (Score:5, Insightful)
Wouldn't that be Linux? It seems to work fine for me.
If something has become spaghetti over 10-20 years, then no one cared that it became spaghetti over 10-20 years. And it will still be spaghetti over the next 10-20 years. Fixing something like this requires a commitment from management, which means money. If the management of the project aren't convinced that cleaning up the development process is worth the initial investment for the long term, then they choose to deal with the constantly higher costs forever.
Something like this makes me think that this is one of those problems that get pushed off for someone else to deal with later. And the next person perpetuates this, by doing the same.
Re:"Cobbled together over 10-20 years . . . ?" (Score:4, Insightful)
would fixing it to not be spaghetti be any better though? would fixing it to be really non-confusing depend on changing real world processes of clerks etc?
spaghetti turned into OO is going to be spaghetti too, just with a lot more of sauce and different bits which look almost the same but turn out to be tomato or minced meat upon closer inspection and when you take plunge into the platter and eat something you don't really know what you ate or how it got there, what I'm trying to get at is that if it's spaghetti because of already re-using lots of the code in lots of places then the rewrite could end up being 2 million lines (commercial rewrites of sw for gov. have a habit of ending up like this..).
at least he can probably feel good about it not being knights capital trading system.
but he's asking how to deal with it, with good development tools(that have good find/locate) and good memory. start exploring what the sw really does and guessing where you might be asked to do modifications.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
All true
I would add that one of the disappointing things about programming is that few people ever see let alone appreciate a job well done.
If the application works or even works "good enough", nobody cares if the coding is done well.......they don't even care to look at it.
Re: (Score:2, Insightful)
The really frightening tought is that there are many 40 year old first year CS students.
Re: (Score:3, Insightful)
When I was taking my 2nd degree in Computer Science years ago, there was quite a few mature students. They are actually doing well in class in spite of other distractions in life such as family.
There was nothing wrong with people deciding to learn new things or switch career later in life. Are you biased or just like to discriminate people for their age?
I would think that matured people are more suited for computer science as they are not as much distracted by the new "Shiny" new thing that comes along an
Re: (Score:2)
Are you biased or just like to discriminate people for their age?
He's probably American - ergo bias and discrimination are his first amendment rights - along with racism, sexism. Etc. It's the curse of the first amendment - they're thinking is stuck in the 17th century.
Our former mayor was fond of saying that "people don't suffer in silence."
Re: (Score:2)
There's a lot of 40-year-old women these days who look pretty hot in a speedo. People aren't aging as badly as they used to.
Re:Don't put up with it. (Score:4)
If things go well, your bank account will know, for example.
What does it even mean "my boss doesn't really care about" a project? Is his vision somewhere else, but has given you the job of guarding the crucial machinery on which everything else builds?
(And being homeless sucks badly, by most accounts.)
Re:Don't put up with it. (Score:5, Insightful)
Re: (Score:3)
If that's the case, the stated or implied directive is don't break this. Which means probably no major rewrite.
This should be +5 Insightful. It's the bottom line for production software.
Re: (Score:2)
I love the courses in college that tell you how you should do something to make maintenance easier but then ignore the real world contraint of time and money (probably the most underrepresented part of making software). Making something with care takes more time (and therefore money) thank hacking something together.
Sorry, but the college courses are correct; hacking something together poorly will cause you to have higher long-term costs. CS departments can't help it if the morons over in the Business Scho
Easy! (Score:5, Funny)
Outsource it to India!
Re: (Score:3)
Huh, they're getting to be as expensive as in-house development with just as sloppy code depending on which business you go to. There is also a substantial language barrier in some cases even though there are a lot who do speak English they do not comprehend some concepts. You then need a liaison who does and can translate your requests. That adds cost. We did find a very good software development company that is prompt, competent and who worked to understand our needs. We do save money but it's not nearly
Re: (Score:2)
You can spot Welsh from a mile away :P
When I could not find "cewch eich cod" in my Klingon dictionary, I assumed he was just posting while drunk.
Re: (Score:2)
Welsh
while drunk
this is synonym, isn't it?
Re: (Score:2)
Rewrite it (Score:2)
Rewrite it from scratch using the spaghetti code version to run correctness tests to verify you haven't changed the behaviour.
200k lines is about how large the Doom codebase was, and it wasn't uncommon for John Carmack to rewrite most of his game engine in a couple of weeks, a week, or even a weekend when he felt it wasn't going on a good path.
Re:Rewrite it (Score:5, Insightful)
200k isn't something you're going to rewrite in a couple of weeks. I think the absolute maximum you could get (for one very skilled person) would be about 5k-10k per week. Rewriting would take on the order of half a year.
Re: (Score:3)
Re: (Score:2)
You're right, but that would be speculative. Also, don't forget about possible migration of data from the old to the new system. That may take considerable effort too. And testing (the old system has gone through 10+ years of testing).
Re: (Score:2)
You're right, but that would be speculative
True, although I've found that attempting to rewrite a system is a good way of determining how complex it really needs to be. In the end, it doesn't matter if you actually use the rewrite, or even if you finish it. Once you've spent a bit of time on it, you have a much better idea of how the original system should have been designed, and that can help refactoring immensely.
Inexact Results (Score:5, Insightful)
Rewrite it from scratch using the spaghetti code version to run correctness tests to verify you haven't changed the behaviour.
And just how are you supposed to write "tests for correctness" when the very concept of what is "correct" is embedded in the code?
Any such tests would embody your own notions of what is correct based on your understanding of a codebase that cannot be understood.
Furthermore, Doom is quite a different thing. You have an end result that can be somewhat different and it doesn't matter - it could render textures such that they appear rather different but if you find it visually OK then it's fine.
No such luck with business software which usually has extremely rigid and exactly output, often output other systems are depending on being just so. There is no room for alteration of behavior, yet as I said no-where exclaims all of the features of the output you cannot possibly understand....
I agree with a few responses that the only way to proceed is to re-write tiny parts, that at most affect one other system in the company - with the explicit buy-in from those other groups something may change, and the understanding you may have to back out your changes wholesale if you cause too much disruption.
Can't get buy in to proceed? Then quit or work with the code as is.
Re: (Score:2)
Simple: If the original code is the specification
HA HA HA HA HA HA.
You've never written code for a corporation before, I can tell.
The code IS the specification. All other documents are LIES.
The Timeframe (Score:2)
If your new code does what the old code did when both are fed the same input, you're good to go.
I am curious just how long the project you propose will take to complete given that you need to produce an infinite combination of inputs to succeed.
Your basic idea is not bad, but it's simply impossible to apply to the whole system at once. That's why I suggested a small piece that interfaces with at most one other system, so you can in practice limit inputs and have somone else really tell you what is flawed i
Wrong, incorrectness readily found (Score:2)
If nobody knows if the original program is functioning correctly then nobody knows if the replacement is functioning incorrectly.
Another person who has never developed software in a company I see.
You'll find ZERO people that are willing to confirm your output is correct.
However you'll find hundreds eager and willing to find flaws in your output. Sometimes even if they have to make it up, or sometimes even if they just aren't sure. For any question raised you must be prepared to prove that any questioned o
Re: (Score:2)
"correctness tests to verify you haven't changed the behaviour"
So apart from rewriting, you will also have to write a lot of unit tests. Depending on the complexity and type of code, that will take a lot of time too.
I've rewritten 15 year old Fortran code. It has now some the features that were the reason for the rewrite. That wasn't cheap, but now we have software that can be maintained by a lot more people AND it has unit tests :)
But writing those unit tests required diving into the old code to produce (p
Re: (Score:2)
Unit tests are not 'rewriteable'.
A unit test is testing a compilation unit.
You need high level functional (scenario/story based) tests, to test a rewrite.
1. Lose the attitude (Score:5, Insightful)
Well step 1 would be to lose the attitude.
It's code, it may be in an obsolete language, it may be not to the best industry standards, but its code and it's got enough knowledge in it, that nobody wants to throw it away, and they hired you to maintain it.
Step 2, I don't know why you would define a process before you understand the code you are to apply the process too?
Seriously, wtf is all the process stuff about, you're the sole programmer, any rules you set are rods to break your back when you first hit a piece of code you have to break the rules.
Step 3, you serve them. If you want to port it to a more modern maintainable language, choose one that's easy for THEM to transition to. They've got the knowledge that drives the company, not you, you are the cleaner here. If the phone rings your turn off your vacuum and let them do their job, Mr Cleaner. Nobody gives a fork if the cleaner has best industry procedure for cleaning an office.
Step 4, break it down. tiny bit by tiny bit, port to a new CLEAN structure, bit by bit. They wrote it, they can identify the core stuff.
Step 5, once you've ported it, along comes an engineer with a code written to the old language and old methods. Again, that's fine, put away the process manual, these are the experts, if that's the language he can communicate to you in, it's fine, you can understand it, you can port it, you can help him speak the modern lingo. Don't quote your processes to him, you're just the cleaner.
As for this:
"Software development needs good processes and procedures for exactly the same reasons that chemical plants or factories have manuals"
That's someone who *implements* things, typically a bolt together module manager. He is not someone who creates *new* things. Because news things don't come with manuals. You don't know the rules of how they work till the problems needed to make them work are solved. One assembles Microsoft IIS blocks, the other works for Google on image processing. Which are you?
Re: (Score:3, Insightful)
unfortunately, I think most devs (especially the kind to complain about someone else's "crufty" code) will spend months rewriting, refactoring and introducing today's "best practices" like IoC and Dependency Injection and come up with 300kloc of even worse spaghetti code, that now has extra bugs to be fixed too.
A bit like how a discussion on stack overflow ended up discussed on ArsTechnica for some (probably advertising-related purpose) and now has come to Slashdot for further adoption. 4chan, you're next.
Re: (Score:3)
I don't mean any disrespect, but you seem to imply that "those people" don't know what they are talking about and have a bit of attitude. It seems like your post has a bit of an attitude.
Those are good techniques you are criticizing.
You could have brought up the very good point that programmers should ask themselves why the former devs did something a certain way.
Re: (Score:2)
its too difficult to describe all the bad techniques that get used simply because they're fashionable, but that's what I meant - the kind of devs who read stuff on the web and suddenly think "we must have that too".
I went for a job interview a while back and when I gave my reply to their question about test-driven development (that it wasn't a magic bullet that fixes all code quality issues) they weren't too impressed. Obviously they'd read something that said it was, and they weren't going to believe anyth
Fix the most urgent problem first (Score:2)
Don't touch it (Score:5, Insightful)
Re:Don't touch it (Score:5, Insightful)
Beware of the second system effect.
http://en.wikipedia.org/wiki/Second-system_effect [wikipedia.org]
Rewriting code can kill you in the short term.
http://www.joelonsoftware.com/articles/fog0000000069.html [joelonsoftware.com]
Or help you in the long term.
http://notes-on-haskell.blogspot.com/2007/08/rewriting-software.html [blogspot.com]
I recall another similar article about a rewrite of MS Office, and what a mistake it was...
Re: (Score:2)
All the advice to rewrite it is misguided. Maybe rewrite small parts that you need to to keep it working on new hardware, or whatever, but if it works, I would think that wholesale rewriting is asking for trouble. The Ars article is full of great advice about what you should do to manage a large codebase going forward, but actually it doesn't really address the question of what to do about a large legacy codebase that wasn't written with best practice. The best software is written by incremental improvement
Re: (Score:2)
Not just management, you should also blame the developers that wrote it that way.
It's a manager's job to tell how to do it; it's a developers job to implement it properly. You can't expect a manager to write perfectly modular, readable software - that's the developer's task, and blame failing to fulfill that task should be largely on the developer.
Re: (Score:2)
That depends. If the developers had time to do it right and didn't, blame them. OTOH, if the code only got time allocated to it when someone's hair was on fire and they got moved on to something else as soon as the bug was papered over (to make sure they had really found the problem) rather than allocating time for the real fix, blame the management.
Re: (Score:2)
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.
Re: (Score:2)
What are these "modules" that you are speaking of? And "separate" - could you elaborate? I've seen code where one couldn't help to ask the above questions. Asking the architect about what modules the system had yielded the answer "It's complicated, you'll just have to get used to the system". Which meant, committing the full 200k lines to your brain and needing to understand the cod
Re: (Score:3)
1) 200K lines is not such a formidable size. If your average module size is 1000 lines of code, that's 200 separate modules. Or if the module size averages 2000 locs, that's 100 modules.
You make a very big assumption here, and that is that this code is written in neatly separated modules. The submitter asking for help; calling it "spaghetti code" that has been "cobbled together" over a long period and presumably by many different developers; those points make me doubt you can make such an assumption.
It can very well be a single "module".
Re: (Score:2)
I'd have to agree on this.
As a software developer I've experienced this most of the time, working with code bases much larger than this without any sort of documentation. It's not unusual for single files to be more than 4,000 lines of code and to have thousands of files, with the occasional crazy branching 10 levels deep within a single function.
It's just something you have to deal with as a professional software developer. It's not really a problem. Knowing how to use your tools efficiently comes a long w
Re: (Score:2)
In large code bases, it can be rare that everything follows the same naming conventions, indenting style, or even programming style, simply because hundreds of people work on the code, and different teams w
NOT like a chemical plant (Score:3)
At the very least (Score:2)
Big Ball of Mud (Score:2)
.
A BIG BALL OF MUD is haphazardly structured, sprawling, sloppy, duct-tape and bailing wire, spaghetti code jungle. We’ve all seen them. These systems show unmistakable signs of unregulated growth, and repeated, expedient repair. Information is shared promiscuously among distant elements of the system, often to the point where nearly all the important information becomes global or duplicated. The overall structure of the system may never have
Re: (Score:2)
that article is a big ball of mud.
but it makes a good point, you need to first focus on that the wanted features work.
200k lines isn't too much (Score:3)
Reengineering and rewriting is usually the best option. However, you need skills and experience in order not to make the same mistake the previous developer did. Of course, management must trust and approve your actions.
A few dos:
* Learn at least UML use cases, components diagrams and sequence diagrams.
* Make use cases and check these with affected parties.
* Start of with a rough component model of the new system.
* Make a clear picture which nodes (hardware + OS), subsystems (units performing a function), software components (modules containing data, modules performing a function, etc...) and agents (users, triggers/schedulers) are involved.
* Draw the interactions between the subsystems and/or software components.
* Clearly document which interactions are on-line and which ones are batch/background/off-line.
* Specify interfaces. (Used file formats, protocols, software library interfaces if you will.)
* Slowly refine your model until you feel comfortable with it.
* Make a rough class model and keep usability and maintainability in mind. Backtrack if necessary.
* Divide software components between "dumb" containers of information (e.g. plain Java beans) and components performing functions (business logic if you wish.)
* Decide which interfaces to make public and which not.
* Describe restricted/private bits of code just enough for maintainers to understand them. And nothing more than that.
* Make as much unit as necessary for your components. Unit test enough functionality.
* Communicate your results regularly and refine your model where applicable.
* Define integration tests and do these very seriously.
* Define regression tests and perform these very seriously.
* Make involved parties accept parts of the system according to performed integration and regression tests.
* Try to plan gradual decommissioning of the legacy system.
* Document the system "enough". System architecture (from UML), references from architecture to code, installation manual and operational manual are the most important ones.
* Try to achieve longevity in the documentation. Abstract details and convince involved people that that is a good thing.
* Define 1st, 2nd and 3rd level support. Preferably you should remain 3rd level support to better enjoy sleep.
* Conform to standards and practices if they reduce discussion and enhance clarity.
* Use well established techniques. E.g. JPA and JAXB.
* Allow well established component manufacturers to make your programming life easier. E.g. Apache Commons.
* Be tidy.
A few don'ts:
* Avoid OO pattern overkill.
* Don't take the quick and dirty option too quickly. Those decisions will haunt you eventually.
* Avoid making everything public. Documenting and maintaining public interfaces is more expensive.
* Try to avoid big bangs.
* Avoid less well established component manufacturers. My next project did use components from less established component manufacturers and their sell by date has generously expired.
* Don't allow babling "architects" to make a mess of your system. But don't alienate them either.
I may have forgotten a few things but this is all stuff I consider even for smaller projects.
To All Tutoria And Book Authors (Score:2)
I've dealt with a number of legacy code bases, done poorly. Some of the worst examples were done by veteran procedural programmers who picked up an OO language via tutorials.
The worst of their evils could be greatly reduced by all tutorial and book authors, by stating, promiently, the rule of thumb that if the module they are typing goes past one screen in height that they should start thinking about breaking it into another module.
Almost every language has a module of some kind ( procedure, function, subr
Read The Article (Score:2)
The article is excellent. It's publishing guidelines very similar to those I use, and my colleagues use, when dealing with our business partner's accumulated software projects, and covers it very well: I intend to use it as a checklist for spaghetti code integration projects.
I'd emphasize the switch to good source control management (SCM). too many workgroups have undocumented workflows, and benefit profoundly from switching to or learning to properly use a robust system. This process also helps identify wh
Reminds me... (Score:2)
Reminds me of how as a young lad, I went to work for a jewelry company's "IT Department". I put it in quotes because the department consisted of me, a supervisor who couldn't code, and a department head that had no idea whatsoever as to anything that happened on the company computers. Someones nephew or son that got put on the payroll is my guess.
Anyhow, they had about three billion lines of applications written in Dibol, all spaghetti code, no documentation, last time they had employed anyone who could c
Tests, tests and more tests (Score:2)
Rewriting from scratch is probably the worst thing you can do. See this article [joelonsoftware.com] by Joel Spolsky,,
There is a whole book on how to do this (Score:3)
Being anally retentive is not a winning stragegy (Score:2)
I stopped reading shortly after "I am aggressive when it comes to coding conventions"
The mention of Agile as a positive strategy and the volumes dedicated to "format" of code are only useful to scratch an itch. They are only valuable in the mind of the author and those who think like him and rarely have any effect on outcomes.
Ridigity * is not a strategy in and of itself. It is the preference of someone who is anally retentive and change adverse.
The wins from his scheme are like the wins from modern langu
I am in a similar situation right now. (Score:2)
Its not 200k Lines, more on the order of 10-20kLines (depending onf the count; its written in a highly compact language). It is not my main task to restructure it, as a matter of fact i have rediculously little time budget for it, give the current state of the code. My task is to integrate new features into the code. However when i looked at it an rewrite seemed inevitable.
Let me break dow how i try it:
a) Analyze why the problem is there. There are two aspects of it: Is there a fundamental problem with the
Make a plan to slowly evolve the software. (Score:2)
Good software evolves.
You need to forget all grandiose plans to fix the software, especially if the ideas come from academia. Become unprincipled with respect to practicality.
The software has already evolved a lot. If you attempt to recreate from scratch, you will almost certainly repeat previous errors, even if you avoid the current maintenance mess.
The problem is that the software has evolved towards ext
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: (Score:3)
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.
You can also flip through fanfold like a book and see two pages at a time with an option to turn several pages at once.
Re: (Score:2)
Re: (Score:2)
I was about to ask the same question. The only places I even see those old dot-matrix printers these days is at banks, and they appear to be using the exact same printers they were using 25 years ago.
Re: (Score:2)
eBay.
I know the last time I had to buy any was about eight years ago. The narrow carriage models for 8.5x11 were still being sold by Okidata. Our wide carriage for greenbar were still kicking along. I had one saved for a while that we no longer needed, but I think it got tossed following a divorce :(
Re: (Score:2)
I googled those things some time ago, maybe a few years ago, perhaps on Newegg, and was surprised to see them still being sold (though again, I've never seen one sold in a local store, I think it's online-only). But what surprised me even more was that it looked like they were exactly the same as they were around 1990. I mean they were identical: the cabinets, the control buttons; the designs hadn't changed one bit since then. They looked really odd compared to the aesthetics of modern computer equipment
Re:stackexchange. (Score:4, Informative)
I knew I read this before:
http://programmers.stackexchange.com/questions/155488/ive-inherited-200k-lines-of-spaghetti-code-what-now [stackexchange.com]
That article is linked in the first sentence of the summary.
Re: (Score:2)
Yeah, it was posted on ArsTechnica yesterday too (kinda like a professional, adult version of Slashdot).
But it's OK, I still stick to Slashdot because I enjoy reading the trolls for some strange reason.
Re: (Score:2)
don't forget a fork. /:)
all spaghetti needs a fork, even spaghetti code.
Re: (Score:2)
Don't fall for it, it's a trap. Before long, it will be expected from you. At home, I don't get paid for the hours I put in. At home, I don't receive any recognition for the work I've put in. Using home-made stuff at work puts the ownership of your stuff in question. I choose to keep home and work separated. At home is where I work on MY stuff.
Re: (Score:2, Informative)
Usually when the inxperienced programmer does the rewrite, "initial results are promising".
That is, it is possible to quickly build a basic framework with badly designed error handling and
only part of the requested features.
When it is tested in real life, lots of omissions and problems are found.
Once these are fixed, the result is as messy and unstructured as the initial system was before
it was rewritten.
Re: (Score:2)
This. All too frequently.
Re: (Score:2)
Re: (Score:2)
While I usually don't advocate "use language X," a mess of this size (200K LOC) with a non-CS developer team, may be a pretty nice fit for a Python based retrofit.
1. Get source code control in place
2. Get automated builds/testing in place
3. Define functionality by writing Python unittests
The problems you encounter in step 3 will drive how you incrementally, or otherwise, refactor the code:
a) can Python even interface to the system in a reasonable way?
b) can people even agree on a good test suite?
c) does run
Re: (Score:3)
You've never seen real spaghetti code if you believe this. In a really nasty ball of spaghetti, there's nowhere to make the cut; any significant section of the codebase essentially dep
Re: (Score:2)
No-one does that any more. We just boot up a simulated world full of imaged human minds and overclock the substrate [amazon.com] until they've rewritten the code for us. After that we wipe the simulation before they can develop an exploit that lets them jump out of the VM. Much simpler than hand-coding AIs.