Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Spaghetti code...

by neversaint (Deacon)
on Oct 09, 2005 at 07:03 UTC ( #498523=note: print w/ replies, xml ) Need Help??

in reply to Spaghetti code...

Dear Masters,

Pardon me for my lack of knowledge. Honestly, I don't get it.
What's the meaning of "Spaghetti Code"?

neversaint and everlastingly indebted.......

Comment on Re: Spaghetti code...
Replies are listed 'Best First'.
Re^2: Spaghetti code...
by sk (Curate) on Oct 09, 2005 at 07:13 UTC
    Wiki will tell you

    Spaghetti code is a pejorative term for source code which has a complex and tangled control structure, especially one using many GOTOs, exceptions, threads, or other "unstructured" branching constructs.

    More here...Spaghetti_code

      You can also turn code into spaghetti without any unstructured branching constructs, just by judiciously using horrible coding practices in general. I submit to you a snippet from a perl script I wrote some years ago, which is just downright embarassing these days. Note especially the embedded SQL and HTML (with embedded javascript to boot) in the middle of my perl mere lines apart, the obscure variable names, the direct use of array members and references to them, the sloppy formatting, the ultra-long lines, and the painful use of the ternary ? : operator:

      $ref=$dbh->selectall_arrayref("SELECT,transc.state, +art_date,transc.phys_name,transc.mt_name,org.orgname FROM transc JOIN + org ON (transc.org_id = WHERE ( transc.state = 4 AND transc. +qa_name='$userinfo{name}' ) OR ( transc.state = 2 AND transc.mt_name= +'$userinfo{name}' ) ORDER BY"); foreach my $x (@{$ref}) { my $compdis = (filesexist($$x[0],"t") ? "" : qq{disabled="disabled"} +); $$x[2]=~s/...$//; $selfjobs .= qq{<tr><td>$$x[0]</td><td>$whichtype{$$x[1]}</td><td>$$ +x[2]</td><td>$$x[5]</td><td>$$x[3]</td><td>$$x[4]</td><td><input type +="button" value="Files..." onclick='window.location.replace("?fa=$$x[ +0]")' /><input type="submit" value="Complete" onclick='setja($$x[0]," +complete")' $compdis /></td></tr>\n}; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://498523]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2015-11-30 13:37 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (771 votes), past polls