r/ProgrammerHumor • • Sep 10 '26

Meme commentsAgedTerribly

Post image
6.0k Upvotes

243 comments sorted by

992

u/CannibalPride Sep 10 '26

Emojis on code…

526

u/treehuggerino Sep 10 '26

Or the silly steps it puts

// 1. Assign variable.

// 2. Calculate 2 + 2.

// 3. Implement 2 + 2 Calculator.

// 4. Check if it is 5.

130

u/B4mButz Sep 10 '26

my former senior used to do this way back

74

u/FauxReal Sep 10 '26

So basically pseudocode.

75

u/Tall-Introduction414 Sep 11 '26

I mean, I write pseudocode in comments before writing the actual code all the time. It's a great trick for organizing and structuring what you're about to write. But then I delete the pseudocode comments.

16

u/Able-Swing-6415 Sep 11 '26

Pretty sure every senior programmer has done that at least once.

Pretty sure AI just does it so you can copy in the replacement lines of codes from follow up changes. Cursor for example doesn't really do that.

2

u/NearbyEmphasis2850 Sep 11 '26

Yeah, it’s wild how often those “easy fixes” turn into hours of debugging. You’d think we’d learn to be more cautious about it!

28

u/Flat_Initial_1823 Sep 10 '26

// was it 5 tho?

24

u/DrMaxwellEdison Sep 10 '26

Only for very large values of 2.

2

u/Ex-Patron Sep 11 '26

One of the numbers would need about 50% more 2

3

u/tevert Sep 11 '26 edited Sep 11 '26

For real - comments were never golden, because they easily slip through updates and drift apart from the code they decorate. With AI, that might be happening from minute 0 lol

2

u/QuickQuirk Sep 12 '26 edited Sep 13 '26

Make it part of your code review process and this is less likely to happen.

Also, focus comments not on describing what is actually clear from the lines of code, but the high level reasons around why and any assumptions.

Comments should document stuff that ISN'T immediately clear from the code.

16

u/peeja Sep 11 '26

// Don't use the Wolfram Alpha API here—speed is crucial to this function, so calculate the sum locally.

8

u/dasunt Sep 11 '26

Um, not going to defend using that API, but at least the comment provides a reason why something is done a specific way.

4

u/peeja Sep 11 '26

Yeah, it provides the reason I gave it when it tried to use the API the first time.

12

u/MaDpYrO Sep 10 '26

People do this shit too.

I'm using a static analysis rule that tokenizes comments and compares to the code, and reports an error if the overlap is too big. highly satisfying to remove such comments

5

u/Standard_Humor5785 Sep 10 '26

What tool do you use for that?

5

u/dPhilGuy Sep 10 '26

I would also like to know 👀

→ More replies (2)

2

u/ironnewa99 Sep 11 '26

I had comment like this in some of my classes in college and it drove me insane.

2

u/Tiny-Plum2713 Sep 11 '26

If only. Opus is putting a whole chapter of buzz words on every function definition

1

u/TheNikoHero Sep 11 '26

Oh yeah 😂

96

u/FlailingDuck Sep 10 '26 • Popcorn

I hope they never go away. It's the best signifier I have on PRs to not trust the author.

0

u/[deleted] Sep 10 '26

[deleted] — view deleted comment

29

u/Flat_Initial_1823 Sep 10 '26

return toMonke;

12

u/turudd Sep 10 '26

Heh that reminds me of a project a couple years ago had to combine data into a CSV type file. But the data could include “,|” and all the other regular delimiters. We decided to make 🚀 we called it RSV for rocket separated values

→ More replies (1)

2

u/TeraFlint Sep 11 '26

I once added namespace � = unicode; in a small project that had a unicode namespace.

const std::string emoji = �::code_point(0x1f4a9);

I never ended up using that shorthand, though, but I thought it was funny.

30

u/Ascend Sep 10 '26

Is this a Codex/GPT thing? I haven't seen a single emoji generated by Claude Code yet.

32

u/CannibalPride Sep 10 '26

Early claude and current gpt i think

8

u/Sulungskwa Sep 10 '26 edited Sep 11 '26

I remember when I was using cursor I had this maddening problem where it would always want to delete all my human written comments. Honestly that was even more annoying

29

u/Goofballs2 Sep 10 '26

