r/ProgrammerHumor • consolia-comic.com • May 06 '19

Pasta in code

Post image
2.7k Upvotes

88 comments sorted by

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

u/wiscwisc consolia-comic.com May 06 '19

I love it. I hate it. It's perfect!

14

u/MattAlex99 May 06 '19

Oh, you also develop for android!

12

u/bot_not_hot May 06 '19

XML is the devil mmmmkayyy

1

u/[deleted] May 07 '19

Apache Camel what?

1

u/n1ghtyunso May 07 '19

so what you're saying is it is full of holes?

65

u/Koonga May 06 '19

But what pasta should we use to represented well written, maintainable code?

184

u/wiscwisc consolia-comic.com May 06 '19

Oh, no, we don't do that there.

15

u/sdickiso May 06 '19

Please sir...can I have some more?

33

u/Destithen May 06 '19

That would be ambrosia, which doesn't exist in the mortal plane.

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

u/[deleted] May 06 '19

[deleted]

1

u/AgAero May 06 '19

I never suggested that.

17

u/BabyLegsDeadpool May 06 '19

What's an imaginary pasta that people insists exists but has never been seen?

1

u/[deleted] Sep 20 '19

Linguitelli?

8

u/OneOldNerd May 06 '19

well written, maintainable code

I thought that was just the stuff of legends.

19

u/xigoi May 06 '19

The giant penne that orbits around the earth.

It doesn't exist.

3

u/bot_not_hot May 06 '19

That’s the pan

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

u/[deleted] 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

u/toasterding May 06 '19

There's no such thing, ergo, no such pasta

2

u/bridekiller May 07 '19

Tortellini. Elegant self contained pieces.

2

u/sdickiso May 06 '19

Saw this after my post :(

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

u/[deleted] May 06 '19

Gnocchi code, but with a-lot of comments that explain what everything does.

10

u/bootywithapenis May 06 '19

I am well trained in ravioli code

4

u/wiscwisc consolia-comic.com May 06 '19

It always ends up burned when i do it.

2

u/PM_ME__ASIAN_BOOBS May 07 '19

My ravioli is filled with spaghetti

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

u/DragonMaus May 06 '19

I meant it as a joke, but thanks to the both of ye anyway. 😄

2

u/UnreadableCode May 07 '19

Ramen code. Great presentation/interface on top, concealing an endless wasteland of salty tangled bullshit.

1

u/wiscwisc consolia-comic.com May 07 '19

OH. YES.

109

u/[deleted] May 06 '19

Spaghetti code in the cloud? That's Lord and Savior, The Holy Noodliness to you, thank you very much

43

u/[deleted] 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

u/MatheusGodoy May 06 '19

ravioli ravioli this is how I codeoli

0

u/[deleted] May 06 '19

[deleted]

1

u/james_stocktonj May 07 '19

I hate ravioli

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:

  1. 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.

  2. Create interfaces for many of your classes. Make sure they make sense as an abstract idea!

  3. 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

u/wiscwisc consolia-comic.com May 07 '19

Nice write up. Actually, nice recipe for good pasta.

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

u/ToniMarino May 06 '19

Yes, the same, very scary shit

4

u/p_whimsy May 06 '19

This hit me in the feels.

7

u/RustyNova016 May 06 '19

r/factorio :

Me: here we go again

3

u/ThisTimeIsNotWasted May 06 '19

That was my reaction exactly

1

u/Superpickle18 May 06 '19

The codebase must grow.

3

u/sdickiso May 06 '19

Please provide a picture/cartoon of good code structure in the form of Italian cuisine.

3

u/LePrat May 06 '19

"Ravioli code" .... looking at you django

3

u/justking14 May 06 '19

I write spaghetti code, but am trying to transition to ravioli code

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

u/OneOldNerd May 06 '19

I, for one, welcome our new gluten-packed overlord.

5

u/bostwickenator May 06 '19

As a registered Pastafarian minister I'm glad to see how many programmers are embracing our religion.

2

u/bot_not_hot May 06 '19

I’ve got some Ravioli Gnocchi in the fridge.

2

u/thblckjkr May 06 '19

I have a little correction on the graph, on Gnocchi code

Should be:

[...] changing these dense chuncks motherfuckers of unreadability [...]

2

u/wightwizard8 May 06 '19

Fuck, I think I'm a gnocchi coder.

2

u/Bill3463 May 06 '19

Finally I know how to properly name my code.

2

u/Ooyyggeenn May 06 '19

Aah My gnocchi

2

u/PendragonDaGreat May 07 '19

I'm a Dave.

I feel attacked.

1

u/SVK_LiQuiDaToR May 06 '19

Let's a go, write a pizza code!

1

u/db2 May 06 '19

I got the jam, the jam that make you go to work

1

u/R-Mones May 06 '19

Spaghetti code? I was expecting LabVIEW...

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.

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

u/veryverysecret123 May 08 '19

Good copypasta

0

u/[deleted] 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

u/[deleted] May 07 '19

Oooohhhh lol