Spaghetti Code

What Does Spaghetti Code Mean?

Spaghetti code is a slang term used to refer to a tangled web of programming source code where control within a program jumps all over the place and is difficult to follow. Spaghetti code normally has a lot of GOTO statements and is common in old programs, which used such statements extensively.


The rise of more structured programming languages, like object-oriented programming languages, has reduced the prevalence of spaghetti code.

Techopedia Explains Spaghetti Code

Old programming languages like BASIC, which featured GOTO statements, were highly susceptible to spaghetti code because programmers found it very convenient to direct control of the program from one area to another using the GOTO statements.

However, spaghetti code is dreaded by programming teams who are tasked to look into old programs because the program logic becomes very difficult to follow. Because it gives rise to complex code, the use of GOTO statements and spaghetti code is only convenient during the original development process.

The older a program gets which was written with spaghetti code, the more difficult it is for developers to follow, even the original developers.


Related Terms

Margaret Rouse

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.