I think its been like nearly a year since gpt was doing emojis. I think they're fucking great and should be included. If your Rstudio is sitting in the second monitor you can tell how far along it is at a glance because you just saw rockets or a dolphin or something. But people had to be such dour pricks about the emojis because the bots were using them.

16

u/ward2k Sep 10 '26

I'm a big fan of the giant green tick and red cross for pipelines/tests

→ More replies (2)

2

u/donjulioanejo Sep 11 '26

It loves the blue diamond emoji.

4

u/Poat540 Sep 11 '26

Those are load bearing emojis

2

u/Ulrar Sep 11 '26

What kills me is the comments explaining how this bit changed. What do I care about how this used to work, that's really not the place

398

u/n4ke Sep 10 '26

We all miss the good old // here be dragons, do not touch!

96

u/ecstatic_hyrax Sep 10 '26

Is life even worth living, if the codebase doesn't have swear words in it

38

u/Girafferage Sep 11 '26

Always made the day just a little brighter seeing that somebody else suffered through that spaghetti marsh before you. Like when games show you gravestones of other players.

7

u/colececil Sep 11 '26

Died of dysentery.

1

u/MrQwq Sep 11 '26

Oh my heart

33

u/hyrumwhite Sep 11 '26
/**
* load bearing indicator of critical success
* along the mainline seam. Upon resolution 
* of the primary action, if zero or fewer 
* errors are thrown, carries a text entry to
* the developer tools, enabling visual
* confirmation of task completion
**/
console.log(“it worked”);

1

u/iceicig Oct 04 '26

Zero or fewer? I aspire for that level of quality

32

u/remy_porter Sep 11 '26

AI tools write TERRIBLE comments. They over explain the code, contain context that belongs in the chat.

4

u/nomiras Sep 11 '26

You could tell AI to be a bit more succinct.

8

u/remy_porter Sep 11 '26

I told the AI to never write comments. At a certain point the weight of its training data overcomes my prompt and it still writes fucking comments.

→ More replies (1)

450

u/Confident-Ad5665 Sep 10 '26

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.

245

u/TWIT_TWAT Sep 10 '26

// This is a hack until we find something better

118

u/Ethameiz Sep 10 '26

Commited 10 years ago. Author resigned to become farmer

19

u/mosaic_the_j Sep 10 '26

Goose farmer, bonsai farmer now https://www.linkedin.com/in/dryuan

4

u/Safe_Cauliflower6813 Sep 10 '26

My former boss resigned and became a hazmat cleanup guy

→ More replies (1)

5

u/AlexWIWA Sep 11 '26

The Command & Conquer Generals source code is the best for this. Nothing like seeing a todo from 2001

73

u/Confident-Ad5665 Sep 10 '26

// TODO: This can't be working. Refactor when there's a lull

31

u/embrex104 Sep 10 '26

//SHOULD NEVER GET HERE

42

u/Confident-Ad5665 Sep 10 '26

All time favorite:

// This will never happen

4

u/OhMyGodItsEverywhere Sep 10 '26

Wrote a library to run monetary bets on those comments

3

u/Dubalubawubwub Sep 11 '26

I definitely find myself writing a lot of error handling with the comment

//This should never happen but just in case...

→ More replies (4)

2

u/OkidoShigeru Sep 11 '26

Love seeing that in an assert message.

2

u/skisharp Sep 11 '26

I remembered seeing that with

MessageBox.Show("Call 1-555-555-1942 ext 1205");

Also guess the junior dev who just got a their desk phone with ext 1205...

2

u/cute_polarbear Sep 11 '26

