this post was submitted on 13 Feb 2025
520 points (98.9% liked)

Programmer Humor

21371 readers
600 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 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] brokenlcd@feddit.it 74 points 3 weeks ago (12 children)

Tbf, i always comment my code to do a sanity check of what i am doing along the way( think rubber duck method with comments). The problem is that my writing is so cryptic i am the only one that could ever understand it.

[–] spooky2092@lemmy.blahaj.zone 27 points 3 weeks ago (5 children)

I have to comment my code because otherwise I have no idea wth I was writing 6mo ago.

Like, I recently had to update a script I wrote 2 years ago and had thought 'this is self explanatory, I don't need to comment it's only to have me come back and have to walk the code to figure out I forgot to include an edge case that hadn't occurred yet ..

[–] Omgpwnies@lemmy.world 11 points 3 weeks ago (3 children)

Break it up into functions with names that describe what it does, then the script becomes basically a sequence of function calls and is easier to read and troubleshoot.

[–] Earflap@reddthat.com 6 points 3 weeks ago

This is how I started writing my scripts and it is sublime. Even better is when your function can be a single return statement, makes writing tests easy.

load more comments (2 replies)
load more comments (3 replies)
load more comments (9 replies)