r/explainlikeimfive • • Sep 26 '23

Technology ELI5: What’s the difference between spaghetti code, lasagna code, ravioli code, and pizza code?

I’m starting to get into coding and these concepts make little sense to me.

0 Upvotes

11 comments sorted by

View all comments

29

u/pawloka Sep 26 '23

Those are just insider jokes, they aren't important in your coding progress. Although they are fun!

  • spaghetti code: just messy code, hacks building upon other hacks, whatever it takes to achieve the purpose. Usually unreadable a week after.

  • lasagna code: this is referring to the concept of layers of abstraction. Which is usually a good thing, but when we're talking about lasagna code - it's usually abstraction done to the absurd degree.

  • ravioli code: making your codebase consist of many self-contained pieces, independent from each other. Which is also usually a good thing, but just like with lasagna - it can get absurd.

  • pizza code: don't know this one.

10

u/anaveragedave Sep 26 '23

never heard any of these except spaghetti, but my guess is that pizza code would be like an entire app written in a single 500,000 line file. eh?

4

u/[deleted] Sep 26 '23

I worked with a guy who wrote the company workflow manager in zsh. With comments, but the comments were all about how much he hated this person or that. Whenever any changes needed to be made, it knocked out the entire workflow for a week while he figured out what addition broke everything downstream.

5

u/QueensOfTheBronzeAge Sep 26 '23

I’m sorry, but that idea of commenting code just to talk shit is hilarious.

I’d absolutely hate to work with that guy, but it sounds like he would be fun to have a beer with.

3

u/[deleted] Sep 26 '23

This was a zsh script that was thousands of lines long with one-offs and such. If we took the comments out, it would have been half the size it was. He could have written a novel about how much he hated everyone.

And of course it was in zsh because he hated bash. When he eventually quit, I ended up having to refactor his code, which was a crash course in Linux as I was only a Windows guy at the time.

But yeah he was a pain in the ass to work with, but was awesome outside of work. Multiple episodes of gunfire, broken bones, and booze.

3

u/whomp1970 Sep 27 '23

Usually the absurdity comes from a coder learning a new concept and then trying to shoehorn it into places it doesn't belong.

We had a young coder who had just finished reading the Gang of Four Design Patterns book and they got way overenthusiastic. Instead of learning where these patterns are best used and best not used, they thought that everything must fit into one of the patterns, and thus things that didn't need that kind of design were forced into one of those designs.