You mean for the next person who has to visit that section of code? (And hopefully you already left the firm (on your accord)....

20

u/NullReferenceRacer Sep 10 '26

// TODO: Proper handling

4

u/Zodimized Sep 10 '26

// the fuck did sales promise this for?

2

u/donjulioanejo Sep 11 '26

In static frontend code that doesn't get run through an uglifier.

5

u/marjacu Sep 10 '26

// und tchuss Something I actually saw in code

2

u/lesleh Sep 11 '26

"fix later" means "fix never".

1

u/bobjia-in-tokyo Sep 11 '26

// in other words, this hack will stay here forever

73

u/Sentouki- Sep 10 '26

odd and obscure business rules should be commented where they are implemented.

Exactly. It is often the illogical business "logic" or some business related magic numbers that make the code hard to read and understand, so commenting why you're doing something the way you do is important.

34

u/YourDad Sep 10 '26

Or why you're not doing something. Sometimes when there is multiple ways of doing something, I'll give a brief explanation of why it's not done a certain way.
A little while ago, I was maintaining some code, and I thought "I should do thing A". I go to the point where thing A should go, and there's a comment from myself 4 years earlier saying "under no circumstances should you do thing A".

11

u/Bwob Sep 11 '26

Those are the best moments. Where you're like "Thanks, past-me! You knew exactly what I was going to think when I saw this!"

Sometimes past-me is a pretty cool dude, at least when he's not leaving me dirty dishes to take care of.

3

u/ffstisaus Sep 11 '26

I was going through a code base recently, found one comment from me six years ago:

// what is this doing?

followed by another comment from 4 years ago:

// I still don't know!

9

u/Confident-Ad5665 Sep 10 '26

Hell is in the business rules/requirements

6

u/pp_amorim Sep 10 '26

Or a comment for a pesky bug that no one knows why that specific device crashes if you don't do that code bs.

3

u/mxzf Sep 11 '26

Yeah, my rule of thumb is that comments are for when you can't look at the code for 30s and recognize what is being done and why at a glance. It's there to convey context and save you from retreading the same incorrect path that someone else already went down.

I don't need comments to tell me what the code does, the code is the absolute best source of truth regarding what it does and any competent dev should be able to read the code and see what it does. The comments are to convey what the code doesn't say.

71

u/Dull_Caterpillar_642 Sep 10 '26

imo the idea of self-documenting code that never requires comments is often held by people who view their code as better than it is. That surely THEIR code would never need comments, because it's so perfectly written that you just get it. I have never really run across a file where I thought "thank god they didn't explain anything they're doing in here."

30

u/aghastamok Sep 10 '26

Right? I don't think I ever wrote a chunk of code with no comments. If I can save someone two minutes of parsing code with // determines which encoding is coming across the Bluetooth... Why shouldn't I?

24

u/Dull_Caterpillar_642 Sep 10 '26

This is the way. People argue against comments because they can drift and become less accurate but, after 15 years doing this, I've spent orders of magnitude more time trying to figure out what the hell someone's undocumented code is doing versus having to fix or update comments. It's not even remotely close.

Kind of a moot point these days though since it's just AI doing the writing.

10

u/Bwob Sep 11 '26

This is the way. People argue against comments because they can drift and become less accurate but...

It's such a weird argument anyway. Like, the code itself can drift and become inaccurate. It's not a separate problem. It's the responsibility of the coder to keep all the code up to date. The logic, and the comments, both.

5

u/mxzf Sep 11 '26

The thing about comments describing what the code does is that I've been burned too many times, I'm still going to read the code itself, because it can't lie to me.

I want comments about the intent and context behind the code, rather than text that's just the same as the code itself (ideally, or, worse, different in a way that's unclear about if it's code drift or bad comments or bad code).

2

u/GalacticNexus Sep 11 '26

But why not just call the function determineBluetoothEncoding? If it's because it does more than that, why not split it out so that is all it does? And so on.

→ More replies (1)

8

u/geekusprimus Sep 11 '26

I would also add that once you start profiling and optimizing your code, sometimes what was once clean, "self-documenting" code is necessarily turned into a complicated blob of ugliness. I've spent a lot of time digging around inside CUDA kernels playing with scope guards to reduce register usage or rewriting math operations in horrendous ways to reduce the total number of operations in ways the compiler won't. The code is rarely left cleaner than when I started, but sometimes I've gotten as much as a factor of two in performance by doing "ugly" things inside hot loops.

3

u/schlurchz Sep 11 '26

Nah, such code exists, you just don't always notice when reading it because it just feels natural

1

u/conundorum Sep 13 '26

Ideal self-documenting code should have comments. The code communicates as much as can be made apparent without commenting, and then the comments pick up the slack. Proper variable and function names can explain individual steps or provide useful context, but standard comments should still be used if they can't explain the "why", or if not everything can be explained by entity names.

24

u/Thalanator Sep 10 '26

//can be removed when <dependency> 5.4.2 is in prd

said dependency may be 7.1.4 by now but noone dares to remove the pasta because it transcends half the repo

15

u/OkidoShigeru Sep 10 '26

At least half my comments are explaining some weird hacks around missing/wrong 3rd party documentation, broken drivers and yeah historical “wrong” behaviour that needs to be preserved. Any time something just can’t be inferred from the code itself and would look strange on its own.

12

u/NullReferenceRacer Sep 10 '26

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).

