It describes code that comprises well-structured classes that are easy to understand in isolation, but difficult to understand as a whole. Lasagna code Lasagna code refers to code whose layers are so complicated and intertwined that making a change in one layer would necessitate changes in all other layers. Examples Here follows what would be considered a trivial example of spaghetti code in BASIC. The program prints each of the numbers 1 to 100 to the screen along with its square. Indentation is not used to differentiate the various actions performed by the code, and the program's GOTO statements create a reliance on line numbers. The flow of execution from one area to another is harder to predict. Real-world occurrences of spaghetti code are more complex and can add greatly to a program's maintenance costs. 1 i=0; 2 i=i+1; 3 PRINT i; "squared=";i*i; 4 IF i>=100 THEN GOTO 6; 5 GOTO 2; 6 PRINT "Program Completed."; 7 END Here is the same code written in a structured programming style: 1 FOR i=1 TO 100 2 PRINT i;"squared=";i*i 3 NEXT i 4 PRINT "Program Completed." 5 END The program jumps from one area to another, but this jumping is formal and more easily predictable, because for loops and functions provide flow control whereas the goto statement encourages arbitrary flow control. Though this example is small, real world programs are composed of many lines of code and are difficult to maintain when written in a spaghetti code fashion. Here is another example of Spaghetti code with embedded GOTO statements. INPUT "How many numbers should be sorted? "; T DIM n(T) FOR i = 1 TO T PRINT "NUMBER:"; i INPUT n(i) NEXT i 'Calculations: C = T E180: C = INT(C / 2) IF C = 0 THEN GOTO C330 D = T - C E = 1 I220: f = E F230: g = f + C IF n(f) > n(g) THEN SWAP n(f), n(g) f = f - C IF f > 0 THEN GOTO F230 E = E + 1 IF E > D THEN GOTO E180 GOTO I220 C330: PRINT "The sorted list is" FOR i = 1 TO T PRINT n(i) NEXT i See also Big ball of mud, a piece of software with no perceivable architecture International Obfuscated C Code Contest, a competition to produce pleasingly obscure C code Technical debt The Elements of Programming Style