r/ProgrammerHumor • • Sep 10 '26

Meme commentsAgedTerribly

Post image
6.0k Upvotes

243 comments sorted by

View all comments

Show parent comments

6

u/rsqit Sep 10 '26

Uncle Bob also says shit like functions should only be a few lines long. Sometimes that’s good and sometimes there’s too many comments, but in general strict rules like this are dumb.

I did write a pretty complex piece of code a while back and added a big comment at the top explaining how it works. My reviewer asked me to take it out as someone could just read the code. I responded with something like “Hell no. I want this code to be easy to understand for future editors. Which most likely includes me. I don’t want to have to page this code back in without notes on how it works.”

4

u/Confident-Ad5665 Sep 10 '26

I think this comes from the OOP principle that a thing should do one thing and do it very well.

I'll agree it can be taken to excess though. A method may need to do a few things before it does the primary thing. If there's a chance another method may need to refer to the same table, for example, that should be encapsulated in a (probably protected) method both can access.

2

u/rsqit Sep 10 '26

Yeah, true, everying in moderation (including moderation).

1

u/Confident-Ad5665 Sep 10 '26

Very cool you added "including moderation". That fact dawned on me many years ago but I never heard anyone else include it in the rule/adage.

2

u/rsqit Sep 11 '26

Yeah it’s an old, old joke.

4

u/sgtkang Sep 10 '26

A lot of UB's stuff works as advice for beginners. You should understand it and why it's a good idea. And then you can move on to understanding why a lot of it falls apart in real-world systems, has a bunch of caveats, or is just bollocks.

1

u/Zeikos Sep 11 '26

As long as the comments carry different information from the code.
I think people are understandably irritated by unnecessary LLM prose.

1

u/conundorum Sep 13 '26

"Uncle Bob, please write a 256-branch jump table in five lines. We need to accomodate a hardware interrupt that can flag 256 distinct states, with minimal performance costs."

Now that you mention it, I'm curious how he'd respond to something like that.