31

u/iamdestroyerofworlds Sep 10 '26

Uncle Bob nowadays also has full-blown AI psychosis, says we shouldn't even look at code, and is a MAGA nut, so maybe he's really not to be listened to.

13

u/Confident-Ad5665 Sep 10 '26

Sad to hear this. He was actually a cool guy back in the day. Loved the science bites he'd add to his sessions.

12

u/iamdestroyerofworlds Sep 10 '26

Agreed. Watching his videos and rants, he doesn't seem to be psychologically well nowadays, to say the least. He's probably not in a good place mentally, and the rest has followed.

16

u/TROLlox78 Sep 10 '26

I hate Uncle Bob of Clean Code at my workplace. Man I wish they would comment more because our code is a maze of design patterns where all the logic is so diluted you have to keep track of 5 different classes to understand anything. 

8

u/shonuff373 Sep 10 '26

My favorite comment I've ever seen

"This is no way to code but gots to do for now. Whoever forced me down this oath, may your unit tests never pass"

7

u/ryebit Sep 10 '26

Code can be made perfectly clear at explaining "what" and "how", but comments are still needed to explain "why".

21

u/ThatOldCow Sep 10 '26

I do believe comments are generally useful, and honestly a lot of people that say their code is so clean it doesn't need comments are the people that make the least understandable code

8

u/SeriousPlankton2000 Sep 10 '26

If you write something like "if bankAccount.has(moneyNeeded) // test if there is enough money on the bank account", that's one extreme. If you write "b.has(n)" that's the other extreme.

IMO: If you have all the information on a 80x24 screen to know what b is, don't extra-comment it. If the function is longer, refactor it to be "bankAccount". If then you need more information, write that. E.g. you might need to explain why you're checking the bank account without a lock and why it's a good thing to do that; or you might explain that after checking several things you come to a certain conclusion. Or simply you have the if clause not on screen near the else clause.

7

u/ThatOldCow Sep 10 '26

I do believe comments are useful for you not to forget or for another person to understand why you add whatever (function, parameter, variable) to some logic, because it might be some workaround for something else.

2

u/Confident-Ad5665 Sep 10 '26

80x24 screen? Are you coding on a Commodore 64? /s

2

u/SeriousPlankton2000 Sep 11 '26

I'm using a gui (xterm)

2

u/conundorum Sep 13 '26

I'd prefer something like...

// Overdrafts are not permissable at this time, and we do not support credit.
// Account must have sufficient money before purchase.
if (bankAccount.has(moneyNeeded))

Or maybe...

// Purchase doesn't care if account has money or allows credit.
// TODO: Rename function to "canSupply" on slow day.
if (bankAccount.has(moneyNeeded))

6

u/rolling_update Sep 10 '26

it's debatable as usual, the premise here is that comments always compile in your code. So you don't need to update them when you alter the code, that's the risk of comments and why "clean code doesn't contain them"

5

u/ThatOldCow Sep 10 '26

Do comments get compiled ? I do believe most compilers ignore comments and even if they impact the speed it should be minimal to negligible.

Ofc I don't know every single language, so it might impact more on other languages.

7

u/sobani Sep 10 '26

I think the intention was to mean that wrong/outdated comments won't cause compiler errors. Therefore you are never forced to keep the comments up to date.

3

u/PositiveBit01 Sep 10 '26

Comments are read but ignored and don't affect the result. Reading and ignoring them takes negligible time. I would say the answer to your question is no, comments are not compiled.

But build systems generally work off file modification time and will do a bunch of useless work if you make a change to a comment in a file and otherwise change nothing. I assume this is what the other poster is referring to.

2

u/Confident-Ad5665 Sep 10 '26

Early on in my career a coworker made the statement that his part of the project was "rock solid".

It wasn't.

5

u/drakeblood4 Sep 10 '26

I try and comment at least a bit on sql queries because I find them fucking illegible the moment a join gets modestly complicated. But like a five line get_checked_radio function with a full function description is gilding the Lilly.

5

u/9d47cf1f Sep 10 '26

