|Spaghetti with meatballs (programming) was nominated for deletion. The debate was closed on 23 September 2009 with a consensus to merge. Its contents were merged into Spaghetti code. The original page is now a redirect to here. For the contribution history and old versions of the redirected article, please see its history; for its talk page, see here.|
|WikiProject Computing||(Rated Start-class, High-importance)|
|WikiProject Computer science||(Rated Start-class, Mid-importance)|
- 1 220.127.116.11 Example?
- 2 assembly and function calls
- 3 Lo-mein code
- 4 NPOV: line numbering
- 5 Another example
- 6 Spaghetti code vs monolithic code
- 7 The Example
- 8 The plate of spaghetti is technically a bowl of spaghetti.
- 9 Source for "Spaghetti with meatballs"
- 10 Example again
- 11 assembly languages have for and while statements?
- 12 Lasagna Code
- 13 Macaroni code
- 14 Is this a joke?
Is what 18.104.22.168 added really spaghetti code? I'd just call it bad code, because there's no noodle like loops of goto-ing and whatnot... --Carl 13:49, 13 Oct 2004 (UTC)
- I agree. It's hardly a good example of spaghetti code. I removed it. --Neg 01:21, 27 Nov 2004 (UTC)
Is there really any need for that picture of a bowl of spaghetti?
- I guess looking at the spaghetti aids in understanding the chaotic nature of spaghetti code. Plus its humourous so why not. JesseHogan 07:56, 15 July 2005 (UTC)
- Those pictures are much in help to understand what spaghetti code is. There could be bowl of Ravioli picture too, coz i don't know what ravioli is, so will have to search for it seperately Kiaurutis (talk) 21:20, 7 February 2011 (UTC)
assembly and function calls
While many assembly languages have a function stack, and apparent function calls, these are just a thin wrapper for the goto statement. They store the original location of the program counter in order to return to it later.
- How is this significantly different from a function call in higher level languages? — The Storm Surfer 20:55, 18 July 2005 (UTC)
- Moreover, spaghetti code is not the sine qua non of programming in assembly language, FORTRAN and early BASICs. With proper early training and mental discipline, anyone can write structured code in any computer language. My college instructor in the early 1970s referred to such programming as "good programming", long before the catch phrases "structured programming" and "object-oriented programming" came into widespread use. --QuicksilverT @ 18:10, 29 November 2005 (UTC)
- The quote above is not accurate. It should mention the "gosub" statement, not a "goto". A gosub implies a return: "go to subroutine". A "goto" means you never come back.
- Actually, the use of subroutine calls (such as the primitive gosub) helps eliminate spaghetti code. --Uncle Ed 01:08, 6 April 2006 (UTC)
PJTraill 15:49, 8 April 2006 (UTC) I have largely rewritten this section in accordance with the above observations.
- PJTraill 15:59, 8 April 2006 (UTC) Has anyone got a source for this? Does anyone know people who use the term? At  it is unclear what it means. It was deleted from Wikipedia: see Wikipedia:Articles_for_deletion/Lo-mein_code.
NPOV: line numbering
I don't believe the 2 code fragments really illustrate spaghetti code in a fair way: it makes it seem as though the older style of BASIC, especially the line numbering, is the problem. The 2 code fragments should ostensibly be be written in the same style. I like seeing the BASIC, lord knows it facilitated more than its share of bad code, but as I no longer have access to an interpreter I don't think I can come up with a fully functional "structured" example. Ewlyahoocom 18:53, 11 February 2006 (UTC)
Just try to figure out how this baby gets the sorting done (it looks like shell sort). It's converted from BASIC to QBASIC. I think it as from a library book I once read when I was little. --Zom-B 00:12, 05 November 2006 (UTC)
SCREEN 0 INPUT "How many numbers to sort? "; 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 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
Spaghetti code vs monolithic code
I'm looking for the proper terminology that describes code that isn't a jumbled mess per se, but is hard to decouple or modularize. Perhaps this goes hand-in-hand with spaghetti code, but for example monolithic kernel doesn't seem to imply sloppy coding practice. Can the article be made to clarify if and how these things are different? Ham Pastrami (talk) 12:18, 3 April 2008 (UTC)
- My aunt has been programming when the term was coined, and according to her the term spaghetti code means exactly that and has no connection to control flow at all. The metaphor makes *much* more sense this way: When you have a lump of spaghetty, pulling at any specific noodle will get you the whole ball. —Preceding unsigned comment added by 22.214.171.124 (talk) 01:17, 3 July 2008 (UTC)
- Bollocks. Spaghetti code means a tangled indecipherable mess. That's what it has always meant. 126.96.36.199 (talk) 14:37, 30 January 2012 (UTC)
The 2 edits by 188.8.131.52 on 11 February 2007 seem to have "fixed" the example of bad code, by putting the commands in a logical order, the same as if it used FOR loops. It is now fairly readable, and its operation obvious, which surely defeats the object of the example, which is meant to show the confusing nature of spaghetti code. I suggest it should be changed back. 184.108.40.206 (talk) 17:56, 22 October 2008 (UTC)
The plate of spaghetti is technically a bowl of spaghetti.
The rims on the dish in the picture raise up, you see. If the dish were a plate, the rims would be on nearly the same level of the base of the dish. But they're not. The dish is very clearly a bowl. Is it possible someone change this? 220.127.116.11 (talk) 20:04, 29 November 2008 (UTC)
- i don't agree. the pasta pictures bring some humour and good analogies to the technicalities of "spaghetti, ravioli and lasagna code". love it! --Phneutral (talk) 11:53, 4 October 2011 (UTC)
Source for "Spaghetti with meatballs"
I think the example of "Spaghetti code" is meek - it's if the example given doesn't quite qualify, since it is just the
goto version of a
for loop. Examples of real spaghetti code should instead provide violation of best practice programming structures, such as jumps into loops, worse, jumps into a block from outside, elaborate 8-loops (instead of a round loop), and
case depending on language) clauses emulated by
goto and abnormal jumps within that select clause. I've programmed in such code once, created by an optimistic non-programmer. Rursus dixit. (mbork3!) 14:14, 11 March 2012 (UTC)
I'm also an expert of programming, that's why I don't need to fear of GOTO. It is not made by the devil. It was invented at the earlier times, following the machine coded structure, where there isn't any other option. Later the new languages began to support the structured programming, but you also can write structured programs with GOTO, without DO and others. Yes. The structured programming means to create your program from small elements. A local loop can be done with GOTO very clearly if you don't have other options.
But for God's sake, the example I found here is WRONG!
10 i = 0 20 i = i + 1 30 PRINT i; " squared = "; i * i 40 IF i >= 10 THEN GOTO 60 50 GOTO 20 60 PRINT "Program Completed." 70 END
10 FOR i = 1 TO 10 20 PRINT i; " squared = "; i * i 30 NEXT i 40 PRINT "Program Completed." 50 END
The two codes are not equivalent! The results of them are equal. Now. Type 0 instead of 10 and go ahead. This is a really awkward fail of teaching structured programming. - Orion 8 (talk) 02:04, 27 August 2012 (UTC)
- I'm not sure what your point here is. It seems like the results are the same. Or is your point that the "spaghetti" example is really not an example of spaghetti at all? I agree with you, it would not have been spaghetti in some year before BASIC had a FOR loop; but today, I think it would qualify as such. Nobody said GOTOs are from the devil, they do have their uses (few and far between as they are). On the contrary, I actually think this is a good simple example of how you can use constructs of a language to make a program more spaghetti-like or less spaghetti-like. You are welcome to add your own example of spaghetti and non-spaghetti code. Fool4jesus (talk) 19:54, 11 September 2012 (UTC)
assembly languages have for and while statements?
Of assembly languages, the article says, "... they are low-level programming languages where equivalents for structured control flow statements such as for loops and while loops exist, but are often poorly understood by inexperienced programmers." Is this true? I thought for and while statements were emulated through conditional branching. --Allen (talk) 21:56, 22 December 2012 (UTC)
It's pretty silly that the article gives an exact year when the tangential phrase 'lasagna code' was coined, while nothing at all is said about the origin of the term covered by the main article, "spaghetti code". Or what am I missing? Toddcs (talk) 21:54, 12 November 2013 (UTC)
- Probably because nobody ever bothered researching it or adding it to Wikipedia. I've added a history section, though I doubt it covers the earliest use, and misses much of the term's use from the 1960s and early 1970s. Mindmatrix 01:07, 13 November 2013 (UTC)
Hi, folks. I just added a new section on "macaroni code," but I'm now having second thoughts because the term does not appear to be in common usage. Google's Ngram viewer indicates that it was far more common in the 1950s: https://books.google.com/ngrams/graph?content=macaroni+code but not what it meant at that time. The only other definition for the term I can find is this one: http://theburningmonk.com/2010/01/buzzword-buster-macaroni-code/ which differs from the one I have provided.
Note, for instance, that the terms "ravioli code" and "lasagna code" are not found in any of the books Google has indexed: https://books.google.com/ngrams/graph?content=ravioli+code%2Clasagna+code — Preceding unsigned comment added by Ben Stallings (talk • contribs) 18:46, 7 January 2014 (UTC)
Is this a joke?
"Ravioli code", "Spaghetti with meatballs"? Really? This is surely an analogy taken far, far too far. Only "Lasagna" and "Macaroni" have citations, but these are weak at best. I propose the entire "Related terms" section is removed, or at very least remove the images of the plates of food, they contribute nothing and add to the satirical feel of the page.