Spaghetti code defined
I recently read this article with interest – What is spaghetti code?.
As the title implies, it goes into a lengthy discussion of spaghetti code. So in layman’s terms, what does it mean if your developer refers to your application code as “spaghetti“?
In the old days, coding languages used a construct called a “goto” statement. This was used as a quick fix for bad coding – you could tell the program to jump to another portion of the code if it got to that spot. So it made the code flow like a strand of spaghetti, weaving back and forth.
Modern day programming languages don’t use goto statements anymore. So today, I define spaghetti code as that which has been poorly designed, or modified significantly since it’s original design. Usually this results in code being tossed in to accomplish some new feature, but not really meshing with the overall code. Think in terms of a single family house that has been turned into multiple apartments. You end up with odd sized rooms, strange room layouts, and the outside wooden steps leading to the second floor apartment entrance. It’s functional, but obvious to anyone that it wasn’t the original design.
With code, sometimes you can hide the code issues behind a nice facade of a gui interface, but usually some oddities bleed through. For instance, one feature doesn’t quite integrate with the rest of the application as it should.
Do you need to fix spaghetti code? Not immediately, but usually major applications and websites undergo a “full rewrite” every 5-6 years. This is because the code has grown beyond the original specifications, and has become unwieldy for the coding team to keep maintaining and expanding. It’s just part of the process with large websites and applications.
Category: Programming Comments Off on Spaghetti code defined