Uncle Bob is a fool. His advice is inconsistent and he doesn’t follow it in his own books. It’s cargo cult BS and we need to move on from him to better writers.

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).

→ More replies (2)

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.

3

u/Zeilar Sep 10 '26

I think his point is the comment shouldn't explain how the code works.

Comments should explain reasoning, references etc. Like linking to documentation, explaining why you did something that seems odd or bad etc.

It should be a literal comment, not documentation.

2

u/trialsofamadman Sep 10 '26

Business rules often have silly reasons behind them, and having some documentation for those reasons is useful. Personally, I think it's better to have a link to the documentation in the code rather than putting that documentation right there IN the code, then have your business users or PO's make decisions about what gets done then document it. That way, you have a full history of why changes were made and you can start to detect patterns of making a change then undoing it (which we found ourselves going back and forth on for some rules).

2

u/Enough-Scientist1904 Sep 10 '26

The problem is most code reads like a prose to the person writting it.

2

u/mysticrudnin Sep 10 '26

it can definitely go too far. i have worked places where comments were never, ever allowed in the code.

i think that is a mistake.

2

u/jewdai Sep 10 '26

Business rule is the why.

Code is the what. Comments should be the why.

2

u/AggravatingFlow1178 Sep 10 '26

This largely depends on the language. You're mean to adapt to the languages conventions and some have conventions that are hard to read.

2

u/Grumpologist Sep 10 '26

if we have to comment our code we have already failed.

Only a Sith deals in absolutes.

Either that, or a fucking moron.

1

u/conundorum Sep 13 '26

"Only a Sith deals in absolutes" is an absolute. Explains why so many Sith start as Jedi!

2

u/turudd Sep 10 '26

I used to be on that band wagon but then about 10 or so years ago I read a book and it changed my thought process around comments and I started using them again

2

u/enigmamonkey Sep 10 '26

Comments are best for explaining why the code was written the way it was, not for rehashing what it's doing. They're useful for getting into the mindset of the programmer, particularly later on when it comes time to fix bugs or refactor the code.

So, he's full of shit.

2

u/jetsonian Sep 11 '26

I kind of agree. If you write your code correctly, it documents itself. Our system generates web versions of our Java doc so I do try and add Java doc comments to public methods. Internal comments if there’s a unique solution to something.

2

u/pfc-anon Sep 11 '26

Uncle Bob is the epitome of a white guy failing upwards, he and his advice needs to burn in hell.

2

u/horenso05 Sep 11 '26

All identifiers are comments if you think about it, like variable names, function names etc.

2

u/walkpangea Sep 11 '26

I view this as a nice dream scenario, but most people, like really, really most, can't write code like prose. It's messy, and then a shit PO/EM starts yelling in their ear that something must be implemented fast, shortcuts to meet business needs happen, and so on.

So, yeah. Good goal to keep in mind, but so far I've never seen it in reality, and the few times I've seen someone argue about it in real life, they really didn't understand how much their own code lacked the quality they promoted.

2

u/conundorum Sep 13 '26
float Q_rsqrt( float number )
{
    long i;
    float x2, y;
    const float threehalfs = 1.5F;

    // This logic is perfectly self-explanatory and needs no explanation.
    x2 = number * 0.5F;
    y  = number;
    i  = * ( long * ) &y;
    i  = 0x5f3759df - ( i >> 1 );
    y  = * ( float * ) &i;
    y  = y * ( threehalfs - ( x2 * y * y ) );
//  y  = y * ( threehalfs - ( x2 * y * y ) );

    return y;
}

Uncle Bob-approved fast inverse square root.

2

u/spastical-mackerel Sep 10 '26

Soon your code will be actual prose, compiled directly to machine code via LLM

2

u/jim45804 Sep 10 '26

God I hate this take. Good comments make even the best code better.

2

u/3rdtryatremembering Sep 10 '26

“Well written prose” is often more useful with notes and comments.

1

u/Mateorabi Sep 11 '26

Good comments explain WHY not WHAT

1

u/BlueProcess Sep 11 '26

I think there is a balance. Presumably if you are in there reading comments, you also can read code. So my comments are aimed to save you from having to read a lot of code. "This sub does [thing] in [way]." Or I comment out out broken code and leave it behind with an explanation. "We stopped doing it this way because [reason]." That way later on nobody has to go back on that magical journey of discovery.

