Spagettikoodi
From Wikipedia, the free encyclopedia
From Wikipedia, the free encyclopedia
Spagettikoodi tarkoittaa tietokoneohjelman lähdekoodia ilman johdonmukaista rakennetta. Spagettikoodissa ohjelman logiikka siirtyy rutiinista toiseen palaamatta alkupisteeseen, joka tekee siitä vaikeasti seurattavan. Spagettikoodi viittaa liialliseen GOTO-käskyjen käyttöön, joka ohjaa tietokoneen suorittamaan toista osaa ohjelmassa ilman takeita palaamisesta.[1]
Ruven Brooksin mukaan kehittäjät ymmärtävät ohjelman ylhäältä-alaspäin mallin mukaan muodostaen hypoteeseja toiminta-alueesta, siirtämällä tämän lähdekoodiin ja määrittämällä sen asteittain. Tästä johtuen koodin ymmärtämiseen vaikuttavat asiat ovat olennaisia ohjelman toiminnan ymmärtämiseen ja tämän myötä ohjelman ylläpitoon sekä jatkokehitystoimintaan. Antisuunnittelumallit (engl. anti-pattern), jotka ovat heikkoja ratkaisuja toistuviin suunnitteluongelmiin, kasvattavat merkittävästi työmäärää tutkimisessa ja muokkaamisessa.[2][3]
Tarkkaa syntyä sanalle ei ole tiedossa, mutta se on ilmestynyt 1970-luvulla kuvaamaan koodia, jossa ei ole varsinaista rakennetta.[4] Muun muassa Guy Steele vuoden 1977 artikkelissa Macaroni is better than spaghetti on käyttänyt termiä spagetti.[5]
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.