Spaghetti code is a pejorative piece of information technology jargon that is caused by factors like unclear project scope of work, lack of experience and planning, an inability to conform a project to programming style rules, and a number of other seemingly small errors that build up and cause your code to be less streamlined overtime.
Overall messy code, is not easy to work with, resulting in a program that is not maintainable in the long run.
Typically, spaghetti code occurs when multiple developers work on a project over months or years, continuing to add and change code and software scope with optimizing existing programming infrastructure.
It is not clear when the phrase spaghetti code came into common usage; however, several references appeared in 1977 including Macaroni is Better Than Spaghetti by Guy Steele. In the 1978 book A primer on disciplined programming using PL/I, PL/CS, and PL/CT, Richard Conway used the term to describe types of programs that “have the same clean logical structure as a plate of spaghetti”, a phrase repeated in the 1979 book An Introduction to Programming he co-authored with David Gries. In the 1988 paper A spiral model of software development and enhancement, the term is used to describe the older practice of the code and fix model, which lacked planning and eventually led to the development of the waterfall model. In the 1979 book Structured programming for the COBOL programmer, author Paul Noll uses the phrases spaghetti code and rat’s nest as synonyms to describe poorly structured source code.