this post was submitted on 20 May 2025
204 points (94.3% liked)

Programmer Humor

23402 readers
2924 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

who wants pasta in their computer?

top 28 comments
sorted by: hot top controversial new old
[–] [email protected] 8 points 2 days ago (4 children)

After reading a lot of comments in this thread, I'm not sure I know what spaghetti code is. I thought spaghetti code was when the order of execution was obfuscated due to excessive jumps and GOTOs. But a lot of people are citing languages without those as examples of spaghetti code. Is this just a classic "I don't like this programming language, and I don't know much about it." Or is there something I'm missing?

[–] [email protected] 5 points 1 day ago

It’s more incredibly tangled and highly coupled code. It’s the kinda code where you can’t change anything because it causes a catastrophic cascade of issues. Basically where software engineers throw design out the window and just starting coding random bullshit that “works”

[–] [email protected] 8 points 2 days ago* (last edited 2 days ago)

Spaghetti is all messy and tangled up; spaghetti code is the same.

when the order of execution was obfuscated due to excessive jumps and GOTOs

That's one way to make your code messy and thus achieve spaghetti code.

In general, when some code is very poorly written, it becomes spaghetti code.

[–] [email protected] 4 points 1 day ago

I work in a company that has a old codebse in c with tons of realtime intime stuff that is acessed via a shared memory from the realtime to the non realtime system. Tons of strucs get copied around then typecast to other structs and global variables all over the place. You never know where a variable is written to and where it is also acessed from or if it is just a copy. No assembly but still super obscure.

[–] [email protected] 0 points 2 days ago

tbh nor am i, this is becoming vim vs emacs 2.0 isnt it

[–] [email protected] 32 points 2 days ago* (last edited 2 days ago) (1 children)

ps: you know something you wrote is funny when taken out of context when someone screenshots it and after a while youre sent the screenshot of your message

[–] [email protected] 24 points 2 days ago (1 children)

Back in the day I made a meme and put it on r/prequelmemes, and then my brother came through to my room a few hours later to show me this meme his friend had sent him... while I still had it open in gimp

[–] [email protected] 11 points 2 days ago* (last edited 2 days ago) (2 children)

Assembler, BASIC, Old C code, Cobol...

...Pascal, Fortran, Prolog, Lisp, Modern C code, PHP, Java, Python, C++, Lua, JavaScript, C#, Rust...

The list is infinite.

Show me a language in which it is impossible to write spaghetti code, and I'll show you someone who can't recognize spaghetti code when it's written in one of their favourite languages.

[–] [email protected] 8 points 2 days ago (1 children)

The obvious solution is to use Rust's upcoming "spaghetti checker" feature. Once the compiler decides that your code is too messy to be maintainable, it refuses to compile.

[–] [email protected] 2 points 1 day ago

great, now the compiler wont let me modify my programs (i really should get better at coding because i seem to only know to do spaghetti)

[–] [email protected] 2 points 2 days ago

thats exactly what the "you get the idea" line meant, i was only giving some examples because if i did itd be literally every language

(also modern c is spaghetti, but old c is even more. legacy code is spaghetti no matter the language)

[–] [email protected] 7 points 2 days ago (2 children)

Is an assembler not a compiler for an assembly language?

Is saying "I wrote code in assembler" not functionally equivalent to saying "I wrote code in GCC?"

Note: this is a genuine question, not sarcasm.

[–] [email protected] 4 points 1 day ago

Anywhere I’ve actually seen it used , assembler and assembly were pretty much interchangeable. Assembly code is probably technically correct, but you could be writing code for the assembler so nobody will actually be confused. Per your example, you might say “I wrote code in MASM,” to reference a specific assembler. Again nobody that’s actually worked with any of this would bat an eye at the usage.

[–] [email protected] 7 points 2 days ago

well, in my country (spain) assembler and assembly are basically used interchangeably, so i do that a lot. will take into account for future posts tho.

[–] [email protected] 3 points 1 day ago

Now make gnocchi.

[–] [email protected] 10 points 2 days ago (1 children)

For writing loops, many early BASICs had FOR/NEXT, GOTO [line] and GOSUB [line] and literally nothing else due to space constraints. This begat much spaghetti. Better BASICs had (and have) better things like WHILE and WEND, named subroutines (what a concept!) and egads, no line numbers, which did away with much of that. Unless you were trying to convert a program written for one of the hamstrung dialects anyway, then all bets are off.

Assembly style often reflects the other languages people have learned first, or else it's written to fit space constraints and then spaghettification can actually help with that. (Imagine how the creators of those BASICs crammed their dialect into an 8 or 16K ROM. And thus, like begetteth like.)

C code style follows similarly. It is barely concealed assembly anyway.

COBOL requires a certain kind of masochist to read and write. That's not spaghetti, it's Cthulhu's tentacles. Run.

[–] [email protected] 0 points 2 days ago (1 children)

i mean old c

legacy cide is always pasta

[–] [email protected] 2 points 2 days ago (1 children)

A lot of the original C coders are still alive or only very recently gone (retired, or the ultimate retirement, so to speak), and they carried their cramped coding style with them from those ancient and very cramped systems. Old habits die hard. And then there's a whole generation who were self-taught or learned from the original coders and there's a lot of bad habits, twisted thinking and carry-over there too.

(You should see some of my code. On second thought, it's probably best you don't.)

[–] [email protected] 1 points 2 days ago* (last edited 2 days ago)

You should see some of my code. On second thought, it’s probably best you don’t.

thats the same warning i give to anyone looking at ~/scripts. particularly ~/scripts/bas, ~/scripts/js and ~/scripts/bat_bkp (which is copy of /mnt/msdos/jp/batch)

all code in those folders is like that

[–] [email protected] 2 points 1 day ago

Real spaghetti code is housed in Crowd Control Productions headquarters. They're still patching legacy code from ç 2002-2003

[–] [email protected] 6 points 2 days ago (1 children)

Calling assembler code spaghetti isn't really that fair. I mean granted, everything ends up as "syscall" this and that, but it's still more like one long spaghetti noodle with some meatballs and sauce.

Old C code, written for like microelectronics suffers from it, sure.

But for that gud spaghetti you gotta getti the BASIC and Cobol programs. Thems is good spaghetti.

(And we're going to ignore python right)

[–] [email protected] 0 points 2 days ago

yea we dont talk about python here

[–] [email protected] 4 points 2 days ago

No need for all that.

You've just got to see my code.

[–] [email protected] 4 points 2 days ago (1 children)

Sometimes I call my colleagues Italians 🤌

(None of them are from Italy, but that pasta!)

[–] [email protected] 1 points 1 day ago

then i must be the pastafari /j

[–] [email protected] 4 points 2 days ago

Hey! My assembler is actually quite neat and compartmentalized.

[–] [email protected] 2 points 2 days ago
  1. PHP
  2. JavaScript
  3. Bash
  4. C
  5. C++
  6. Java