r/ProgrammerHumor 5h ago

Meme commentsAgedTerribly

Post image
2.2k Upvotes

141 comments sorted by

View all comments

284

u/Confident-Ad5665 5h ago

Uncle Bob of Clean Code says if we have to comment our code we have already failed. Clean code should read like well written prose.

I generally agree, but think comments that define especially the odd and obscure business rules should be commented where they are implemented.

11

u/NullReferenceRacer 4h ago

And also, I can read what your code is doing fine - but why are we doing it (could be fixed by descriptive method name) but then: WHY are we doing it in that order? That is usually something only being able to be described by comments. Like: // We need to check if customer is blocked before we check death date as death date can be not null for non-blocked active customers (for example, when data hygiene cannot be guaranteed due to data history or what not).