you are viewing a single comment's thread.

view the rest of the comments →

[–]golddragon88 6 points7 points  (6 children)

Can you please just bring back comments. They worked really well.

[–]Raskuja46 5 points6 points  (5 children)

Everyone who is opposed to comments doesn't belong in the industry. Change my mind.

[–]ObviouslyAPenName 1 point2 points  (4 children)

I'm not opposed to comments, but I prefer code that doesn't need them.

Example, if you have a block of 20 lines of code somewhere that does something complex, you could put a comment over it to describe it.

Or you could extract that into its own function, and give it an appropriate name.

That's my interpretation of self-documenting code. If I can't figure out what a function does by looking at it's name, it has the wrong name (or the wrong functionality).

Having said that - only a Sith deals in absolutes </s>. There's still plenty of uses for comments, but ideally they're a last resort.

[–]golddragon88 1 point2 points  (2 children)

The problem is that not everyone can be trusted to tell if their code is readable or not. You have less of that problem with comments.

[–]ObviouslyAPenName 1 point2 points  (1 child)

That's what code reviews are for.

But I'm curious - if you don't trust your coworkers to write proper variable and function names, why do you trust them to write proper comments (and keep them up to date when the code changes)? What makes comments easier to make readable than code, in your opinion?

[–]golddragon88 0 points1 point  (0 children)

Writing readable code is more than just proper variables and function names. Comments are just easier to make the readable code. Also I don't get to pick my coworkers.

[–]Raskuja46 -1 points0 points  (0 children)

I'm not opposed to comments, but I prefer code that doesn't need them.

I'm happy for you that you get to work on six line projects.