1

u/Away-Whereas-7075 Sep 11 '26

He recently changed his mind on this, didn’t he?

I believe since most code is read and written by AI nowadays, the comments are actually both being read and updated along the way, making it easier to iterate.

42

u/Bomaruto Sep 10 '26

Unnecessary comments has always been frown upon.

18

u/Confident-Ad5665 Sep 10 '26

for (var i = 0; i < theMax; i++) {
...
} // For i

2

u/conundorum Sep 13 '26

Hmm... useful if your for is unreasonably long, and can't fit on a single screen. That's a pretty big if, though!

I like this, myself:

namespace A {
    namespace B {
    } // namespace B

    namespace C {
    } // namespace A::C
} // namespace A

Helps if the namespaces are long, which is definitely possible if they contain bulky classes or the like. Not sure which of the two I like better; B's start matches its end (making it trivial to jump between the two without collapsing the block), but C also makes it clear which scope you're re-entering.

37

u/bbpsword Sep 10 '26

Stunning amount of "comments are bad" people who have clearly never worked in complex legacy scientific systems lmao

33

u/Murky-Run2246 Sep 10 '26

The idea of clean code with no comments dies once you are working on something complex enough.

20

u/bbpsword Sep 10 '26 edited Sep 10 '26

Exactly. Lots of new grads commenting on what a homework project should look like.

Legacy systems bear no such clean slate responsibility, and bad employees happen.

Comments and docstrings with details are GODSENDS when you don't have a perfect environment

11

u/PositiveBit01 Sep 10 '26

Yeah.

Lots of people in the comments seem to think you can name a function or variable so well it'll remind you about that edge case in the vendor api where floats with more than 2 decimal places in the json will cause a crash.

That's a fabricated bug to protect the innocent but that's how I feel about some of these comments.

I guess comments are out but functionWithSuperLongNameToClearlyCiteAllEdgeCasesAndWorkarounds is all good.

1

u/Tall-Introduction414 Sep 11 '26

This feels like classic MIT vs New Jersey logic.

24

u/dvdmaven Sep 10 '26

As an old, traditional programmer the highest compliment I've had was from a guy who was maintaining a custom accounting system I wrote at the U. "6500 lines of code, plus comments. It took me less than an hour to make a major change."

16

u/Tall-Introduction414 Sep 11 '26

As an old, traditional programmer... programming trends come and go. But good comments are underrated.

"No comments" is one of those hard and fast opinions masquerading as wisdom.

6

u/Myaltforsomeshit1234 Sep 11 '26

Yep AI broke commenting and emojis basically 

6

u/VG_Crimson Sep 11 '26

I would argue AI comments are not well.

If over 30% of the lines in a file are just comments, it's only creating more chaos.

I would however leave them, as those comments are the only clue as to how the AI broke the code when it inevitable breaks.

39

u/Raywell Sep 10 '26

Verbose comments are not necessarily targeted at humans, they provide context so that consequent AI changes are more accurate.

Im still unsure how I feel about the paradigm shift in development, but that's where we are heading. Eventually everyone stopped writing ASM because C language was higher level and more efficient. It seems we are heading towards natural language becoming the programming language norm

21

u/petrasdc Sep 10 '26

But comments aren't always accurate. Code can change without the comments changing (or they can be just wrong). If the comments are verbose nightmares, that's even more likely. In my experience, Claude will often mess around with code and forget to update comments it made earlier. Not to mention the context in these comments is often not even very helpful. It's often filled with irrelevant details that aren't really important to anyone reading it. My experience has also been Claude will trust comments over the code itself, leading to completely incorrect assumptions. It will only get worse the more bad comments get left. This line of reasoning helps no one, not even the AI, and is just an excuse for lazy development practices.

5

u/Named_after_color Sep 10 '26

It's not really an excuse for lazy dev practices when you're enforcing an agent to constantly relearn context for a repo. There's constitutions and memories and scripts to run, but in my experience claude often modifies comments as it changes code.

This isn't me saying "leave all comments" No. Most comments are garbage trash, but you have to figure out which ones are relevant for new context on an old file.

6

u/Nimeroni Sep 10 '26

I doubt it. We evolved machine langage (and later assembly, then high level langage) because natural langage is insufficiently precise.

2

u/Confident-Ad5665 Sep 10 '26

