this is not super important to me, but I do not write many comments in code
but what is my code supposed to do, it is well commented with the commit message.
but that links to the issue that it closes. that explains the problem I was trying to solve.
you can also find the associated pull request easily. in the first part, I explained the code diff. that should explain what the code is trying to do. but if it does not, there is a discussion after. the reviewer should have forced me to explain it before approving the PR.
But if none of that worked, is the app satisfactory YES or NO.
If YES then WTF leave well enough alone. You don't understand my black magic and you don't need to.
If NO then write an issue about it, possibly referencing my issue and my pr as possible sources of the problem.
What is my code supposed to do? Solve a specified previously identified problem.
Depends if you wanna get that sweet consultation fee in 5yr or not when nobody can repair your code and the company is bleeding money by the minute while it's down
Honestly i hear this story from old heads all the time. Some company they coded for 20yr ago calling them up and offerin 10k-30k to solve their problem. Hear a few stories where they effectively put the coder in retainer for a few thousand a month with a bump if they actually need them
Im not sure I like bill’s mentality but I can say that overcommented code is ass, and well written code with conservative or no comments and descriptive variable names is much better
I once wrote a C Library, I was still learning at that point and I commented under every freaking line explaining what it does BRIEFLY like not some words it was some sentences whenever I see that library now I just see how far I have come XD
% Simple bs clock. Shoved every variable that i wanted to increase with a set time state . . . % Tried deleting this coconut photo. Program crashed. PNG is load bearing
In-code comments generally shouldn’t explain what the code does (that is the job of documentation). If you have them at all, they should explain why the code was made the way it is.
If you need a comment to tell you what the current line is doing, you should rewrite that line
Not really. I’ve seen complex business logic where it’s simply not enough to know “this method call gives me all subscriptions that expire today” because you still need to know that this only comprises those that have not been extended, and you don’t really want to call your method getExpiringNotExtendedSubscriptionsForToday(). In some cases a comment refreshing your memory about the business logic is better than having to deduce complex rules from reading code.
Yes, but who wants to dig through documentation while reading the code? What is the downside of adding one line stating "# here we only get those results which ..." instead of having to read that up somewhere else?
And I've worked with seniors who were all like "my code is self-documenting" and then 14 days later they were like "I don't understand what my code does here". Not because they were idiots but because the business logic was sufficiently complex.
Yup, i operate a "Why. not what" rule. you can comment why you're doing something, but not what you're doing. if you feel the need to comment what you're doing your code isn't clear enough
// This is an opening message
// Opening messages are often used to set the tone of a response
// Guidance: opening messages should have a soft tone
// Example: ```
// I think you had an interesting to say
// ```
// See: #message-guidance
// Owner: #text-inclusion-workgroup
I can't necessarily agree with Bill's sentiment.
// Followup planning
// Ensure we always follow an opening statement with this necessary
// qualifier. Qualifiers need to conform to the format specified
// by the new qualifier framework, but make sure to also handle cases
// where the legacy qualifier initializer is still emitting possibly
// valid, but non-conforming qualifiers
That said, I've seen pull requests that feel the need to 6x the
number of comments to lines.
// Conclusion, critical point, this is covered using a special case
// test harness that ensures elaboration is minimized while maximizing
// core metrics around intent and brevity scores.
//
// DON'T CHANGE THIS, it breaks everything for some reason
Reading three lines of code shouldn't require parsing an entire page of text.
Things how they should be and things the way they are, often very different. But each time I touch a piece of code, I leave it in a better shape than I found it. 😀
Comments are for the why, not the what or how. When I look at a piece of code and I can't figure out "why" I wish there was a comment giving me the missing context.
Im looking for downvotes. Just spend time writing proper method names and variable names that explain what the thing is. Then you can just read the code and it speaks for itself.
You can also easier build a mental map, because proper naming works as an anchor and lets you find things easier. Your chat bots will also navigate faster. Because a good name will tell ir what the method does.
Comments are 80% and bloat, as long as its not an dynamic api with no type system.
I only comment if I few it'll be significantly useful for whoever reads it later. If the code is well written, it often doesn't need comments unless there's some obscure syntax or function one can't deduce how it works just from seeing it.
Don't put comments in your code, it is ugly and pedantic and makes it harder to read the actual functions. If there is any point within a function you need a comment, you probably need to split the function up.
Make documents next to the code instead. Add diagrams and pictures. Show the intent behind, give actual useful stuff so you can read that as a complete document.
Rarely if ever is it needed to nor useful to have comments.
A big one I am seeing is not having a units library. So your timestamp is just an unsigned long instead of milliseconds, or a distance is a double instead of meters etc. That shit is where stuff gets confusing and a comment might save the day, but it does not have to be there and so it isn't there when you need it. A proper fix is units and make it fail at compile time.
I do not comment either, not because I think my code should be hard to read, but because if my code is so convoluted it needs comments to be understood, then I haven’t done a good enough job making it understandable.
I don't write comments at all. And no one does in my company. There is no need to do so. We have constructions like classes functions etc to provide nesesery context. The time of assembly is long past. Almost every language if this age is expressive enough to render comments obsolete
If you write code properly it should require very few comments. Maybe a readme with a few important pointers. The comments should be used when younare forced to write non self explainatory code, which is not often. (At least in classic back-end code, I dont know enough of what you guys do with React)
If you're writing a comment, you should probably just extract that snippet of code into a function with the comment as a name. That way, a function reads like a list of processes, rather than a chain of unrelated variable assignments, validations, etc.
The only sensible argument against comments is that as the code changes over time there is a risk that the comments will not accurately reflect the implemented functionality.
This just means that you shouldn't be lazy and you should maintain your comments.
After a decade of programming, my professional opinion is still that comments are worthless. Most people should write less of them and instead work on making their code more idiomatic and properly structured. Most programmers that complain about hard to read code, just don't know how to read code in the first place and struggle to read their own shitty code few days after they wrote it.
I don't comment my code either... If what it does isn't clear, I've written some bad code...
If a function has a clear name, every other function it calls has a clear name, the constants and (very few) variables I use have a clear name, the conditionals reads clearly or are wrapped into a well-named constant/function so they read clearly, and every block of code also reads clearly or is wrapped within well-named functions...
What would I even comment on?
Comments are exclusively reserved for:
(A) non-obvious code that needs justification: weird constraints/workarounds/code that seems useless except for that non-obvious edge-case/usually unsafe code that is actually safe in that specific context etc.
B) enums values
C) JSDoc but ONLY if you're making an API meant to be used outside that project
So, in a typical project which is not a public library, I honestly expect around 1 line of comments every few thousands lines of code...
John just re-wrote all of Bill's code but with descriptive variables, good comments and even a little external documentation. Now Bill can be fired because we no longer require that stupid jerk.
I once was a programmer that wrote documentation and commented the code. At some point, AI came around and someone called my comments AI generated because they were too clear and that I should get rid of them (I did not use AI to write that) since the code was "simple".
I never wrote a single line of comments ever since. Now people come back to me (ironically on the code I was asked to remove the comments) and ask me "why is this needed here". I shrug, tell them why it's not documents and that there was a very good reason for that to be there, but there's no way I could remember why.
Obviously, I know the exact purpose of the code and what it does. But I send them every single time to the guy who said it was too simple to have comments "generated by AI".
I comment my code but now it looks AI, now I add more natural language comments like "bro, idk why this line is giving a warning, it works its just being a bitch".
I know this is supposed to be a joke... but I didn't came far from that...
Since my coding style prefers well named constants/variable/functions and function extraction over the use of comments, I described so in a STYLE.md file for agents... But even then, Claude kept adding extremely verbose comments where there where no needs to... After refusing a few edits telling it that those comments where useless... It ended up having to write in memory that my bar for "non-obvious quirks deserving a comment" is higher than it expected...
A few prompts later, it first implemented the code with the usual comments... Then, it remembered what it has stored in memory, and did an extra edit just to remove the comments...
165
u/Bloodchild- Jul 15 '26 •
Fuck bill
88
u/OrangeNood Jul 15 '26
Missing "Don't".
36
u/SaltPhilosopher898 Jul 15 '26
Bill's code does not do what it was supposed to, because Bill sucks at writing code.
But since Bill does not comment, we don't even know what it was orginnally supposed to do.
45
u/Azurelion7a Jul 15 '26
Do you want other people (including your future self) to be able to follow and modify your code?
39
u/Glittering-Can-9397 Jul 15 '26
Im not sure I like bill’s mentality but I can say that overcommented code is ass, and well written code with conservative or no comments and descriptive variable names is much better
13
u/jonfe_darontos Jul 15 '26
5
u/Laicbeias Jul 16 '26
Im looking for downvotes. Just spend time writing proper method names and variable names that explain what the thing is. Then you can just read the code and it speaks for itself.
You can also easier build a mental map, because proper naming works as an anchor and lets you find things easier. Your chat bots will also navigate faster. Because a good name will tell ir what the method does.
Comments are 80% and bloat, as long as its not an dynamic api with no type system.
3
u/sweatpants-aristotle Jul 16 '26
This is Bill. Bill is too lazy to comment his own code and too proud to use AI to comment it for him. Don't be like Bill.
4
u/Vauland Jul 15 '26
My colleagues always comment my code, behind my back
2
u/No-Newspaper8619 Jul 15 '26
I only comment if I few it'll be significantly useful for whoever reads it later. If the code is well written, it often doesn't need comments unless there's some obscure syntax or function one can't deduce how it works just from seeing it.
2
u/brand_new_potato Jul 16 '26
Don't put comments in your code, it is ugly and pedantic and makes it harder to read the actual functions. If there is any point within a function you need a comment, you probably need to split the function up.
Make documents next to the code instead. Add diagrams and pictures. Show the intent behind, give actual useful stuff so you can read that as a complete document.
Rarely if ever is it needed to nor useful to have comments.
A big one I am seeing is not having a units library. So your timestamp is just an unsigned long instead of milliseconds, or a distance is a double instead of meters etc. That shit is where stuff gets confusing and a comment might save the day, but it does not have to be there and so it isn't there when you need it. A proper fix is units and make it fail at compile time.
1
u/chispanz Jul 15 '26
Multiple syntax errors
1
u/MrFordization Jul 15 '26
// i is an index variable that increments by one on each pass
1
u/Grey_Ten Jul 15 '26
there's nothing I could enjoy more than commenting my code so every person who reads it is able to understand what it does.
It feels like posting the solution of an old Reddit question. It'll be helpful to someone else
1
u/RealisticDuck1957 Jul 15 '26
Bill is dangerous to himself and others. Don't trust code which can't be read.
1
u/fugaku-supercomputer Jul 15 '26
Bill should buy himself a new hat and let us know he thinks about it
1
u/memeruiz Jul 15 '26
This must be a Windows or Microsoft programmer
Wait a minute ... Bill? ... Bill Gates?
I knew it!
1
u/JazzRider Jul 16 '26
I’d like to see Bill in six months revisiting Bill’s code….
1
u/KrazyKen_Fan_2012 Jul 16 '26
Yea
1
u/P-39_Airacobra Jul 16 '26
ok but code with every line commented is just stupid, like just learn to read code atp
1
u/Tzimitsce Jul 16 '26
Bill is smart about job security, at least 😄
1
u/Tricky-Doughnut-6429 Jul 16 '26
Eh, I really do think good code shouldn't need comments. I hate comments. But Bill is definitely an idiot.
1
u/Dull-Secretary-8843 Jul 16 '26
people avoid comments to not make it look ai nowadays
1
u/DaveAstator2020 Jul 16 '26
Run ai pass on bill codebase. Then run it over bill as well.
1
u/rolling_atackk Jul 16 '26
I'm off the belief it should be the other way around.
Code should be so simple, as to not require comments to be understood.
Do note: comments are still required to give context, but never more than one or two short ones
1
u/East_Lengthiness_866 Jul 16 '26
I love bill
1
u/No_Department1851 Jul 16 '26
1
u/ShodoDeka Jul 16 '26
I do not comment either, not because I think my code should be hard to read, but because if my code is so convoluted it needs comments to be understood, then I haven’t done a good enough job making it understandable.
1
u/i_knooooooow Jul 16 '26
Little did bill know the reason it was hard to write was that most of the time he was busy figuring out what his own code does
1
u/Comemesas Jul 16 '26
Bill gives his variables and functions descriptive names so any semi-competent programmer should be capable of figuring out what it does by reading.
1
u/_MrLucky_ Jul 16 '26
Bill is going to read same code tomorrow, and in a week, and in a two
1
u/JackoSGC Jul 16 '26
If you write code properly it should require very few comments. Maybe a readme with a few important pointers. The comments should be used when younare forced to write non self explainatory code, which is not often. (At least in classic back-end code, I dont know enough of what you guys do with React)
1
u/Big_Intern5558 Jul 16 '26 edited Jul 16 '26
If you're writing a comment, you should probably just extract that snippet of code into a function with the comment as a name. That way, a function reads like a list of processes, rather than a chain of unrelated variable assignments, validations, etc.
1
u/farfaraway Jul 16 '26
The only sensible argument against comments is that as the code changes over time there is a risk that the comments will not accurately reflect the implemented functionality.
This just means that you shouldn't be lazy and you should maintain your comments.
1
u/blamitter Jul 16 '26
I believe Bill uses the beanie to hide his super sized brain. I can't be like him
1
u/YanVe_ Jul 16 '26
After a decade of programming, my professional opinion is still that comments are worthless. Most people should write less of them and instead work on making their code more idiomatic and properly structured. Most programmers that complain about hard to read code, just don't know how to read code in the first place and struggle to read their own shitty code few days after they wrote it.
1
u/Chemical_Bill_3233 Jul 17 '26
why i am catching strays
1
u/emascars Jul 17 '26
I don't comment my code either... If what it does isn't clear, I've written some bad code...
If a function has a clear name, every other function it calls has a clear name, the constants and (very few) variables I use have a clear name, the conditionals reads clearly or are wrapped into a well-named constant/function so they read clearly, and every block of code also reads clearly or is wrapped within well-named functions...
What would I even comment on?
Comments are exclusively reserved for:
So, in a typical project which is not a public library, I honestly expect around 1 line of comments every few thousands lines of code...
1
u/DrBojengles Jul 17 '26
Writing complex, hard-to-understand code is very easy. Sorry Bill
1
u/Hour_Sell3547 Jul 18 '26
If code is information, comments are noise. Live dangerously.
1
u/KamenRide_V3 Jul 18 '26
My past life was in Sr. Management within a Fortune 50 tech company. Bill is the first on my layoff list.
1
u/MoveOverBieber Jul 19 '26
Don't worry, AI will fix it! - my manager
1
u/Cogiflector Jul 19 '26
John just re-wrote all of Bill's code but with descriptive variables, good comments and even a little external documentation. Now Bill can be fired because we no longer require that stupid jerk.
1
u/MasterpiecePast9560 Jul 21 '26
1
u/ReflectorDefector Jul 21 '26
I wish Bill a nice time debugging☺️
1
u/Entire_Caramel_1373 Aug 03 '26
Line on the bottom is lowercase bill not uppercase Bill
1
u/worldarkplace Jul 15 '26
If you can't read the code normally code is bad written. Change my mind.
1
u/Total_Environment426 Jul 15 '26
I once was a programmer that wrote documentation and commented the code. At some point, AI came around and someone called my comments AI generated because they were too clear and that I should get rid of them (I did not use AI to write that) since the code was "simple".
I never wrote a single line of comments ever since. Now people come back to me (ironically on the code I was asked to remove the comments) and ask me "why is this needed here". I shrug, tell them why it's not documents and that there was a very good reason for that to be there, but there's no way I could remember why.
Obviously, I know the exact purpose of the code and what it does. But I send them every single time to the guy who said it was too simple to have comments "generated by AI".
Yes, I can hold a grudge and I love it.
1
u/ItsSadTimes Jul 15 '26
I comment my code but now it looks AI, now I add more natural language comments like "bro, idk why this line is giving a warning, it works its just being a bitch".
0
u/Achereto Jul 15 '26
True. Only bad code needs comments. If you think your code needs comments, improve the code instead.
-1
u/puzzled_orc Jul 15 '26
If you know how to read code, you don't have to comment it
1
u/[deleted] Jul 16 '26
[removed] — view removed comment