Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Spaghetti code
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Meaning == Code that overuses [[Goto|GOTO]] statements rather than [[structured programming]] constructs, resulting in convoluted and unmaintainable programs, is often called spaghetti code.<ref name="Cram5">{{cite journal|last1=Cram|first1=David|last2=Hedley|first2=Paul|title=Pronouns and procedural meaning: The relevance of spaghetti code and paranoid delusion|journal=Oxford University Working Papers in Linguistics, Philology and Phonetics|date=2005|volume=10|pages=187β210|url=http://mostlyharmless.org.uk/wp-content/uploads/2010/12/cramhedley-web.pdf|access-date=5 March 2018|archive-date=6 March 2018|archive-url=https://web.archive.org/web/20180306022905/http://mostlyharmless.org.uk/wp-content/uploads/2010/12/cramhedley-web.pdf|url-status=dead}}</ref> Such code has a complex and tangled [[control structure]], resulting in a program flow that is conceptually like a [[Spaghetti#Serving|bowl of spaghetti]], twisted and tangled<!-- pages 235β236 -->.<ref>{{cite book|last1=Horstmann|first1=Cay|title=Java Concepts for AP Computer Science|date=2008|publisher=J. Wiley & Sons|location=Hoboken, NJ|isbn=978-0-470-18160-7|pages=235β236|edition=5th ed. [i.e. 2nd ed.].|chapter-url=http://horstmann.com/bigjava3.html|access-date=2 January 2017|language=en|chapter=Chapter 6 - Iteration}}</ref> In a 1980 publication by the [[National Institute of Standards and Technology|United States National Bureau of Standards]], the phrase '''''spaghetti program''''' was used to describe older programs having "fragmented and scattered files".<ref>{{cite book|title=ASTM special technical publication|issue=500β565|author=United States National Bureau of Standards|publisher=United States Government Printing Office|year=1980}}</ref><!-- page 15 --> Spaghetti code can also describe an [[anti-pattern]] in which [[Object-oriented programming|object-oriented code]] is written in a procedural style, such as by creating classes whose methods are overly long and messy, or forsaking object-oriented concepts like [[Polymorphism (computer science)|polymorphism]].<ref name="Moha10">{{cite journal|last1=Moha|first1=N.|last2=Gueheneuc|first2=Y. G.|last3=Duchien|first3=L.|last4=Meur|first4=A. F. Le|title=DECOR: A Method for the Specification and Detection of Code and Design Smells|journal=IEEE Transactions on Software Engineering|date=January 2010|volume=36|issue=1|pages=20β36|doi=10.1109/TSE.2009.50|issn=0098-5589|citeseerx=10.1.1.156.1524|s2cid=14767901}}</ref> The presence of this form of spaghetti code can significantly reduce the comprehensibility of a system.<ref name="Abbes11">{{cite book|last1=Abbes|first1=M.|last2=Khomh|first2=F.|last3=Gueheneuc|first3=Y. G.|last4=Antoniol|first4=G.|title=2011 15th European Conference on Software Maintenance and Reengineering |chapter=An Empirical Study of the Impact of Two Antipatterns, Blob and Spaghetti Code, on Program Comprehension |date=2011|pages=181β190|doi=10.1109/CSMR.2011.24|isbn=978-1-61284-259-2|citeseerx=10.1.1.294.1685|s2cid=14152638}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)