"I don't write any comments, my code is self documenting!"

>"I don't write any comments, my code is self documenting!"

Attached: 1537709183203.jpg (1125x1096, 240K)

>"I write comments were it isn't necessary."

Attached: IMG_20190124_183117.jpg (1123x1095, 80K)

>i post fucking gay threads

>commentaries are a code smell
>if I see commentaries I never trust them or the code

desu if you need to comment everything then your code isn't very good desu

Programming is extremely deliberate. There ain't really grey areas where something is "better suited" for something. It should be immediately apparent what something is doing.

99% of the time when I write any comments it's just because of the subjective angle and because I personally prefer doing it.
Otherwise your code is probably just unnecessarily convoluted if a reasonable person can't immediately infer what's going on.

If programming languages were half as deliberate and expressive as people seem to think software wouldn't half as bugged as it is.
People mess so much stuff these days that I can't belive it. Maybe comments wouldn't help much, but programming notation is far from the wonder some people like to pretend it is.

There are certainly gray areas.
Right now, I'm writing a pool allocator as part of an image processing system. When I swap the pool allocator out for an old linear allocator, I get a performance increase in some areas, and a decrease in others.
There should be paragraphs of comments in important parts of a million lines of code. I don't want to look somewhere else for the documentation. I want to know right away why you chose the data structures you did, the results of experiments you've performed, the places that I need to be mindful of if I change X or Y... Not commenting code is such a beginner mistake.

>>"My code is self documenting!"
Because it's so fucking elegant.
Senpai.

>I need comments to understand how something works

Attached: 1494719619461.png (645x773, 10K)

Programs are messed up because of humans, not programming languages (apart from unsafe C code)

No. The problem are literal sub-0 IQ inbreds with javascript, and cniles.

It's only webdevs who mostly write boilerplate code that says retarded things like this unironically.

No, I need commentaries to quicky discover *WHY* something is, the stupid 5 lines functions that litter the codebase I work on are easy to understand. The big picture and what happens if I change it are much subtler.

Code and doc should be separate. Someone somewhere will forget to update the comments when updating the code and the end result would be double the confusion.

That is stupid shit, though. I try to add a comment to the majority of my code so people know what the fuck is going on.

Yeah, well, comments help a newbie out a ton. It's way easier to modify source when there are comments.

>"I don't make nooses, my body is self-kill myself-ing"

Self documenting code gives me job security

Which is why you should never accept a commit unless they also updated the comments

You met someone from the 1%, then, because I do advanced audio programming and 3% of the time do I run into a scenario where I think it's somewhat subjective and 1% of that 3% of the time do I think it's necessary to write a comment.

I want to open you up to the possibility that your code is just unnecessarily convoluted.
Post an example of something you wrote requiring a comment if you want to prove me wrong.

i write verbose code on purpose and only make comments where it will help another programmer understand the code *faster*
if you need comments for someone to understand your code at all you're bad and should apply at a mcdonalds

>//what the fuck?

>There ain't really grey areas where something is "better suited" for something.
Found the NEET or student

Those are the best kind of comments.

>sequences of 1s and 0s are subjective. It's like playing an instrument, or writing a poem

Attached: hat meme.jpg (1000x1000, 101K)

this guy gets it

Forgot the third option: troll

//This shouldn't work, but it does anyways. Don't touch!

Am I "trolling" you or am I being serious?
You can't have both.

I want to open you up to the possibility that your code isn't akin to "Creating a piece of art", you just suck at creating something that's easily understandable without verbose instructions explaining everything that's happening.

>that guy who puts comments on methods that just do CRUD operations with self-documenting names

Meanwhile in OP's commits

/**
* Input: A golf club entity
*
* Output: Integer
*
* This method takes in a primary key (an integer that is 6 digits long and represents a golf club) for a golf club and removes the golf club the primary key returns
*
* Note: If there is no golf club then the method returns an integer, 0, or 1. 1 means failure and 0 means good. If there is a 1 than there was no golf club removed which indicates it never existed
*
*/
public int removeGolfClub(int golfClubPK) {
return repo.remove(golfClubPK);
}

OK, then you are just a dumbass who doesn't understand the basics of engineering and thinks everything has an explicit solution. I bet your activity planner side project is real cool! Sorry nobody will hire you!

it would be nice if the comments were only comments on a given version (like, content-addressable) of the thing being commented on (function, class, whatever) and if your environment would show the comment as out-of-date if the code has been changed since the comment was last assigned to it, forcing you to update the comment or claim it was up-to-date if you didn't want it to appear out-of-date
then you could still lie, but you couldn't forget, and you could even diff the code with the version the comment belongs to

Noise noise. Roll tide.

Show me your code. And then I can see why it's worthy of getting "philosophical" about. And then won't I look like the idiot

true

Attached: 2019-01-25-02:20:03_738x41_scrot.png (738x41, 10K)

Intelligent response

Idk about you guys, but to me comments are incredibly useful.
I work alone, no team, no prexisting software. So I don’t have to worry about someone else understanding, or me understanding them
And comments are still forever useful

