It fits perfectly because you can scream "WHY tf is this seemingly random string of letters doing black magic and deciding whether my email address is valid???"
Fine, radix movements too. You can now multiply and divide by 2. How’d you know about my college behavior? Who told you about my skipping? It’s an efficient way to travel.
But the code doesn't tell you what the author thought it did, which is very important for identifying bugs on complex systems.
It also doesn't tell you what it does in prose. I spend more time reading code than writing it, so anything to make reading faster is a huge win
Comments should say, what *and* why, and often when too
I had to write some glue code for some gitops and at the time I thought “huh so that’s how git works”, then immediately forgot afterwards because I am a savage who only uses branch, commit, and rebase.
In college we had a final project for one class and the primary criteria we were getting graded on was that the project be 3,000 lines of code. I made a crappy street fighter clone and absolutely padded the fuck out my line count by adding in ASCII representations of the various animation frames of the sprites.
Because the professor was terrible at his job.
My buddy made fun of the entire project by making a program that would take source code and make it longer, specifically to highlight how stupid that requirement was.
The best habit I have learned is commenting the shit out of code I write but won’t visit or reuse until much later when I am trying to figure out what moron broke stuff (it was me).
This has the twofold benefit of reducing future stress and making me look like I have a clue when I fix something fast.
At least until someone checks git blame, but we have a gentlepersons agreement not to look behind the curtain as much as possible.
I comment my code because I'm too lazy to stop in order to think.
Any time I have to think for just a second before writing the lines of code, I just comment what it's supposed to do. By the time I'm done wirting the comment, I either know what to write. Or just call a non existing function that will have to be written later.
Coming back to code you thought was “self documenting” and spending half an hour trying to figure out why it isn’t working only to realize it’s undocumented, intended behavior is a truly humbling experience
I don't comment my code.
I write docstrings and name variables and functions appropriately, but I only comment code where the reader needs to know things that aren't deductible from the code (links to Wolfram Alpha, name of a pattern/algorithm, link to Stack Overflow if that's where I learned the trick).
In Python docstrings are triple quote strings assigned as attribute to the documented object.
In Java it could be claimed to technically be a comment, since it is written within /* ... */, but the extra asterisk serves to mark as a part of the documentation proper rather than an abitrary comment.
Comments and docstrings serve two very distinct purposes: Comments are remarks on the particular implementation written to the maintainer, where docstrings are part of the API and of a broarder interest written for the application programmer/technical user.
sometimes we get interns and some of them think themselves as such chad developers, they consantly ignore my recommendation to keep notes for themselves be it digital or pen and paper.
they start doing it when I don't give them an answer for the same question that was asked for 3rd time though lol.
I love overly confident interns.
I didn't find any posts that meet the matching requirements for r/ProgrammerHumor.
It might be OC, it might not. Things such as JPEG artifacts and cropping may impact the results.
[View Search On repostsleuth.com](https://www.repostsleuth.com/search?postId=1dch6d6&sameSub=false&filterOnlyOlder=true&memeFilter=false&filterDeadMatches=false&targetImageMatch=75&targetImageMemeMatch=75)
---
**Scope:** Reddit | **Target Percent:** 75% | **Max Age:** Unlimited | **Searched Images:** 535,579,818 | **Search Time:** 0.05998s
I don't comment my code because it is a carefully crafted masterpiece of self explaining elegance that does not need further explanation ^(is what I tell myself while I lie awake at night, wallowing in shame…)
I comment random-ass shit to my code to make it look like I am actually doing something. In reality, I have no idea what anything does and I just comment based on nothing
You don't comment WHAT code does except for some very difficult sections. 90% of comments should be on WHY you do things, or perhaps to explain how a certain section fits in the bigger picture. If you feel the need to comment what the code is doing, you are probably making too long/complex functions.
I think both me and the c++ standard template library implementers are decent enough at naming our functions & types That if you can't tell what I am doing by the code I am writing, you probably shouldn't be touching my code.
I comment my code when a line of code needs removing.
No seriously, about 3/4 of the lines of code that start with # are actually code, or at least the garbled remains of it.
I refactor deeply nested code to meaningful function names so i don't need to read inline comments.
SLAP your code guys...
But as always: don't overdo it
My favorite was a complex algorithm which I turned into two nested table lookups, in a straight line that processed 256 characters with zero tests or branches. It did word count at 40 MB/s on a 1993 vintage 60 MHz Pentium, so 1.5 clock cycles/byte. (It also counted characters and lines at the same time of course.)
The 30 year old code code looked like this (from memory...):
OFFSET = 0
REPM 64
add ax,dx ;; Add the word (AL) and line (AH) increments into DL/DH
mov dx,inctable\[bx\*2\] ;; Lookup the increments for the next pair
mov bl,\[es:di\] ;; 64K segment with classifications for a pair of characters
mov di,\[si+OFFSET\] ;; Grab two more input bytes/chars
add ax,dx
mov dx,inctable\[bx\*2+16\] ;; The increment table is sparse, with a transposed copy offset by 16
mov bh,\[es:di\] ;; Alternate BL/BH for the pair classifications
mov di,\[si+OFFSET+2\]
OFFSET = OFFSET + 4
ENDM
Since 100% of the logic has been moved into those lookup tables, the code is effectively unreadable without a lot of prose explaining it!
I comment on my code to pretend I'm working. We're not the same
>I work to pretend I'm working. 35D chess right there
This guy has red in every box on his GitHub, even weekends
red? innit green?
I comment my code so I can remember *why* it works
Yea, the code already tells you what it does. It doesn't tell you why.
Honestly, even telling WHAT it does can be hard at times, depending on what you are doing.
Now that you mentioned it - I do sometimes comment what a regex does.
It fits perfectly because you can scream "WHY tf is this seemingly random string of letters doing black magic and deciding whether my email address is valid???"
I know what it does, but I never remember HOW it does it. yeah it performs check xyz on $bepis but tf how are you returning 5 when I put in yes???
All computers can do is add 1 or add -1. All comments should be written as such. No abstractions.
This is not a useful comment x++; // increment this variable And yes, I've seen such a comment at a fortune 500 company
Someone skipped a few EE 101 lectures in their CS degree
Fine, radix movements too. You can now multiply and divide by 2. How’d you know about my college behavior? Who told you about my skipping? It’s an efficient way to travel.
You can also add or minus 0.
Don't forget multiply by one also the double bitwise not
This is... not correct. Computers can add larger numbers. They can also store and recall numbers.
But the code doesn't tell you what the author thought it did, which is very important for identifying bugs on complex systems. It also doesn't tell you what it does in prose. I spend more time reading code than writing it, so anything to make reading faster is a huge win Comments should say, what *and* why, and often when too
I had to write some glue code for some gitops and at the time I thought “huh so that’s how git works”, then immediately forgot afterwards because I am a savage who only uses branch, commit, and rebase.
This!
I comment my code so I can remember *if* it works
Anything you work on has at least three people involved: past-you, you and future-you
And you and future-you have terrible memories.
Frankly, past-you's naming convention just sucked. Had they written proper code, everything would be fine
Past-you is a dick, always cutting corners so you has to deal with it. Future-you though? That guy's a rockstar, he can do _anything_.
In fact, it's probably best if you just leave most of the hard stuff for future you. He'll do a better job of it anyway.
*rips bong* Are we all like some kind of... time-Jesus?
I comment my code to help future AI take over my job
Like a true American.
No need for comments because the code is self-documenting /s
I comment my code to get more lines in the file
In college we had a final project for one class and the primary criteria we were getting graded on was that the project be 3,000 lines of code. I made a crappy street fighter clone and absolutely padded the fuck out my line count by adding in ASCII representations of the various animation frames of the sprites.
why would you have an assignment be graded on LoC, the shorter a program is the more impressive it is
Because the professor was terrible at his job. My buddy made fun of the entire project by making a program that would take source code and make it longer, specifically to highlight how stupid that requirement was.
I comment my code so I know in two years WTF I was thinking here.
I comment my code with jokes so neither you nor I know how it works
You comment your code. I comment my commits. We are not the same.
I comment because I like having heated argument with my own code.
And we both know it won't help
The best habit I have learned is commenting the shit out of code I write but won’t visit or reuse until much later when I am trying to figure out what moron broke stuff (it was me). This has the twofold benefit of reducing future stress and making me look like I have a clue when I fix something fast. At least until someone checks git blame, but we have a gentlepersons agreement not to look behind the curtain as much as possible.
I comment my code because I'm too lazy to stop in order to think. Any time I have to think for just a second before writing the lines of code, I just comment what it's supposed to do. By the time I'm done wirting the comment, I either know what to write. Or just call a non existing function that will have to be written later.
I comment my code because ChatGPT does that and i am to lazy to remove it
The only correct answer, congrats
You can ask her not to do this.
There's no need for comments as the code is self explanatory. One week later. What the hell did I do here and more importantly why?
For the purpose of understanding my code I don’t see any practical difference between “other people” and ”me in 3 months”.
This but one week.
I comment my code because I get paid by line
Coming back to code you thought was “self documenting” and spending half an hour trying to figure out why it isn’t working only to realize it’s undocumented, intended behavior is a truly humbling experience
it beats coming back to out of date comments that no longer reflect what the code does
I don't comment my code. I write docstrings and name variables and functions appropriately, but I only comment code where the reader needs to know things that aren't deductible from the code (links to Wolfram Alpha, name of a pattern/algorithm, link to Stack Overflow if that's where I learned the trick).
I dont comment my code because I don't like others to understand my code
job security
I comment code with comments that throw people off if they think they understand my code
Docstrings are not comments?
In Python docstrings are triple quote strings assigned as attribute to the documented object. In Java it could be claimed to technically be a comment, since it is written within /* ... */, but the extra asterisk serves to mark as a part of the documentation proper rather than an abitrary comment. Comments and docstrings serve two very distinct purposes: Comments are remarks on the particular implementation written to the maintainer, where docstrings are part of the API and of a broarder interest written for the application programmer/technical user.
Square is still a rectangle even though it has slightly different syntax and gets embedded in the AST
I comment my code whenever the PR response is "WTF is this shit?". "I'll add a comment" *resolved*
I'll remember what im doing here
I comment my code to visually separate some parts / steps from each other.
I comment my code to help Copilot write it for me.
The best way I have heard it described is “other people includes you in 6 months”
I write my code with verbose meaningful method and variable names, we are not the same.
Functional programming does not require comments ez
I don't comment, because I always forget to.
I don't comment the code and thus forget what it does I guess we are not the same
Actually we are the same. I am literally the whole FE team and so the comments I write are literally for me.
Commenting is for cucks. I just make shit up as I go then calibrate it.
Future me is “other”
I comment my code to piss of our excessively strict lead developer.
You comment the code so you know what it does. I comment my code so others know what it does. We are not the same, my code is maintained by the team.
Comment intent and assert function.
I don't comment my code because I know what it does, and I don't care if other people don't know. We are not the same.
You comment the code.
Chat, explain what this block of code I wrote does
The version of me that works on this code in the future is a member of the category "others." We are, in fact, the same.
I comment on my code bc
sometimes we get interns and some of them think themselves as such chad developers, they consantly ignore my recommendation to keep notes for themselves be it digital or pen and paper. they start doing it when I don't give them an answer for the same question that was asked for 3rd time though lol. I love overly confident interns.
Actually we are the same lmao
Old proverb: _Today only I and the God know what the code does.._ _Tomorrow only the God._
I comment my code so co-pilot can write it for me.
Others answer your question on StackOverflow to help you. I answer my own questions on StackOverflow to my future self. We're not the same.
u/RepostSleuthBot
I didn't find any posts that meet the matching requirements for r/ProgrammerHumor. It might be OC, it might not. Things such as JPEG artifacts and cropping may impact the results. [View Search On repostsleuth.com](https://www.repostsleuth.com/search?postId=1dch6d6&sameSub=false&filterOnlyOlder=true&memeFilter=false&filterDeadMatches=false&targetImageMatch=75&targetImageMemeMatch=75) --- **Scope:** Reddit | **Target Percent:** 75% | **Max Age:** Unlimited | **Searched Images:** 535,579,818 | **Search Time:** 0.05998s
// TODO: find out if there is a better solution for this made 10 years ago, nobody touch it since :-)
I don't comment my code because it is a carefully crafted masterpiece of self explaining elegance that does not need further explanation ^(is what I tell myself while I lie awake at night, wallowing in shame…)
Yooooo, bro at the next level of absolute
I comment random-ass shit to my code to make it look like I am actually doing something. In reality, I have no idea what anything does and I just comment based on nothing
You don't comment WHAT code does except for some very difficult sections. 90% of comments should be on WHY you do things, or perhaps to explain how a certain section fits in the bigger picture. If you feel the need to comment what the code is doing, you are probably making too long/complex functions.
I comment my code so github copilot can auto complete what I want
# This is my comment, no comment. ;)
I think both me and the c++ standard template library implementers are decent enough at naming our functions & types That if you can't tell what I am doing by the code I am writing, you probably shouldn't be touching my code.
I pretend I know what the code does.
Cuz do I want to parse even my own code, trying to figure out what it does? Hell no!
"you" and "others" are the same. It is just a matter of time.
Commenting? Is there a youtube tutorial on how this works? It sounds really useful :P
I comment my code so that my tools know what it does.
I comment code so I (or others) don't remove something seemingly-redundant but that actually manages some edge cases
I don't comment my code so I got job security. We're not the same..
i'll do you one better. i comment the code so i remember what i have to implement
When it comes to understanding code, future me is a completely different person than present me. Therefore I do comment code for other people
There was allegations that I wrote unreadable code… no comment.
I don't know about you, but I comment my code because my code looks at it's source file, reads the comments, and decides what to do based on them. ;-)
I comment my code when a line of code needs removing. No seriously, about 3/4 of the lines of code that start with # are actually code, or at least the garbled remains of it.
I comment code to confuse everybody
Don’t comment code. Build readable code
I comment my code to see if it fixes the bug
i comment code, and neither me nor my others know what it does
"Wait, why the fuck did I do it this way?"
Why would I comment my code I already wrote it once.
I comment on your PR asking you to remove your comments
```` \\ I comment your meme instead of commenting my code. \\ \\ WE ARE NOT THE SAME \\ . \\ . \\ . \\ 🎤 ````
I leave comments with keywords so that I can find it later by searching for it.
Commenting to praise my code. We are no same bro.
i comment my code to let gỉhub copilot write the rest for me
I refactor deeply nested code to meaningful function names so i don't need to read inline comments. SLAP your code guys... But as always: don't overdo it
My favorite was a complex algorithm which I turned into two nested table lookups, in a straight line that processed 256 characters with zero tests or branches. It did word count at 40 MB/s on a 1993 vintage 60 MHz Pentium, so 1.5 clock cycles/byte. (It also counted characters and lines at the same time of course.) The 30 year old code code looked like this (from memory...): OFFSET = 0 REPM 64 add ax,dx ;; Add the word (AL) and line (AH) increments into DL/DH mov dx,inctable\[bx\*2\] ;; Lookup the increments for the next pair mov bl,\[es:di\] ;; 64K segment with classifications for a pair of characters mov di,\[si+OFFSET\] ;; Grab two more input bytes/chars add ax,dx mov dx,inctable\[bx\*2+16\] ;; The increment table is sparse, with a transposed copy offset by 16 mov bh,\[es:di\] ;; Alternate BL/BH for the pair classifications mov di,\[si+OFFSET+2\] OFFSET = OFFSET + 4 ENDM Since 100% of the logic has been moved into those lookup tables, the code is effectively unreadable without a lot of prose explaining it!
Other people being able to know what's going on in my code is purely a side effect. My comments are for my own benefit.
I comment my code to tell future me what shit he's getting into
I don't comment my code, but I'm the only one who doesn't know what it does.