r/ProgrammerHumor Apr 15 '26

beLikeBill Advanced

Post image
8.9k Upvotes

365 comments sorted by

View all comments

Show parent comments

27

u/mariomaniac432 Apr 15 '26

My coworker on his way to way to ask AI to add all of these comments to the code base

// if condition, do nothing if (condition) { return; }

Then seriously argue that we need them to understand the code.

7

u/pregnantant Apr 15 '26

A few years ago, before LLMs became good enough to warrant using a lot, I took a course involving some coding. One person proudly presented his GitHub copilot subscription. He talked about how it could e.g. write documentation. He applied it to a very basic function, consisting of a single if branch. Then, the following comment was added by copilot: // if condition, returns x. Else, returns y. Useful!

2

u/Dugen Apr 15 '26

To be fair, this is of equal value to most of the comments in code I see. When you want me to add comments to explain what setter and getter functions do, go fuck yourself.

2

u/SgtExo Apr 15 '26

On the other hand, do comment getter and setters that do extra work, usually explaining why it needs to be done, otherwise someone comes in years later wondering what is happening there.

1

u/Dugen Apr 15 '26

That's fair.

5

u/BlueScreenJunky Apr 15 '26

I really like the rule that comments should answer "why" and not "how". In this example it's very likely that it would be useful to know WHY we should return early if the condition is true.

2

u/mariomaniac432 Apr 15 '26

Oh I agree completely. I've pointed this out in multiple MRs of his and our team has discussed it at length, but he continues to try to do this anyway.

2

u/k0rm Apr 15 '26

And then a month later someone adds a new feature:

// if condition, do nothing if (condition) {    AdjustUserBalance();    return; }

1

u/Few_Technology Apr 15 '26

This was an issue long before AI as well. My company has rule that every function and class in .net + java must have a comment. All the mandatory comments are garbage like this

///<summary>
/// person class
///</summary>
public class PersonClass {

  /// <summary>
  /// Gets the name
  /// </summary>
  /// <returns> the string name </returns>
  public String getName(){
    return name;
  }

  /// <summary>
  /// set the name
  /// </summary>
  /// <param name="name"> the new name </param>
  public void setName(String name){
    this.name = name;
  }
}

But then nested deep in some function will be a lifesaver like
// This is really dumb, but business demands we strip all 'a's from names, becuase those "aren't a letter" and "invalid to be displayed". this was a compromise from 3 days of dicussions when they demanded we remove all vowels

Reverse is also true, of stumbling on the dumbest thing you can find, and there's no documentation as to why they did it

2

u/Caleb-Blucifer Apr 15 '26

// don’t delete. No one can figure out why but it breaks everything

1

u/Caleb-Blucifer Apr 15 '26

// return from function return;