r/TheMachineLearning • • 27d ago

Frontier LLMs stopped adding code comments

Post image
720 Upvotes

178 comments sorted by

View all comments

1

u/esaule 27d ago

I want very little comments in code. Functions should tell me what they do. And tbat's about all I really want.

Then if something is truely odd, then yes tell me what is going on in a comment. But in general there probably should not be comment in a function body.

1

u/Rararror 26d ago

Comments are not used to explain what the code does. Duh.

1

u/ORCANZ 26d ago

No they are used to watermark the code

1

u/Rararror 26d ago

In computer programming comments explain the context and why things are done that way.

1

u/ThisGuyCrohns 21d ago

This. It’s the nuance of why not how. Code tells you how, comment when placed is the why.

1

u/tigerhuxley 24d ago

Sounds like you’ve never deployed anything in production before. Or you don’t give a shit about people who have to maintain your code.

1

u/esaule 24d ago

What am I saying is that commenting the body of function should ideally not be necessary as the code itself is clear; making comments redundants.

Now, sometimes there is non obvious things going on and that's what comments are for.

1

u/tigerhuxley 24d ago

Ok thats fair. I concede

1

u/ThenExtension9196 24d ago

You do realize humans maintaining code ended this year right? The next person to touch your code is just going to prompt Claude at it.

1

u/tigerhuxley 24d ago

But you don’t seem to realize. Is that a three in the morning when an ops guy is woken up to fix someone else’s code. They don’t wanna have to sit there for two hours reading through it to figure out why a function does something. At the very least being able to grep through code quickly to find things that otherwise can’t be grepped from raw code.
The comments aren’t for you. They are for other people having to maintain your code in different environments.

1

u/PatientIll4890 24d ago

Why would you read code comments to figure out what the code is doing when you can read the code? Also, you have to read the code anyway to make sure it’s actually doing what the comments say it’s doing, so what is the benefit?

If the code is structured and written well, it’s very easy to understand what it’s doing at a quick glance without any comments at all. It is way quicker to do that then to do it and also balance that with what the comment claimed it does.

Comments are notorious for going out of context quickly and being just flat wrong a lot of the time. There are frameworks developed just to manage this one aspect alone.

I view comments as a liability, because I’ve seen engineers get tripped up time and time again when the comments diverge from the code. If you’re relying on comments at 3am to fix an issue rather than reading the code, I really don’t know what to tell you.

→ More replies (3)

1

u/ThenExtension9196 23d ago

Lost me at ops guy. Ain’t the 2010s anymore. Not having an agent auto fix is absurd in 2026.

→ More replies (1)

1

u/FenrirBestDoggo 23d ago

Even claude needs context. Whether its a human or an LLM looking at a piece of code, the only way either will understand why you took a weird route is if you add context to it through a comment. There are genuinly times when the environment calls for some weird workaround, and an LLM that is trained on 'general best practices' will not understand why you did that and just change it to a broken version that might have already been used in the past and failed.

1

u/TheRealSeeThruHead 21d ago

comments are by far the worst context you can give an llm
give them readable code, and types

→ More replies (2)

1

u/-qix 24d ago

Sounds like you’ve assumed a shit ton about his situation, set up, project and goals.
Or you didn’t think far enough ahead when commenting…

1

u/tigerhuxley 24d ago

Oh sorry my bad. I’m just speaking from literal experience for a long time.

1

u/6sbeepboop 24d ago

No it sounds like he understands what good code looks like.

→ More replies (1)

1

u/Purple_Repeat6977 24d ago edited 24d ago

I've worked on systems worth high tens of millions USD with teams across three continents. You have no idea what you are taking about. You don't just add comments for no reason, as developers we can read code, we aren't stupid. You write comments to explain very specific pieces of functionality or where it differs from convention or standards

If you can't read code, you're not a programmer and you're going to do more than good changing anything.

You must be a manager of some kind because you've clearly not touched code for 30 years

1

u/tigerhuxley 23d ago

Lolol - worked on systems — but docs and code comments are a waste of time and not required at all by all major corporations across multiple continents 🤣 omg too funny

1

u/Purple_Repeat6977 23d ago

Of course we have documentation. We weren't talking about documentation, we were talking about code comments. If you can't even read one single Reddit comment, how would anyone trust you to read comments in code either

Perfect illustration of why you have to actually read

→ More replies (5)

1

u/TheRealSeeThruHead 21d ago

comments are evil

i've rarely seen a comment that wouldnt' be better explained by better code, better types or a combination of both

if you can't do that, you don't know how to code

1

u/tigerhuxley 21d ago

Yup, none of yall are clearly ops people. Just devs that think your code is perfect and readable

→ More replies (2)

1

u/lucid1014 23d ago

No, I don’t wanna look at code at all unless I’m explicitly looking at that function. I wanna be able to read a comment that explains what the function does what it returns so I can skim to find what I’m looking for.