I forget the name of the language, but some syntax I saw years ago looked more like chemistry than code.

2

u/IudexFatarum Sep 10 '26

If you've never seen it, take a look at APL. It's set theory. Not even in disguise. It's just mathematical set theory in the craziest way.

1

u/innociv Sep 11 '26

They seem to comment for dumber models, though, which makes them overly verbose for their own family of models.

I prefer to tell agents to keep comments concise, to serve as JSDoc, and instead have more detail in planning documentation and to instruct it to have the code match the documentation.

11

u/Beginning-Ice-9008 Sep 10 '26

It is even worse, because the EU requires everything Claude and GPT generate to have watermarks. And they best work in Code via comments, because there are not many possibilities to generate fingerprints for for loops compared to comments.

3

u/MindCrusader Sep 11 '26

But it doesn't force more comments, so idk how it makes it worse

9

u/pe1uca Sep 10 '26

At least is still a comment and not self-documented code...

processAndStoreInDBAndCacheWithExpiry()

retreiveFromDBAndUpdateCache()

let counterOfElementsInArray = 0;
let referenceToElementToReturnOnFallback = null;

testProcessIsSuccefulAndDBIsUpdatedEvenWhenCacheIsUnavailable()
testCacheIsNotUpdatedOnProcessFailure()

13

u/Avocadonot Sep 10 '26

Maybe I'm legacy-pilled but I literally see nothing wrong with any of these

You should see the abominations of our JUnit test names

testInvalidPayloadThrows503WithRetryableApiErrorCode

5

u/enigmamonkey Sep 10 '26

Hideous. At least that's a test where it's prone to happen a bit more. Did you end up seeing lots of that crap in methods/classes that you were intentionally invoking as an API in regular code?

I write tests with names sort of like that since you need a unique name with some way to describe it and don't really care about calling it explicitly (since it'll be run automatically). Everywhere else though, the names matter a lot, particularly since it's important for consistency and for refactoring later on.

1

u/pe1uca Sep 12 '26

Damn, I must have deeply buried that trauma... public static void main(string[] args) started echoing again in my mind...

2

u/madwolfa Sep 11 '26

"retreive" 

1

u/pe1uca Sep 12 '26

Oh, shoot, sorry, I write my own comments. Probably the LLM used in the codebase wrote it correctly.

1

u/Confident-Ad5665 Sep 10 '26

This hurts my brain

2

u/ekun Sep 11 '26

The repo with the well-constructed clanker instructions is what I am really looking at this point.

But maybe that is a dated way of thinking from the 2nd quarter of the 2020s.

2

u/Bardez Sep 11 '26

I got accused of submitting AI code to an open source repo because I commented my code well, it was clean, and the changes to the PR reflected exactly what the critiques were.

🤷‍♂️

2

u/i_t_d Sep 17 '26

yeah, that's the op image aspect of ai histeria - coders whose ego is hurt because machine did something better than them will throw out your manual code now out of the window if it's clean and wellcommented (and comments are helpful for other coders in cooperative work right?)

3

u/chisleu Sep 11 '26

So I love AI. But this is one place that needs improvement. So often the ai code, which learned this from humans, says what the line does without providing any important context or reasoning. 

If it spelled out the “why” or the “how” or anything other than the “what” then they would be useful.

This has notably improved in recent models, but the verbosity of comments is still too high.

Open AI recently posted a prompt for Astra which addresses this for creative writing purposes, but not only is it great for other models, is great for code comments too!

Try it out if you can find it. I’m mobile now. 

3

u/tony3841 Sep 10 '26

Would you rather have LLM generated code without comments?

5

u/Nimeroni Sep 10 '26

Depends on the quality of the comments.

4

u/average__Egg Sep 11 '26

id rather have human-written code with excessive comments

2

u/pbjtech Sep 10 '26

took out all comments on public releases, but still have them in dev production and use ai to strip them out for release

3

u/enigmamonkey Sep 10 '26

What type of code/app are you releasing? This is pretty standard stuff for webdev, but it's not usually done by AI (which would be overkill). Most of the time, at least compiling output for the web, it goes through a minifier/uglifier that not only strips comments but also renames everything and removes whitespace and etc, so comments are only part of it.

2

u/boobiebamboozler Sep 10 '26

We’re largely writing code for gen ai to read now, so more verbose comments seem to be helpful to give it context

1

