this post was submitted on 26 Aug 2026
352 points (100.0% liked)

Programmer Humor

32965 readers
1679 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 3 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] partial_accumen@lemmy.world 40 points 5 hours ago* (last edited 5 hours ago) (6 children)

If it helps, I'm from the other side of networking and infra. You could swap the labels and make the meme accurate for me.

In the mid 1980s I learn the BASIC programming command GOTO and fell in love for a lifetime. If you look any anything I used to write in Ruby script or today in Python you'll see my love affair with "if" "elfi" and "else" continues. My universe is nested "if" statements all the way down.

[–] chad@sh.itjust.works 4 points 2 hours ago* (last edited 2 hours ago) (1 children)

Please avoid nested if statements. Instead use early returns when possible.

See video explanation.

[–] chicken@lemmy.dbzer0.com 0 points 45 minutes ago* (last edited 44 minutes ago)

Early returns seems good, but personally I find code more confusing when things get arbitrarily separated out into functions, because to read it you have to keep scrolling back and forth between different parts of the page and either remembering where the other part is or typing a lot with ctrl-f, there's more variables to hold results, and if the section of code to be separated into a function is picked just because of nesting depth reasons then it's likely the function name isn't going to describe what it does very clearly, leading to more scrolling and more having to keep track of things in your head.

[–] libewa@feddit.org 18 points 5 hours ago (1 children)
[–] Ertain@feddit.online 1 points 2 hours ago

I'm sure he's fine, Sans/Susie.

[–] rockSlayer@lemmy.world 9 points 4 hours ago* (last edited 4 hours ago) (1 children)

If you like if statements, you'll love the python case statements for pattern matching

[–] partial_accumen@lemmy.world 19 points 4 hours ago* (last edited 4 hours ago)

Ohhh nice! I could see replacing dozens of nested if statements with dozens of nested case statements!

[–] Zos_Kia@jlai.lu 2 points 3 hours ago

It was fashionable at a time to avoid ifs and other imperative structures, but I tend to like them. Functional is nice and all but I like my code to be smart in the way it works, not in the way it's written. Nested ifs are readable, collapsible, and easy to make sense of at a glance, there's often nothing wrong with using them.

[–] otacon239@lemmy.world 3 points 4 hours ago

Same here! I can put together a half-descent network in just a few hours, but even programming simple stuff on microcontrollers is a major endeavor. And the documentation is usually terrible or nonexistent. And the tutorials are usually barely able to cover basic questions. At least in the space of networking, there’s enough context clues in the UI that I can piece together the solution I need.

[–] db2@lemmy.world 2 points 4 hours ago

My universe is nested "if" statements all the way down

Also known as AI 🤣