Jump to content

Talk:Spaghetti code: Difference between revisions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
Line 76: Line 76:


The 2 edits by 81.226.168.117 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. [[Special:Contributions/131.111.197.43|131.111.197.43]] ([[User talk:131.111.197.43|talk]]) 17:56, 22 October 2008 (UTC)
The 2 edits by 81.226.168.117 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. [[Special:Contributions/131.111.197.43|131.111.197.43]] ([[User talk:131.111.197.43|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? [[Special:Contributions/71.238.211.166|71.238.211.166]] ([[User talk:71.238.211.166|talk]]) 20:04, 29 November 2008 (UTC)

Revision as of 20:04, 29 November 2008

Template:FOLDOC talk

Is what 199.29.247.140 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)[reply]

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)[reply]
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)[reply]
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)[reply]

PJTraill 15:49, 8 April 2006 (UTC) I have largely rewritten this section in accordance with the above observations.[reply]

Lo-mein code

A variation of spaghetti code with unreadable and/or outdated and misleading comments. Often includes numerous macros that call other macros that modify global variables.

PJTraill 15:59, 8 April 2006 (UTC) Has anyone got a source for this? Does anyone know people who use the term? At [1] it is unclear what it means. It was deleted from Wikipedia: see Wikipedia:Articles_for_deletion/Lo-mein_code.[reply]

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)[reply]

Another example

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)[reply]

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)[reply]

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 84.187.101.243 (talk) 01:17, 3 July 2008 (UTC)[reply]

The Example

The 2 edits by 81.226.168.117 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. 131.111.197.43 (talk) 17:56, 22 October 2008 (UTC)[reply]

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? 71.238.211.166 (talk) 20:04, 29 November 2008 (UTC)[reply]