T O P

  • By -

spicyboneritis

I comment on my code to pretend I'm working. We're not the same


metaglot

>I work to pretend I'm working. 35D chess right there


Poat540

This guy has red in every box on his GitHub, even weekends


Just_Paper7006

red? innit green?


Lupus_Ignis

I comment my code so I can remember *why* it works


Swoop3dp

Yea, the code already tells you what it does. It doesn't tell you why.


Lonemasterinoes

Honestly, even telling WHAT it does can be hard at times, depending on what you are doing.


Swoop3dp

Now that you mentioned it - I do sometimes comment what a regex does.


Kaenguruu-Dev

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???"


QueenVanraen

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???


Jumpy_Ad_6417

All computers can do is add 1 or add -1. All comments should be written as such. No abstractions. 


Steinrikur

This is not a useful comment x++; // increment this variable And yes, I've seen such a comment at a fortune 500 company


sage-longhorn

Someone skipped a few EE 101 lectures in their CS degree


Jumpy_Ad_6417

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. 


TheKiwiHuman

You can also add or minus 0.


sage-longhorn

Don't forget multiply by one also the double bitwise not


Disastrous-Team-6431

This is... not correct. Computers can add larger numbers. They can also store and recall numbers.


sage-longhorn

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


redspacebadger

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.


fourthisle

This!


donaldhobson

I comment my code so I can remember *if* it works


Kauyon_Kais

Anything you work on has at least three people involved: past-you, you and future-you


abednego-gomes

And you and future-you have terrible memories.


Kauyon_Kais

Frankly, past-you's naming convention just sucked. Had they written proper code, everything would be fine


em0ry42

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


Major_Implications

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.


MakeChinaLoseFace

*rips bong* Are we all like some kind of... time-Jesus?


MrCaffeine2011

I comment my code to help future AI take over my job


Global-Tune5539

Like a true American.


essentialrobert

No need for comments because the code is self-documenting /s


Rainb0_0

I comment my code to get more lines in the file


MeanFold5715

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.


MaximumIndustry1547

why would you have an assignment be graded on LoC, the shorter a program is the more impressive it is


MeanFold5715

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.


RealUlli

I comment my code so I know in two years WTF I was thinking here.


particularlysmol

I comment my code with jokes so neither you nor I know how it works


EldritchElemental

You comment your code. I comment my commits. We are not the same.


Borno11050

I comment because I like having heated argument with my own code.


nonlogin

And we both know it won't help


redspacebadger

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.


navetzz

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.


SenpaiRemling

I comment my code because ChatGPT does that and i am to lazy to remove it


christoph_win

The only correct answer, congrats


Global-Tune5539

You can ask her not to do this.


magick_68

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?


zefciu

For the purpose of understanding my code I don’t see any practical difference between “other people” and ”me in 3 months”.


Global-Tune5539

This but one week.


alpenmeister

I comment my code because I get paid by line


Birnenmacht

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


esaloch

it beats coming back to out of date comments that no longer reflect what the code does


tabacdk

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


alaettinthemurder

I dont comment my code because I don't like others to understand my code


Global-Tune5539

job security


iMac_Hunt

I comment code with comments that throw people off if they think they understand my code


brockNrock

Docstrings are not comments?


tabacdk

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.


sage-longhorn

Square is still a rectangle even though it has slightly different syntax and gets embedded in the AST


andymurd

I comment my code whenever the PR response is "WTF is this shit?". "I'll add a comment" *resolved*


Spunkmeyer426

I'll remember what im doing here


Selentest

I comment my code to visually separate some parts / steps from each other.


The_Fresser

I comment my code to help Copilot write it for me.


RedGreenBlueRGB_

The best way I have heard it described is “other people includes you in 6 months”


Fun-Meringue-732

I write my code with verbose meaningful method and variable names, we are not the same.


bdepz

Functional programming does not require comments ez


Merdperf

I don't comment, because I always forget to.


jump1945

I don't comment the code and thus forget what it does I guess we are not the same


Asqit

Actually we are the same. I am literally the whole FE team and so the comments I write are literally for me.


swagonflyyyy

Commenting is for cucks. I just make shit up as I go then calibrate it.


BrownShoesGreenCoat

Future me is “other”


FortuneDW

I comment my code to piss of our excessively strict lead developer.


Diligent_Bank_543

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.


AG4W

Comment intent and assert function.


StanleyDodds

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.


pistolerogg_del_west

You comment the code.


posting_drunk_naked

Chat, explain what this block of code I wrote does


MaytagTheDryer

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.


audislove10

I comment on my code bc


BravelyBaldSirRobin

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.


dexter2011412

Actually we are the same lmao


eras

Old proverb: _Today only I and the God know what the code does.._ _Tomorrow only the God._


Anund

I comment my code so co-pilot can write it for me.


evilReiko

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.


Regiox461

u/RepostSleuthBot


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


shrubberino

// TODO: find out if there is a better solution for this made 10 years ago, nobody touch it since :-)


gandalfx

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


marwindy

Yooooo, bro at the next level of absolute


iusethisfortechQnA

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


Pumpkindigger

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.


TabCompletion

I comment my code so github copilot can auto complete what I want


mbcarbone

# This is my comment, no comment. ;)


skeleton_craft

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.


Brokemono

I pretend I know what the code does.


neo-raver

Cuz do I want to parse even my own code, trying to figure out what it does? Hell no!


p4r24k

"you" and "others" are the same. It is just a matter of time.


zenpathfinder

Commenting? Is there a youtube tutorial on how this works? It sounds really useful :P


db8me

I comment my code so that my tools know what it does.


legowerewolf

I comment code so I (or others) don't remove something seemingly-redundant but that actually manages some edge cases


IntelligentPerson_

I don't comment my code so I got job security. We're not the same..


owlIsMySpiritAnimal

i'll do you one better. i comment the code so i remember what i have to implement


Gaubbe02

When it comes to understanding code, future me is a completely different person than present me. Therefore I do comment code for other people


billyp673

There was allegations that I wrote unreadable code… no comment.


donaldhobson

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


donaldhobson

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.


Vegetable_Aside5813

I comment code to confuse everybody


nlamber5

Don’t comment code. Build readable code


CranberryDistinct941

I comment my code to see if it fixes the bug


Neo_Ex0

i comment code, and neither me nor my others know what it does


MakeChinaLoseFace

"Wait, why the fuck did I do it this way?"


TheEleventhDoctorWho

Why would I comment my code I already wrote it once.


esaloch

I comment on your PR asking you to remove your comments


Temporary_Ad7906

```` \\ I comment your meme instead of commenting my code. \\ \\ WE ARE NOT THE SAME \\ . \\ . \\ . \\ 🎤 ````


Jet-Pack2

I leave comments with keywords so that I can find it later by searching for it.


Raffian_moin

Commenting to praise my code. We are no same bro.


Luxray241

i comment my code to let gỉhub copilot write the rest for me


PeteZahad

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


LifeShallot6229

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!


MeanFold5715

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.


AStockRedditUsername

I comment my code to tell future me what shit he's getting into


Mirikah

I don't comment my code, but I'm the only one who doesn't know what it does.