Nov 13, 2019 10:13 AM
UnfundedBus
124487
3133
39
OverzealousDude
I'm more like. "Who wrote this piece of garbage?!".
Evilbeavers
Every week
35mmProjectionist
Any time I walk away from my writing.
vanishingdoggo
While loop with addobjects set to stop at 0 does not stop at 0 and i am boutta fucking give up (greenfoot
ZarkFury
How about shoe - shoe - underwear that's it
Warblade
Ah the old "i was workin on something important but don't know how i did it to start off with" issue.
SithShodan
THE NUMBERS, MASON - WHAT DO THEY MEAN? Also I implant explanations in .txt files and reference them in code for later
rhombusrightangle
The aged locked away in large alzheimer's housing complexes being lead by their phones through complex instructions just ended our lifestyle
VodkaReindeer
You're supposed to leave a note to yourself, telling what to do next.
JoeMoSexua1
Classic "that's future me's problem"
LeftRightThere
“I’ll finish this Monday.” *Computer updates restart over the weekend.
BlackavarLion
It seems to work, sooooo.
Hybris51129
If you don't use descriptive variable names then you should not be coding at all.
cousteau
Ever tried understand someone else's Matlab code where they went for minimal var name length? Used up the whole alphabet. l+1 hurt my eyes.
I swear, it was like reading code from someone who thought "How to write unmaintainable code" is a legitimate coding guide.
parasP6rsas
// stopped here
asleepybean
This totally happened to me this week with a budgeting template for a freelance gig that I haven't touched in a few weeks
TechnicalDrift
I'm a designer, and this still rings true. You're in a completely different mindset between sessions, notes won't always help.
Credit: https://www.reddit.com/r/ProgrammerHumor/comments/dvoo34/none_of_this_makes_sense/?utm_medium=android_app&utm_source=share
amop
This belongs in the post
ztygs
How are you supposed to double dip on imaginary internet points that way?
nanamonster
Me when I see the credit in the comments and not in the post
DunderBunder3
If you don’t fucking comment your code or even sudo code, you’ll get lost and not know what’s the real issue or how to properly progress.
NotaCPA
I've tried piecemeal coding, the calling the projects and executing just to watch it fail because No fail over response. I need coffee now.
JHawke
What does sudo have to do with this o_O
mrdralixx
sudo comment that shit
teebob21
sudo make me a sandwich
BenSnow97
teebob21 is not in the sudoers file. This incident will be reported.
HappyLittleIdiot
https://xkcd.com/838/
alias please = sudo !!
alias fucking = sudo
merryprankster118
I can barely mess around in python and I comment the crap out of anything I write. Has saved me hours!
I remember reading the code for Sage Math (a Python-based math software) like 75% of it was comments/docstrings. That was fine.
I also remember writing a 5-line comment justifying why I was casting a char to unsigned char just to convince future me not to remove it.
I routinely write complete code explanations. I figure that’s better than staring at it for 40 minutes trying to figure it out.
It is. (Specially—but not exclusively—if someone else is gonna deal with your code.)
Yep: looking at you GitHub!
Fckallthiscrap0clock1105
That's my problem with video games, i always come back after too long and forget where I was
Varimothras
Or you start too many games and the different controls start to mess with you
924Carrera
Yeah, I've now made a personal rule for myself. One main game, one multiplayer FPS, one racing game, and maybe one wildcard at a time, max.
Everythingisalie841
Lol dude i havent finished witcher 3. Metal gear phantom pain. Zelda botw. Dragon age. Skyrim. I try again but i cant grind through.
Phospholamban
Sameeeeee. I've replayed the start of witchery five times. I think I left dragon age with one three quests left. I just cant finish
That happened to me 3 times with New Vegas, twice because I played it right after FO3 and got burned out, and once because I messed up 1/
a quest that prevented me from getting the endgame I wanted, and didn't have a good previous save. I finally finished though, great game.2/2
OliverClothesoff70
Me too. I also forget the controls. There's always some "extra" feature or ability for my character that I totally forget I have.
giraffinator
Happened with Red dead 2, I'm like 30% done and haven't played it in months
RoswellM
Getting back into an RTS savegame like "Hmm... did I wanna conquer these people, or confederate with them?.. "
sweetandsalty
If I'm on a pc game where I can name my save file I'll write a note to myself so I remember what to do next
TheBestNamesAreTaken
I keep doing that with State of Decay...
NotTinyPancakes
For me that's usually the next day, I restart my games daily. Even writing my progress down doesn't help much :(
ZiomalZParafii
I started Planescape Torment 3 times. Never reached even half. Few years break between sessions. Always had to start from scratch.
PresidentCamacho0
That game is so fucking convoluted.
ShutTheFrontDoors
Yeah games need to include both a summary of the story AND a control overview on demand. Some do. Most don’t.
toSlayWithPen
Problem is some controls get so complicated by endgame that you need the ramp up to muscle memory or you’re just fucked.
alman1234
Well...the control overview certainly isn't stellar but the story summary is immaculate and happens on every startup in Witcher 3.
sffmunkee
Then you start it over again and get bored because you’ve played the first 20% of the game 300 times.
Bumbarger
Borderlands 2 for me. Start a game with friends and get to sanctuary then it's "let's take a break". Never gets finished.
That has happened with a few people I've tried to play that game with, but fortunately my main gaming buddy was just as interested in the 1/
game as me and we completed like 3 games all the way to level 72 (now the cap is 80). I have like 1500 hours in that game haha. 2/2
owlest
this is why nowadays I try to finish games before starting another one....but it's hard since I have hundreds of games
PropainAndPropainAccesories
Me with Nier. It took me 9 times to get through the first 2 hours. I just don’t think it’s nearly as good as people say but 2B booty
Noobalott
I'd have to agree. I "beat" it once aka got one ending. Haven't touched it since.
LordofSandvich
Or, y'know, the entire game is the same as the first 20% and it took you a few years to realize that.
ThrowAwayAcct0000
Don't Starve has entered the chat.
buickgnx88
*Skyrim intro intensifies*
FastaPazool
Me 100%
lncorrectGrammerNazi
If that bothers you, check out the "Alternate Start: Live a Different Life" mod. It's pretty great.
LukeLlama
YEP. When I built my PC and started modding Skyrim, I saw that in a mod guide and was like nah I don't mind just playing the normal game, 1/
until I discovered that you cannot skip the intro at all and in order to test the dozens of mods I was installing, I would have to wait 2/
JohnBluehill
surefang
Always comment your code, kids.
MyNameIsRichardCS54
// add 1 to surefang.points
KindofaBadPerson
// Loop unrolling. Here be dragons.
degenerator
I knew a guy who would just write //comment to remind himself to comment on the code.
motokeith
Once saw some crazy x-ray diffraction math code with a single comment “// It's Howdy Doody time!”
kmikl
You made that coder's day, and he/she doesn't even know it.
captainreynolds55
I'm not a programmer. I don't work with code. This still applies, so hard xD
Communinja
I hated commenting in college, I'd always add it in later. Comic happened too many times. Also psuedocode / flow diagrams? Made em after.
DrKonrad
// Pretty obvious, just finish this on Monday
r333
I comment on imgur ##this comment is to reply to surefang
Meilkor
I was gonna suggest 'write a note' bc I didn't know you could comment on code
I comment on the code, then link to a YouTube video on what a section of code does for other people.....not me...never me.
KindaClueless
I always put my entire code on one single line so I can away find it.
BramStocker
lol
RBMK30000
Minify without extra steps
bobsvagenecatsdogsredheadscosplaypuffins
Perl is wonderful.
HeyOhBotchedToe
I'll comment it when I'm done!
RamenOfRagnarok
And keep a list of what needs to be done still
WraithIII
I like to //batman my code
I just copy/paste mine from stackoverflow.
thethingthatwentsplat
“It’s 5:00 on Friday Night, and I am young with an Elephant’s memory” — the Young n’ Dumb
FallingStar7669
Yeah yeah. I'll comment it when the projects done. Right now I just need it to work.
usingYourMomAsAHat
This needs a lot more upvotes
I too like to explain things when I no longer remember what they are for.
Higure
You think that if someone can't express their intent well enough in their code, they somehow magically gain the ability to do it in English?
ShadyDuckling
My favorite thing to do with comments is label different areas of my code. Makes it easier to find what you are looking for.
rv6502
Worse: those type of coders' comments don't even match what the code is doing.
If your code is CSS and one line fixes a weird formatting issue then yes.
zwiep
CSS aka the shadowlands :D
HyruleAttacker
I code about 1 line per section, but some coders are crazy about the whole WET vs DRY... to me it’s just about what works best for project
As a coder, I have literally no idea what you mean by WET vs DRY, so, huh?
Dry = things like purposeful variable and function makes || Wet = things more casual with a focus on commenting. at least this how I see it
ScottishRoss
Write Every Time or Don't Repeat Yourself. Some people where to these too strictly. I generally try and follow ease of understanding.
Lynkfox
Ease of Readability, which generally means more dry than wet in my book, but depends on the project
I would certainly agree. But sometimes it's better to repeat something once than create a function to handle it.
neutronfish
DRY ‘till I die. If you have to repeat the same logic, your design is wrong, period.
Entirelly project dependant. For personal projects I agree. For entreprise projects with thousands of customers you really need a.. 1/2
2/2 extensive risk analysis before choosing strategy.
AyrA
https://en.wikipedia.org/wiki/Fast_inverse_square_root#Overview_of_the_code
The only helpful code comment I ever saw was 'increase this counter if you tried refactoring this method and gave up: 6' saved me time.
Nah, write clean code that's easy to understand even for future you. Comments lie, code just confuses.
hwatL4bloopy
//no
fucking true
AlwaysUpvoteBrockIsARapist
Comment any process that is put on pause or passed off to another, code or not!!!
Soolie
What kind of evil fucks downvoted this?
Selenium.
iCurse
If it ain't in git it doesn't exist, and write as if you're dying tonight and someone else needs to take over
JohnMike64
Noobs comment. Write clean code and commit properly
BeatYaToIt
/* put comments here before the weekend */
nevoreJunkie
If you comment your code, other people can understand it. The goal is code that works but that no one else understands. = job security!
Stop reading "how to write unmaintainable code"!
Yeah ive taken over a project like this. Ive never been so filled with rage in all my life xD
Always code your kids, comment.
Ksnarf
You're not my real dad!
pecadillo365
Only good if you or the other person two years down the line actually bothers to read them!
pixelsnader
Code so you don't nees comments.
ThatGuyWhosFunAtParties
Commenting is deodorant, if you need them to understand your code, your code smells :)
The worst is when someone believes they don't need it but they actually do.
I comment when I need to explain why this seemingly stupid code is here. (Because scale, because product, because time constraints, etc) >>
>> If you need comments to explain how the code works and/or flows, your code works badly and/or your flow sucks. Code reviews help (if >>
>> the reviewer doesn't find your code obvious, you may need comments and/or refactoring).
I always comment my code as if a clueless idiot were going to read it later, which is often the case (the clueless idiot being future me).
TwelveMotionJeweledSkull
##does variable stuff
Beezlebubble
Inwas a designer. I had to take programming. Used to wrote code that worked. Professor had NO idea how it worked until he stared for
Half an hour. Neither of us had a clue. He'd eventually figure it out and explain MY OWN CODE back to me and I'd stare at him like he had
2 heads. And he'd look at me and just sigh. At least he knew I never cheated
That's called "write-only code" and is only good for job security.
Mmbear
Commenting your code only works if you have any idea of what you are doing.
FoxySpirit
Copy paste from stackexchange? Also irresponsible, at least learn from what you copy.
erwanairone360
That can be a comment //If you understand this code please email me at...
DerangedGarsuke
Javadocs
duhleted
Write simple documentation along the way and refactor the documentation with the code.
Thekindofkindlyman
#I don’t know why this block of code works but it does. Do not alter
Sometimes it's the only way
supremedingbat
Da vinci code... my shit's protected from everyone, myself included
Novemburr
/*this code magic*/ and other cryptic phrases
Zyrixion
5am code comments are the worst. I think my favorite 5am code comment I wrote was "this churns the butter"
This guy gets it
StarkRG
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
Rafale25
I understood the reference
#this works, I wish I knew why
For those who aren't aware, this is the actual line of code in Quake used in the fast inverse square root" function.
It isn't even too crazy if you know how floating point representation works, but it seems that they found that 0x5f… by trial and error.
Loose explanation: IEEE754 floating point representation works more or less like a logarithm, so you can do arith with it to get powers.
>Well, a logarithm plus a bias. So -(i>>1), aka -i/2, is sort of equivalent to x^(-1/2), i.e. the inverse square root. 0x5f… is a bias.
ibeatjake
Neat
GodsFoot
It came to me in a dream
Did they ever explain how they came up with it? I vaguely understand it had something to do with how the x86 handled floats, but it seems
like it would have taken some extreme mathematical analysis to not just figure out what numbers to use, but to even consider it an option.
Or use proper TDD and Clean Code procedures
skellington01
Don’t tell me how to live my life ok???
Dominator497
Both? Can we please do both.
Comments are a sign that the code is lacking.
As long as they are not used as a crutch I vehemently disagree. They should be used to describe why code is there, not how the code works.
iamthemadz
That is not true.
Dracon27
Nope, they're for easy readability.
ClassyReposts
Omg noooooo - they're exactly for when your code is _not_ easily readable enough.
HaloMixter
It depends on the situation. I personally like comments, but I don't find the need to use them at work, because we clean up our code nonstop
Pyronixcore
or that you are constantly teaching less able coders in a team
Velexis
Or that you realize you'll probably need to come back to it at some point and it'd be really nice to know what everything does at a glance
alvinthatsme
How do u learn that, is there a guide book or some sorts for this
alexmoon
The Pragmatic Programmer: https://pragprog.com/book/tpp20/the-pragmatic-programmer-20th-anniversary-edition
What the others said. Clean Code is a great book, as are all of Martin's books
Thanks everyone , this was educational
Other than thr ones listed here, check out "Code Craft" by Pete Goodliffe. It discusses style, testing, comments, self-documenting code, etc
https://medium.com/@bethqiang/the-absolute-beginners-guide-to-test-driven-development-with-a-practical-example-c39e73a11631
TheSena
Most of it comes with experience, but a good start for me was "Clean Code" by Robert Martin.
I can vouge for this. Good resource for anyone serious about learning good coding principles. It is not limited to TDD.
I consider this a must-read and probably the best book you can read as a starting developer, both for your sake and that of your colleagues
Not everything should be followed by the letter but if you become aware of the most common pitfalls it already pays off.
Dragondraikk
Yes, an absolutely fantastic book for any budding programmer. It does take principles a bit far at times, but overall it's extremely solid.
Exquisitine
.
ImOPsMom
Lol TDD is not a magic bullet
If you only look at the code vs comments thing it's the best choice. But I agree it comes with caveats. Certainly towards time and budget
A lot of developers are elitists who feel bigger by dropping buzzwords. Anyone with experience knows TDD is just a tool not THE solution.
crantron
This.
100% agree
SamCute1000
Wow, this
Yeah, you need a holistic approach, high quality on all ends, in order to be able to be readable without comments.
I don't know what the obsession is to not use comments. Comments are fine. Unnecessary comments are where issues exist. Code is meant 1/*
OverzealousDude
I'm more like. "Who wrote this piece of garbage?!".
Evilbeavers
Every week
35mmProjectionist
Any time I walk away from my writing.
vanishingdoggo
While loop with addobjects set to stop at 0 does not stop at 0 and i am boutta fucking give up (greenfoot
ZarkFury
How about shoe - shoe - underwear that's it
Warblade
Ah the old "i was workin on something important but don't know how i did it to start off with" issue.
SithShodan
THE NUMBERS, MASON - WHAT DO THEY MEAN? Also I implant explanations in .txt files and reference them in code for later
rhombusrightangle
The aged locked away in large alzheimer's housing complexes being lead by their phones through complex instructions just ended our lifestyle
VodkaReindeer
You're supposed to leave a note to yourself, telling what to do next.
JoeMoSexua1
Classic "that's future me's problem"
LeftRightThere
“I’ll finish this Monday.” *Computer updates restart over the weekend.
BlackavarLion
It seems to work, sooooo.
Hybris51129
If you don't use descriptive variable names then you should not be coding at all.
cousteau
Ever tried understand someone else's Matlab code where they went for minimal var name length? Used up the whole alphabet. l+1 hurt my eyes.
cousteau
I swear, it was like reading code from someone who thought "How to write unmaintainable code" is a legitimate coding guide.
parasP6rsas
// stopped here
asleepybean
This totally happened to me this week with a budgeting template for a freelance gig that I haven't touched in a few weeks
TechnicalDrift
I'm a designer, and this still rings true. You're in a completely different mindset between sessions, notes won't always help.
UnfundedBus
Credit: https://www.reddit.com/r/ProgrammerHumor/comments/dvoo34/none_of_this_makes_sense/?utm_medium=android_app&utm_source=share
amop
This belongs in the post
ztygs
How are you supposed to double dip on imaginary internet points that way?
nanamonster
Me when I see the credit in the comments and not in the post
DunderBunder3
If you don’t fucking comment your code or even sudo code, you’ll get lost and not know what’s the real issue or how to properly progress.
NotaCPA
I've tried piecemeal coding, the calling the projects and executing just to watch it fail because No fail over response. I need coffee now.
JHawke
What does sudo have to do with this o_O
mrdralixx
sudo comment that shit
teebob21
sudo make me a sandwich
BenSnow97
teebob21 is not in the sudoers file. This incident will be reported.
HappyLittleIdiot
https://xkcd.com/838/
JHawke
alias please = sudo !!
BenSnow97
alias fucking = sudo
merryprankster118
I can barely mess around in python and I comment the crap out of anything I write. Has saved me hours!
cousteau
I remember reading the code for Sage Math (a Python-based math software) like 75% of it was comments/docstrings. That was fine.
cousteau
I also remember writing a 5-line comment justifying why I was casting a char to unsigned char just to convince future me not to remove it.
merryprankster118
I routinely write complete code explanations. I figure that’s better than staring at it for 40 minutes trying to figure it out.
cousteau
It is. (Specially—but not exclusively—if someone else is gonna deal with your code.)
merryprankster118
Yep: looking at you GitHub!
Fckallthiscrap0clock1105
That's my problem with video games, i always come back after too long and forget where I was
Varimothras
Or you start too many games and the different controls start to mess with you
924Carrera
Yeah, I've now made a personal rule for myself. One main game, one multiplayer FPS, one racing game, and maybe one wildcard at a time, max.
Everythingisalie841
Lol dude i havent finished witcher 3. Metal gear phantom pain. Zelda botw. Dragon age. Skyrim. I try again but i cant grind through.
Phospholamban
Sameeeeee. I've replayed the start of witchery five times. I think I left dragon age with one three quests left. I just cant finish
924Carrera
That happened to me 3 times with New Vegas, twice because I played it right after FO3 and got burned out, and once because I messed up 1/
924Carrera
a quest that prevented me from getting the endgame I wanted, and didn't have a good previous save. I finally finished though, great game.2/2
OliverClothesoff70
Me too. I also forget the controls. There's always some "extra" feature or ability for my character that I totally forget I have.
giraffinator
Happened with Red dead 2, I'm like 30% done and haven't played it in months
RoswellM
Getting back into an RTS savegame like "Hmm... did I wanna conquer these people, or confederate with them?.. "
sweetandsalty
If I'm on a pc game where I can name my save file I'll write a note to myself so I remember what to do next
TheBestNamesAreTaken
I keep doing that with State of Decay...
NotTinyPancakes
For me that's usually the next day, I restart my games daily. Even writing my progress down doesn't help much :(
ZiomalZParafii
I started Planescape Torment 3 times. Never reached even half. Few years break between sessions. Always had to start from scratch.
PresidentCamacho0
That game is so fucking convoluted.
ShutTheFrontDoors
Yeah games need to include both a summary of the story AND a control overview on demand. Some do. Most don’t.
toSlayWithPen
Problem is some controls get so complicated by endgame that you need the ramp up to muscle memory or you’re just fucked.
alman1234
Well...the control overview certainly isn't stellar but the story summary is immaculate and happens on every startup in Witcher 3.
sffmunkee
Then you start it over again and get bored because you’ve played the first 20% of the game 300 times.
Bumbarger
Borderlands 2 for me. Start a game with friends and get to sanctuary then it's "let's take a break". Never gets finished.
924Carrera
That has happened with a few people I've tried to play that game with, but fortunately my main gaming buddy was just as interested in the 1/
924Carrera
game as me and we completed like 3 games all the way to level 72 (now the cap is 80). I have like 1500 hours in that game haha. 2/2
owlest
this is why nowadays I try to finish games before starting another one....but it's hard since I have hundreds of games
PropainAndPropainAccesories
Me with Nier. It took me 9 times to get through the first 2 hours. I just don’t think it’s nearly as good as people say but 2B booty
Noobalott
I'd have to agree. I "beat" it once aka got one ending. Haven't touched it since.
LordofSandvich
Or, y'know, the entire game is the same as the first 20% and it took you a few years to realize that.
ThrowAwayAcct0000
Don't Starve has entered the chat.
buickgnx88
*Skyrim intro intensifies*
FastaPazool
Me 100%
lncorrectGrammerNazi
If that bothers you, check out the "Alternate Start: Live a Different Life" mod. It's pretty great.
LukeLlama
924Carrera
YEP. When I built my PC and started modding Skyrim, I saw that in a mod guide and was like nah I don't mind just playing the normal game, 1/
924Carrera
until I discovered that you cannot skip the intro at all and in order to test the dozens of mods I was installing, I would have to wait 2/
JohnBluehill
surefang
Always comment your code, kids.
MyNameIsRichardCS54
// add 1 to surefang.points
KindofaBadPerson
// Loop unrolling. Here be dragons.
degenerator
I knew a guy who would just write //comment to remind himself to comment on the code.
motokeith
Once saw some crazy x-ray diffraction math code with a single comment “// It's Howdy Doody time!”
kmikl
You made that coder's day, and he/she doesn't even know it.
captainreynolds55
I'm not a programmer. I don't work with code. This still applies, so hard xD
Communinja
I hated commenting in college, I'd always add it in later. Comic happened too many times. Also psuedocode / flow diagrams? Made em after.
DrKonrad
// Pretty obvious, just finish this on Monday
r333
I comment on imgur ##this comment is to reply to surefang
Meilkor
I was gonna suggest 'write a note' bc I didn't know you could comment on code
NotaCPA
I comment on the code, then link to a YouTube video on what a section of code does for other people.....not me...never me.
KindaClueless
I always put my entire code on one single line so I can away find it.
BramStocker
lol
RBMK30000
Minify without extra steps
bobsvagenecatsdogsredheadscosplaypuffins
Perl is wonderful.
HeyOhBotchedToe
I'll comment it when I'm done!
RamenOfRagnarok
And keep a list of what needs to be done still
WraithIII
I like to //batman my code
bobsvagenecatsdogsredheadscosplaypuffins
I just copy/paste mine from stackoverflow.
thethingthatwentsplat
“It’s 5:00 on Friday Night, and I am young with an Elephant’s memory” — the Young n’ Dumb
FallingStar7669
Yeah yeah. I'll comment it when the projects done. Right now I just need it to work.
usingYourMomAsAHat
This needs a lot more upvotes
cousteau
I too like to explain things when I no longer remember what they are for.
Higure
You think that if someone can't express their intent well enough in their code, they somehow magically gain the ability to do it in English?
ShadyDuckling
My favorite thing to do with comments is label different areas of my code. Makes it easier to find what you are looking for.
rv6502
Worse: those type of coders' comments don't even match what the code is doing.
ShadyDuckling
If your code is CSS and one line fixes a weird formatting issue then yes.
zwiep
CSS aka the shadowlands :D
HyruleAttacker
I code about 1 line per section, but some coders are crazy about the whole WET vs DRY... to me it’s just about what works best for project
ShutTheFrontDoors
As a coder, I have literally no idea what you mean by WET vs DRY, so, huh?
HyruleAttacker
Dry = things like purposeful variable and function makes || Wet = things more casual with a focus on commenting. at least this how I see it
ScottishRoss
Write Every Time or Don't Repeat Yourself. Some people where to these too strictly. I generally try and follow ease of understanding.
Lynkfox
Ease of Readability, which generally means more dry than wet in my book, but depends on the project
ScottishRoss
I would certainly agree. But sometimes it's better to repeat something once than create a function to handle it.
neutronfish
DRY ‘till I die. If you have to repeat the same logic, your design is wrong, period.
usingYourMomAsAHat
Entirelly project dependant. For personal projects I agree. For entreprise projects with thousands of customers you really need a.. 1/2
usingYourMomAsAHat
2/2 extensive risk analysis before choosing strategy.
AyrA
https://en.wikipedia.org/wiki/Fast_inverse_square_root#Overview_of_the_code
zwiep
The only helpful code comment I ever saw was 'increase this counter if you tried refactoring this method and gave up: 6' saved me time.
BenSnow97
Nah, write clean code that's easy to understand even for future you. Comments lie, code just confuses.
hwatL4bloopy
//no
BramStocker
fucking true
AlwaysUpvoteBrockIsARapist
Comment any process that is put on pause or passed off to another, code or not!!!
Soolie
What kind of evil fucks downvoted this?
bobsvagenecatsdogsredheadscosplaypuffins
Selenium.
iCurse
If it ain't in git it doesn't exist, and write as if you're dying tonight and someone else needs to take over
JohnMike64
Noobs comment. Write clean code and commit properly
BeatYaToIt
/* put comments here before the weekend */
nevoreJunkie
If you comment your code, other people can understand it. The goal is code that works but that no one else understands. = job security!
cousteau
Stop reading "how to write unmaintainable code"!
usingYourMomAsAHat
Yeah ive taken over a project like this. Ive never been so filled with rage in all my life xD
kmikl
Always code your kids, comment.
Ksnarf
You're not my real dad!
pecadillo365
Only good if you or the other person two years down the line actually bothers to read them!
pixelsnader
Code so you don't nees comments.
ThatGuyWhosFunAtParties
Commenting is deodorant, if you need them to understand your code, your code smells :)
cousteau
The worst is when someone believes they don't need it but they actually do.
ThatGuyWhosFunAtParties
I comment when I need to explain why this seemingly stupid code is here. (Because scale, because product, because time constraints, etc) >>
ThatGuyWhosFunAtParties
>> If you need comments to explain how the code works and/or flows, your code works badly and/or your flow sucks. Code reviews help (if >>
ThatGuyWhosFunAtParties
>> the reviewer doesn't find your code obvious, you may need comments and/or refactoring).
cousteau
I always comment my code as if a clueless idiot were going to read it later, which is often the case (the clueless idiot being future me).
TwelveMotionJeweledSkull
##does variable stuff
Beezlebubble
Inwas a designer. I had to take programming. Used to wrote code that worked. Professor had NO idea how it worked until he stared for
Beezlebubble
Half an hour. Neither of us had a clue. He'd eventually figure it out and explain MY OWN CODE back to me and I'd stare at him like he had
Beezlebubble
2 heads. And he'd look at me and just sigh. At least he knew I never cheated
cousteau
That's called "write-only code" and is only good for job security.
Mmbear
Commenting your code only works if you have any idea of what you are doing.
FoxySpirit
Copy paste from stackexchange? Also irresponsible, at least learn from what you copy.
erwanairone360
That can be a comment //If you understand this code please email me at...
DerangedGarsuke
Javadocs
duhleted
Write simple documentation along the way and refactor the documentation with the code.
Thekindofkindlyman
#I don’t know why this block of code works but it does. Do not alter
pecadillo365
Sometimes it's the only way
supremedingbat
Da vinci code... my shit's protected from everyone, myself included
Novemburr
/*this code magic*/ and other cryptic phrases
Zyrixion
5am code comments are the worst. I think my favorite 5am code comment I wrote was "this churns the butter"
RBMK30000
This guy gets it
StarkRG
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
Rafale25
I understood the reference
Zyrixion
#this works, I wish I knew why
StarkRG
For those who aren't aware, this is the actual line of code in Quake used in the fast inverse square root" function.
cousteau
It isn't even too crazy if you know how floating point representation works, but it seems that they found that 0x5f… by trial and error.
cousteau
Loose explanation: IEEE754 floating point representation works more or less like a logarithm, so you can do arith with it to get powers.
cousteau
>Well, a logarithm plus a bias. So -(i>>1), aka -i/2, is sort of equivalent to x^(-1/2), i.e. the inverse square root. 0x5f… is a bias.
ibeatjake
Neat
GodsFoot
It came to me in a dream
StarkRG
Did they ever explain how they came up with it? I vaguely understand it had something to do with how the x86 handled floats, but it seems
StarkRG
like it would have taken some extreme mathematical analysis to not just figure out what numbers to use, but to even consider it an option.
Lynkfox
Or use proper TDD and Clean Code procedures
skellington01
Don’t tell me how to live my life ok???
Dominator497
Both? Can we please do both.
zwiep
Comments are a sign that the code is lacking.
Dominator497
As long as they are not used as a crutch I vehemently disagree. They should be used to describe why code is there, not how the code works.
iamthemadz
That is not true.
Dracon27
Nope, they're for easy readability.
ClassyReposts
Omg noooooo - they're exactly for when your code is _not_ easily readable enough.
HaloMixter
It depends on the situation. I personally like comments, but I don't find the need to use them at work, because we clean up our code nonstop
Pyronixcore
or that you are constantly teaching less able coders in a team
Velexis
Or that you realize you'll probably need to come back to it at some point and it'd be really nice to know what everything does at a glance
alvinthatsme
How do u learn that, is there a guide book or some sorts for this
alexmoon
The Pragmatic Programmer: https://pragprog.com/book/tpp20/the-pragmatic-programmer-20th-anniversary-edition
Lynkfox
What the others said. Clean Code is a great book, as are all of Martin's books
alvinthatsme
Thanks everyone , this was educational
ShadyDuckling
Other than thr ones listed here, check out "Code Craft" by Pete Goodliffe. It discusses style, testing, comments, self-documenting code, etc
Dominator497
https://medium.com/@bethqiang/the-absolute-beginners-guide-to-test-driven-development-with-a-practical-example-c39e73a11631
TheSena
Most of it comes with experience, but a good start for me was "Clean Code" by Robert Martin.
Dominator497
I can vouge for this. Good resource for anyone serious about learning good coding principles. It is not limited to TDD.
zwiep
I consider this a must-read and probably the best book you can read as a starting developer, both for your sake and that of your colleagues
zwiep
Not everything should be followed by the letter but if you become aware of the most common pitfalls it already pays off.
Dragondraikk
Yes, an absolutely fantastic book for any budding programmer. It does take principles a bit far at times, but overall it's extremely solid.
Exquisitine
.
ImOPsMom
Lol TDD is not a magic bullet
zwiep
If you only look at the code vs comments thing it's the best choice. But I agree it comes with caveats. Certainly towards time and budget
iamthemadz
A lot of developers are elitists who feel bigger by dropping buzzwords. Anyone with experience knows TDD is just a tool not THE solution.
crantron
This.
Lynkfox
100% agree
SamCute1000
Wow, this
ClassyReposts
Yeah, you need a holistic approach, high quality on all ends, in order to be able to be readable without comments.
iamthemadz
I don't know what the obsession is to not use comments. Comments are fine. Unnecessary comments are where issues exist. Code is meant 1/*