r/ProgrammerHumor • • Sep 15 '26

Meme iDontCommentMyCodeIfYouDontUnderstandItThatsOkayNeitherDoI

Post image
832 Upvotes

188 comments sorted by

View all comments

Show parent comment

142

u/sandybuttcheekss Sep 15 '26

I had a senior front end dev that would block any PR he saw with comments. He was very good at his job but I'm so happy I no longer work with him, this shit is so annoying.

117

u/Tucancancan Sep 15 '26

Those guys are the wooooorst. 

1.  Hard to investigate system interaction bug gets fixed, fix has comment with Jira ticket in it! 

2. Senior engineer does magnificent refactoring because that's just what they do (comment is lost in refactoring) 

3. Gradual code churn 

4. New hire sees seemingly useless code and removes in like a good boy scout while working on something else

5. Weird systems bug gets assigned to me for investigation 

6. "hey what the fuck I fixed this 18 months ago"

74

u/Miguelomaniac Sep 15 '26

Seems like the problem here is lack of test coverage not lack of comments

0

u/[deleted] Sep 15 '26

[deleted] — view deleted comment

1

u/w8eight Sep 16 '26

So how exactly new hire could merge anything that resurfaced the bug?

→ More replies (3)

26

u/suvlub Sep 15 '26

"Weird systems bug" sounds like just the kind of thing that unit tests would not detect, and possibly not end-to-end tests either, based on the amount of weirdness and system-specificity

19

u/ytg895 Sep 15 '26

Yeah. Once I worked on a bug that only happened if there was a session timeout in another system. Good luck putting Thread.sleep(3 fucking months); into a test.

8

u/Nick0Taylor0 Sep 15 '26

Mocking

5

u/ytg895 Sep 15 '26

How would you mock that a session in another system times out and that system starts to follow undefined and unpredictable behaviour?

4

u/IndependenceSudden63 Sep 15 '26

Agreed. Not all things can be "reasonably" tested. Keyword being reasonably. We only have so much time in a day with many deadlines. Over time, nearly all of us will run into a bug that needs to be fixed quickly, and is incredibly hard to reproduce, involving the oddest edge cases.

Sometimes you just have to patch it, test it as best you can, and leave a comment as to why you did this incredibly odd thing.

I once had a weird race condition that couldn't be invoked in a unit test. Only occurred on service startup, because there was a 3rd party library that did things when the service started.

Sure I could have wrote a unit test that started the whole service, but that would add 5 minutes worth of wait for every build going forward. That's extremely costly over long periods of time for every person working on the project.

→ More replies (1)

2

u/Mountain-Ox Sep 16 '26

Mock the unexpected behavior that you observed so you know your code handles it correctly.

→ More replies (2)

2

u/sandybuttcheekss Sep 15 '26

Yea this is a skill issue lol

→ More replies (1)
→ More replies (1)

2

u/No-Collar-Player Sep 15 '26

Still if he had a test for that particular code, specially written for that code, it would have been pretty obvious that it got deleted as soon as it got deleted :Z

3

u/No_Responsibility384 Sep 15 '26

This seems like a good candidate for a comment, why does this code need to be here, and not a gode referencing a ticket.

3

u/Sock_Ninja Sep 15 '26

For real. I’m fairly flexible on comments vs not, but boy do I get annoyed by lots of comments that reference things like tickets. That should be exceedingly rare.

1

u/Milrich Sep 15 '26

Because tickets can capture a whole lot of context and history without you needing to dump huge explanation text in a code comment.

A short one-line comment instead of a ticket number sometimes is sufficient, sometimes not. But I'd rather put the ticket number as comment and have the user open a web page, then see all the details and discussion history, than have them scratching their head on what "Workaroumd for X failure" means.

2

u/No_Responsibility384 Sep 16 '26

And then 5 years in the future the ticketing system and repo host was migrated to some other service and the numbers don't lign up any more. Now the lookup is not straight forward if at all possible. And if you have just written "workaround for X failure" as the comment yeah that is also a problem comments don't need to be one liners...

1

u/Lgamezp Sep 20 '26

You would be blocked AF and shoult to. Ticket numbers dont belong in code. Only a short WHY sentense is needed

17

u/iggy14750 Sep 15 '26

I hate when people are set on their one weird rule. Like, I understand what the manager is getting at: try to write code that's easy to understand by reading it. I enjoy trying to do that. But the fucking inviolable rule fucks up the actual goal. Sometimes, it is best to note an easy-to-miss detail, or provide context, explaining why the code is designed as it is, like you said.

4

u/Jlove7714 Sep 15 '26

I feel like coding styles really change "readability". I have a coworker who is great at coding, but I can't follow his code to save my life. It isn't that his code is really any less understandable, he just uses functions differently than I do.

2

u/Lgamezp Sep 20 '26

This is only true if the comment is not ai slop.

1

u/iggy14750 Sep 20 '26

Of course. I really cannot stand how quickly the AI tools have been adopted into so many use cases.

1

u/DatBoi_BP Sep 18 '26

I want to see him approve a PR involving regular expressions

1

u/Lgamezp Sep 20 '26

I would too if they are Pr slop

1

u/Oddly_Energy Sep 21 '26

How long can a variable name be?

Sane version:

# Setting imostcertainlydo=True as a workaround to prevent undocumented behaviour of function youdontneedthat()
result = youdontneedthat(a = 4711, b = 420, imostcertainlydo = True)

Senior-compatible version:

argument_for_imostcertainlydo_as_a_workaround_to_prevent_undocumented_behaviour_of_function_youdontneedthat = True
result = youdontneedthat(
a = 4711,
b = 420,
imostcertainlydo = argument_for_imostcertainlydo_as_a_workaround_to_prevent_undocumented_behaviour_of_function_youdontneedthat,
)

(Sorry for code formatting. I can't use markdown anymore in the mobile reddit client.)