spaghetti code


spaghetti code

[spə′ged·ē ‚kōd] (computer science) Computer program code that lacks a coherent structure, and in which the sequence of program execution frequently jumps to a distant instruction in the program listing, making the program very difficult to follow.

spaghetti code

(programming)A pejorative term for code with a complex andtangled control structure, especially one using manyGOTOs, exceptions, or other "unstructured" branchingconstructs. The synonym "kangaroo code" has been reported,doubtless because such code has so many jumps in it.

spaghetti code

Program code written without a coherent structure. The logic moves from routine to routine without returning to a base point, making it hard to follow. It implies excessive use of the GOTO instruction, which directs the computer to branch to another part of the program without a guarantee of returning.

Although there are always ways around it, structured programming attempts to eliminate spaghetti code by using functions that, after being called and executed, return the computer to the instruction following the one that called it. See lasagna code, ravioli code and spaghetti development.


Spaghetti Code
There are tons of spaghetti code lurking in the millions of applications written over the years. Spaghetti code is often the result of being in a rush to make a change in the program or fix a problem.