Spaghetti code
Idiom figure of speech informal
Computer code that is so tangled and badly structured that it is very hard to follow or change.
Meaning & usage
Spaghetti code is a programmers’ term for software whose logic twists back and forth in so many directions that tracing it is like following one strand through a bowl of spaghetti. Changing one part tends to break another.
It is critical but often used with humour, especially about old systems that nobody wants to touch. The image is sometimes extended to any messy system, such as “spaghetti wiring” behind a desk.
Examples
- The old billing system is pure spaghetti code.
- Nobody dares touch that module; it's spaghetti code from 1998.
- Rewriting the spaghetti code took longer than writing the new feature.
Origin & history
The phrase dates from the 1970s, when programmers were debating structured programming. Older styles of code relied heavily on the GOTO statement, which jumps from one part of a program to another and can produce a tangle of paths.
Edsger Dijkstra’s 1968 letter Go To Statement Considered Harmful was central to that debate, although it did not use the phrase. Spaghetti code became the standard mocking name for the style it criticised, and later for messy code of any kind.
Related terms
Sources
- Spaghetti code. Wikipedia.
- Considered harmful. Wikipedia.