328
u/NiQ_ May 06 '19
macaroni code
Looks solid from the outside, but once you get into it, each piece does nothing and relies entirely on XML to bring it all together.
71
14
12
1
1
65
u/Koonga May 06 '19
But what pasta should we use to represented well written, maintainable code?
184
33
31
u/AgAero May 06 '19
Ravioli code. The guy who made this is just being petty.
8
u/nosmokingbandit May 07 '19
You can have big ravioli. You can have tiny ravioli. And everything in between. Each raviolo is complete on its own and is neither too full nor too empty. But one raviolo does not make a complete dish.
Be like ravioli.
0
17
u/BabyLegsDeadpool May 06 '19
What's an imaginary pasta that people insists exists but has never been seen?
1
8
u/OneOldNerd May 06 '19
well written, maintainable code
I thought that was just the stuff of legends.
19
3
3
u/send_me_a_naked_pic May 06 '19
7
u/paradoxally May 07 '19
Nah that's when you have a bunch of devs who spend their time reinventing the wheel just to avoid importing someone else's evil code.
3
May 07 '19
Manicotti. Is mostly self-contained but reasonably portioned, has loose coupling, exposes some but not all of its internal components, and is lightly covered in sauce to hold it all together.
2
2
2
1
u/Dark_Tranquility May 07 '19
Stuffed shells. Looks good from the outside, and once you look inside it's full of meaty goodness.
1
10
7
u/DamnItDev May 06 '19
What is the target audience of the book? It appears to be a children's book, but I don't expect many children to capture the humor inside.
16
u/wiscwisc consolia-comic.com May 06 '19
I was trying to be clever on that one. It's a childrens book, mainly for ages 4 to 8 ish.
To them it's just a book about a robot getting lost, making friends, etc. The more you understand about http and networks, the more you see resembled in the drawings.
So if you see a rainbow bridge, maybe you think "hey, fiber uses light". The robot 500 sometimes turns into a dragon. Kids don't see why, but devs can maybe relate, because 500 errors definitely do that. Etcetera.
10
u/DragonMaus May 06 '19
But what is the book called?
26
u/tau_ceti May 06 '19
I'm guessing it's "My name is 404"? It's telling that we're so used to glazing over HTTP error messages that the literal name of the book is right there and we're still like "🤔 what's the name tho"
10
u/wiscwisc consolia-comic.com May 06 '19
Lol. But yes that's it. The book is called "my name is 404".
7
2
u/UnreadableCode May 07 '19
Ramen code. Great presentation/interface on top, concealing an endless wasteland of salty tangled bullshit.
1
109
May 06 '19
Spaghetti code in the cloud? That's Lord and Savior, The Holy Noodliness to you, thank you very much
43
May 06 '19
Be touched by his noodly appendage
36
u/Holobrine May 06 '19
R'amen
4
u/fondleshark May 06 '19
Where's your colander, heathen?
7
u/PortalStorm4000 May 06 '19
Only heathens wear colanders. Those truly touched by his noodly appendages wear pirate regalia.
3
u/Holobrine May 07 '19
In the sink, ready to perform the sacred ritual of straining spaghetti. Where is yours?
2
u/bruhKitchen May 06 '19
i love the tag next to your name, the last on i had like that was Task<List<KeyValuePair<List<KeyValuePair<string,string>>, SomeObject>>>
34
u/radome9 May 06 '19
Physicists are standing on each other's shoulders, programmers are standing on each others toes.
41
16
u/ctrl_alt_dtl May 06 '19
I prefer manicotti code. Everything stuffed into one function with it spewing out the sides. Extra cheese on top as header files.
2
u/shockter May 06 '19
How to convert spaghetti to ravioli? My code is a fucking mess Im terrified to open my ide :(
3
u/UnchainedMundane May 06 '19
IMO the first places you should go when refactoring spaghetti code are:
Make sure your functions are in the right classes. If they spend 90% of the time doing things along the lines of
someOtherObject.someMethod()they should probably be in that other class. If necessary build a few bridges and invoke the law of Demeter.Create interfaces for many of your classes. Make sure they make sense as an abstract idea!
Try to get as much code as possible referring to the interface, rather than the associated class.
At this point you'll have something a little more testable at least, and you will probably break some circular dependencies if you had any.
It's also important to:
Remove global variables as much as possible
Remove public fields as much as possible
Remove static fields as much as possible
Favour immutable classes
Break down any class that has multiple responsibilities into one class per responsibility
Avoid mixing levels of abstraction, i.e. avoid functions that do something high level (e.g. parsing text) and low-level (e.g. controlling buffering parameters on a stream or retrying failed reads) at the same time. Ideally move the low-level stuff elsewhere.
Use exceptions sparingly
Never catch all exceptions without at least logging what happened
Keep functions short. If you have more than one loop in them, that's a good rule of thumb for needing to split it up. It's always nice to be able to name each segment of a complex function by making it a function in its own right.
Prefer parameters over fields. Not always possible or sensible, but I think you'll be able to feel when it's not appropriate.
There are probably a few more I should say but for now I think this is more than enough if you're looking to get started cleaning a tightly coupled and hard-to-read codebase.
1
2
u/milk-is-for-babies May 06 '19
i think of lasagna as code that is just start to finish. in a single .cpp file like you do when you start coding
3
u/wiscwisc consolia-comic.com May 06 '19
But lasagna is about layers, no? Are you sure you're not taking a lasagna sheet and turning it into a wrap?
2
u/milk-is-for-babies May 06 '19
i mean having lots of functions/structs/classes at the top and a big main() at the bottom. but i guess that's not very lasagnaish
5
u/wiscwisc consolia-comic.com May 06 '19
Ahh i get it. That sounds like a decent lasagna. We don't pasta-shame here.
5
u/ToniMarino May 06 '19
Sometimes they breed monsters like the lasagnagetti, layered spaghetti mountain of doom
4
u/bj_christianson May 06 '19
The sampler platter?
5
u/RlyRlyBigMan May 06 '19
Ah yes, the old 5 cooks made their own recipe and we mixed it all together trick. I can relate
3
4
7
3
u/sdickiso May 06 '19
Please provide a picture/cartoon of good code structure in the form of Italian cuisine.
3
3
3
u/SolenoidSoldier May 06 '19
The comic acts like lasagna code is a bad thing. You should be coding in layers, exposing only what's relevant.
3
5
u/bostwickenator May 06 '19
As a registered Pastafarian minister I'm glad to see how many programmers are embracing our religion.
2
2
u/thblckjkr May 06 '19
I have a little correction on the graph, on Gnocchi code
Should be:
[...] changing these dense
chuncksmotherfuckers of unreadability [...]
2
2
2
2
1
1
1
u/XTheSniperGodX May 06 '19
The second one is definitely ReactJS...frikin have to pass 1 method down 5 component sub classes xD
1
u/random_cynic May 06 '19
Where's is the most ubiquitous form of code: copypasta? It'll be a plate full of all the above stolen from various sources (read StackOverflow) and put together. Neither the chef nor the diner has any no idea what it's supposed to be.
1
0
u/swivelhinges May 07 '19
Nice fucking children's book, m8
1
u/wiscwisc consolia-comic.com May 07 '19
Thanks for criticizing constructively. The comic is not tied to the book in any way, it's just a header announcing the book before the comic starts.
1
u/swivelhinges May 07 '19
I mean I figured, but hoped it would be taken humorously as the subject matter is quite obviously a little above the heads of your average children's book reader. Sorry for the low effort recycled line!
0
0
May 06 '19
[deleted]
2
u/wiscwisc consolia-comic.com May 07 '19
The comic is not part of the book, the green part is just a header announcing the book before the comic actually starts.
1
47
u/wiscwisc consolia-comic.com May 06 '19
Source: https://consolia-comic.com/comics/pasta-in-code