Like I deal with huge abstract systems that take loads of time to think through.
I test things and get varying results that aren’t always apparent
I use advanced mathematics that’s hard to look at and takes forever to replicate
Most of all I write loads of shit over the course of months. Like I can’t remember every little detail of everything I’ve done as it’s spread over a variety of different classes, and communicating with different areas of the program. That would be absurd

I don’t think comments are entirely necessary for myself, but they save me loads of time and headaches, as well as creating a more organized workspace

I really can’t see how they wouldn’t be useful unless your writing small simple applications, or maybe web.

To clarify further, I don’t comment every little function I make. And every line of code

But rather things I think will be useful for me to know in the future, and might not be initially apparent

>I want others to read my code so my owner can replace me easier

Attached: technowagie.jpg (1066x1093, 163K)

I'm obviously not going to show you my code. That is just ridiculous. I'm just saying there are gray areas. This is not a real comment but take this for example:
>//Product table is expected to contain at least 10,000 elements on most sites. using BST here instead of a hashmap
The comment provides context and reasoning that may otherwise not be available and also brings up the point that code is not one-size-fits-all like you suggest. Here is a real comment in our code:
>//Process orders during picking instead of shipping. Many orders were found to be unable to ship because they were being shipped faster than Braintree could capture payment.
Try self-documenting that. Now do you understand why it is clear to me you have no real world experience?

>he doesn't have an IDE that injects local comments into his work so it's 200x easier to maintain AND work can't fuck with you
sweetie........

>not writing badly worded and very unclear comments on end of every single line

Attached: 1548260806608.png (498x562, 279K)

/thread

comments are for journalists
t. Jow Forums

>desu if you need to comment everything then your code isn't very good desu
t. has never collaborated with anyone

collaboration is for journalists

>number is
> is extremely large number, so large no one would likely ever reach it
>here's a comment explaining it, in case `arbitrary_limit = 10000` was confusing to you

The second example makes more sense, but it doesn't really service your point that "computers are mystical things"
That variable completely depends on the outside world, where there are actual variables that you can't know for certain.
If you were only working with a computer and its logic here you would just write
if (processed) {
send();
}


Yeah I'm not convinced.
Don't confused "There's a lot of it and it's hard to keep track of" with "It's mystical and impossible to predict"

A git commit message kind of accomplishes that, assuming each change to the behavior of a function has its own commit.

I've come across passive-aggressive comments I apparently left myself in code I wrote months before and forgot about.

>"I don't ever write comments. I would much rather use verbose variable names"

Attached: average_java_developer.jpg (600x792, 64K)

This

>No comments
Writing none or little comments reeks of low skill. Nobody will use your worthless software and you are a early 20s faggot who will face reality once he has received his diploma in being useless.

>Too many comments
This is not bad, as you can simply remove the excessive comments. I'd take paragraphs explaining a basic ass function over none at all every single day.

Comments are supposed to explain logic, not just code. Webshits please fucking leave.

when you work on a project you are more than likely working with someone else, faggot. do you think LinusTechTips wrote the colonel all by himself? do you think GNU is comment-free?

kys

Until someone forgets to update the doc which is probably much more likely to happen.

You shouldn't write comments for code ever. The code is the comment.

I know. I'm saying that the comments for your logic are probably emblematic of an issue if you feel the need to constantly explain what's going on.

Literally the only reason to include a comment is if you have a magic number. Otherwise the code itself is already the documentation.

Only brainlets need to comment their code. I have never done this except for school projects where my boomer professor would get butt blasted when not commenting every single comma and white space.

// int main() is the main function of a program
// you can put two arguments (that means variables that get passed to a function) - int argc and char** argv which are the number of arguments and the arguments as a char array (like a memory address to a string) but we won't do that now
int main()
{ // opening bracket means beginning of code (we'll put a matching closing bracket as well)
for (int i = 0; i < 5; i++) {
// okay, that was a bit tough, but stick with me here
// first we declare the value i which will be our counter, we could do it before the for loop but this is more convenient and readable
// then we add a condition (sort of an if check) that happens every time the loop starts and if it the output is false we end the loop
// last but not least we add a bit of code that gets executed during the end of the current loop (but not the loop as a whole!)
puts("Hello World!"); // tell the system to do its magic and print a string saying "Hello World!" into the console
} // don't forget the matching bracket!
} // we need another one to close the int main() remember?
// You just wrote a program that writes Hello World 5 times, yay! :D

You haven't written a 20 kloc program, clearly...

I'm still not sure how the fuck they came up with that.

>not keeping the commented version on your pendrive.

Comments, if you HAVE to write them should be extremely detailed and cover WHY something is happening.

Never fucking ever WHAT is happening. My team deletes every comment that doesn't fit that criteria and refactors the code it's about to be more expressive and explicit.

your code is shit

>Writing none or little comments reeks of low skill.
writing code that needs to be commented reeks of low skill

magic numbers are cancer, that code is cancer

That works really well with git blame for what I was asking for. I'm embarrassed that I didn't think of it, especially since I was already doing it. Thank you for correcting me.

What is literate programming.

I am using doxygen.

It pisses me off when I'm at the Python REPL and I help() a value only to have to parse some unfamiliar markup in the docstring. Fuck you, numpy; not everyone is reading your HTML output.

Finally somebody with some common sense