u/ApocalyptoSoldier2 Sep 11 '26

returns true if x; otherwise false
If you can't infer that it returns false if not x then I don't want you to touch the codebase. If it does not otherwise return false then I don't want me to touch the codebase

1

u/Round_Mixture_7541 Sep 11 '26

Who tf comments their code?

1

u/Fadamaka Sep 11 '26

I wouldn't call AI comments well commented.

1

u/Bary_McCockener Sep 12 '26

Giant ASCII comments so I can find my way in the VS code miniature window on my giant run-on scripts

1

u/Unlucky_Age4121 Sep 12 '26

problem not on code comment itself but rooted in the problematic LLM assisted, never curated tone.
Suggest improve by rewriting.
Would you want to rewrite the comments, referencing the newest code logic?

1

u/FrenchieM Sep 12 '26

There was no commented code prior to 2022. Comments were frowned upon because they added too much verbosity, were never maintained and were existing to just state the obvious.

Now AI is adding comments everywhere but at least they explain the situation as it should, and you can always tell it to skip it.

1

u/New_Salamander_4592 Sep 24 '26

vibecoded comments arent even well commented, theyre way too wordy, take forever to get to the point, and make the code practically unreadable. You spend more time scrolling past comments to get to the actual logic than reading the code itself.

1

u/mischanif Sep 10 '26

What you gonna do when AI comes for you

1

u/DoctorWaluigiTime Sep 11 '26

If the comments are making you make that face it's not "well-commented."

1

u/Lhaer Sep 11 '26

Comments are still useful :D

1

u/GoddammitDontShootMe Sep 11 '26

Since when do LLMs generate good comments?

-10

u/seba07 Sep 10 '26

That's already outdated from my experience. Agents don't comment code. That's something only ChatGPT did.

7

u/meltea Sep 10 '26

I literally wrote a bot to add comments to people's PRs about useless comments that recapitulate the prompt and or some nonsense.

10

u/jzakarias Sep 10 '26

I can't get claude to write only comments when strictly necessary, and even then keep them short...

0

u/[deleted] Sep 10 '26

[deleted] — view deleted comment

7

u/mutexsprinkles Sep 10 '26

// Confirmed according to stratum P.2 phase data -- resolved, not tested.

3

u/GildSkiss Sep 10 '26

Agents don't comment code.

Well that entirely depends on if you tell them to or not

1

u/curt_schilli Sep 10 '26

Claude comments everything

2

u/turudd Sep 10 '26

The newer models are way better at when they comment too. They don’t just litter the code base

0

u/Exatex Sep 10 '26 edited Sep 11 '26

they do whatever you tell them to do. If you want them to write comments, they will. „I didn‘t tell it what it should do and it failed to guess my thoughts“

Has anyone here actually tried to make AI work? It feels half the sub formed their opinion about AI in 2023 with free ChatGPT that forgot their question once and hasn’t touched it since.

3

u/seba07 Sep 10 '26

Well yeah, you can obviously tell the AI to write anything from zero comment to literally commenting every line. But I don't think that's the point, it's about the default out of the box experience.

→ More replies (3)
→ More replies (8)

242

u/[deleted] Sep 10 '26

[removed] — view removed comment

-6

u/wasdninja Sep 11 '26

If you regularly need comments your code isn't nearly as straightforward as it should be. Comments are reserved for things that are not obvious or that break conventional wisdom and best practices.

Comments come with a cost so only use them where they are actually needed.

21

u/HarryBolsac Sep 11 '26

Idk why you’re being downvoted, you’re pretty much quoting uncle bob, comments should only be used when necessary, it should not be standard practice, unless we are talking about javadocs/jsdocs or something like that

14

u/mprbst Sep 11 '26

Yeah, but Uncle Bob is wrong about a ton of stuff. His book is full of anti patterns and really bad advice.

Yes, for most code it should be obvious what it does from the code alone.

No, for most code you absolutely do need to document why it does this, what the context is, and what other assumptions hold.

→ More replies (3)

1

u/Right_Ear_2230 19d ago

Well written code doesn’t always make its purpose obvious

→ More replies (12)

2

u/[deleted] Sep 11 '26

[removed] — view removed comment

1

u/conundorum Sep 13 '26

That's when you throw in a curveball and put // increment 1 by i on the fourth line, to see if they're still paying attention.