who wants pasta in their computer?
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?
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.
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.
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)
yea we dont talk about python here
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
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
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.
i mean old c
legacy cide is always pasta
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.)
No need for all that.
You’ve just got to see my code.
- PHP
- JavaScript
- Bash
- C
- C++
- Java
Sometimes I call my colleagues Italians 🤌
(None of them are from Italy, but that pasta!)
Hey! My assembler is actually quite neat and compartmentalized.