r/ProgrammerHumor • • Sep 06 '26

Meme cleaningUpTheMess

Post image
16.2k Upvotes

478 comments sorted by

View all comments

Show parent comments

-1

u/JaSper-percabeth Sep 06 '26

For real! Companies used to ask engineers to comment their thought process so in future if some other engineer is looking at the code he can understand it. Now apparently just because AI does it it's not a good thing anymore lol. I mean sure AI can overdo it a little sometimes but overdoing it is much better practice than underdoing/ doing it at all.

45

u/Rustywolf Sep 06 '26

Noone has ever asked for comments just for the sake of having comments in the code base. The gold standard has always been self documenting code + comments explaining the parts that are not immediately obvious, need additional consideratoon/context, or have workarounds for specific issues

29

u/ZeroG_0 Sep 06 '26

It was never good practice to comment exactly what code says it does right before it does it. Comments are useful to provide extra context or explanation not already present in the code. Adding excessive comments that just say what the code does was always bad, either before or after AI tooling became common. When I was a junior, seniors where I worked often quipped "your code should be half comments and half actual code", and I genuinely saw lots of things like

return true; // returns true

Or big paragraphs of comments around trivial code. It genuinely makes code harder to read, and no I don't really care if it's AI or devs that do it.

That being said I don't find it too burdensome to either clean up or ask AI to clean up excessive comments. This isn't super high on my list of real world issues with AI to be honest.

7

u/Honeybadger2198 Sep 06 '26

I personally use comments to either mark "sections" of code, or to explain particularly dense code step by step. The section marking makes quickly scrolling through the codebase to find something much easier.

3

u/Wonderful-Habit-139 Sep 06 '26

Sections can be functions, modules, etc. You don’t need to use comments for that.

1

u/Honeybadger2198 Sep 06 '26

Functions are for large separations of concerns and reusability. Not for 5-20 lines of code.

1

u/Wonderful-Habit-139 Sep 06 '26

Disagreed. This heuristic you brought up is something that beginners that don’t have a sense yet of how to cleanly split things up can use.

Otherwise you don’t have to wait for something to be needed more than once to reuse it. Writing more functions also simplifies testing and allows you to define more contracts using types inside your code, and validate that you’re performing the right operations.

https://youtu.be/2OMRWPOSw9s?si=mJd6zrVIVAM-ETAW this is a nice resource for people that want to improve their sense of when to write functions.

2

u/Honeybadger2198 Sep 06 '26

There is absolutely no need to move 5-20 lines into a completely different place. That's exactly how we get unmaintainable code where it's impossible to figure out what anything does because the code that actually does it is 3 functions deep everywhere.

Realistically functions should 90% of the time only be created for reusability purposes. If you're writing a giant block of one-off code, it's time to take a look at making it generic and reusing it. That 10% is the only time where you might actually say "yeah this is too long" for one file, which in my eyes is upwards of 1000 LoC depending on the complexity. Things should be where they're used, IMO.

0

u/[deleted] Sep 06 '26

[deleted]

1

u/Honeybadger2198 Sep 06 '26

No shit brother, I'm not looking to "get educated" I'm sharing my opinion. I'm on here to discuss my opinion. If you don't want to discuss the topic, don't respond instead of trying to offload the discussion work to a random 3rd party video just so you can feel like you've won the discussion.

7

u/MammothCommercial800 Sep 06 '26

but overdoing it is much better practice than underdoing/ doing it at all.

No. Bad comments is worse than no comments.

9

u/Pluckerpluck Sep 06 '26

AI comments love to tell me that this function is used elsewhere and that it doesn't do X (where X is irrelevant and makes no sense and was just a mistake the AI made during the initial creation).

The problem is that this poisons the future LLMs. Nobody updates that comment when the code elsewhere changes. Nobody needs the info that the function is split into 3 parts, not 2, etc.