The example that he gives that I take issue with is the "Constructor" one in a JavaDoc comment. When using documentation tools, every undocumented function spews a warning. And that is as it should be. But some simple constructors don't have any functionality worth documenting. I code as if all warnings should be addressed, and that's true of my documentation generation. If a public function has no documentation, tha…
Stop commenting your code just to say you did
31–40 of 76 posts
Re: Stop commenting your code just to say you did
#32Earlier quoted context omitted.
It's a pain but check the git history.
Both lines were committed at the same time in a changeset with 15 other files. What now?
Re: Stop commenting your code just to say you did
#33Re: Stop commenting your code just to say you did
#34The example that he gives that I take issue with is the "Constructor" one in a JavaDoc comment. When using documentation tools, every undocumented function spews a warning. And that is as it should be. But some simple constructors don't have any functionality worth documenting. I code as if all warnings should be addressed, and that's true of my documentation generation. If a public function has no documentation, tha…
Writing docblocks can also be a nice way to check yourself from writing bad code. If you find yourself adding 4 different `@param` entries it makes you stop and think, "why is my function taking 4 arguments, it's probably poorly designed".
Re: Stop commenting your code just to say you did
#35God forbid someone gets their thoughts together with comments outlining what a function is going to do and then fills in the code... Or, while deep in thought, someone taps out a bit of redundant commentary on a line or two of their code... Or someone needs a bit of natural language to provide an anchor in their code. The important thing here, I think we can all agree, is that we are smarter than that person.
// don't use hardware acceleration canvas.enableHardwareAcceleration(true); Which is true? The comment is lie. Is this a bug? Was this changed for some reason? Should I remove the comment? Should I toggle the boolean? Why weren't we supposed to use HW acceleration? Why are we using it now? What changed? What value did the comment have in the first place?
//don't do this
do.this(true)
To me, that signifies that I know the way I'm doing it is wrong, but it works until I can figure out how to do it right.
Yes, I would be a horrible collaborator on a project. Most hackers would be, for the definition of hackers meaning "people who do isomething because it works, not because it's good programming".
Re: Stop commenting your code just to say you did
#36Re: Stop commenting your code just to say you did
#37Good or bad, a comment says something about the code it's commenting (even if the code is self explanatory). A blank label says nothing about the wire.
The better analogy might be having labels on wires that state the color of the wires -- red, blue, green, etc.
Re: Stop commenting your code just to say you did
#38Earlier quoted context omitted.
It's a pain but check the git history.
Both lines were committed at the same time in a changeset with 15 other files. What now?
Re: Stop commenting your code just to say you did
#39God forbid someone gets their thoughts together with comments outlining what a function is going to do and then fills in the code... Or, while deep in thought, someone taps out a bit of redundant commentary on a line or two of their code... Or someone needs a bit of natural language to provide an anchor in their code. The important thing here, I think we can all agree, is that we are smarter than that person.
// don't use hardware acceleration canvas.enableHardwareAcceleration(true); Which is true? The comment is lie. Is this a bug? Was this changed for some reason? Should I remove the comment? Should I toggle the boolean? Why weren't we supposed to use HW acceleration? Why are we using it now? What changed? What value did the comment have in the first place?
Now take away the comment. You would never know from reading the code that there might be a problem.
This is a bad comment, but it's still more useful than no comment.
Re: Stop commenting your code just to say you did
#40Earlier quoted context omitted.
// don't use hardware acceleration canvas.enableHardwareAcceleration(true); Which is true? The comment is lie. Is this a bug? Was this changed for some reason? Should I remove the comment? Should I toggle the boolean? Why weren't we supposed to use HW acceleration? Why are we using it now? What changed? What value did the comment have in the first place?
I've got some code that looks like //don't do this do.this(true) To me, that signifies that I know the way I'm doing it is wrong, but it works until I can figure out how to do it right. Yes, I would be a horrible collaborator on a project. Most hackers would be, for the definition of hackers meaning "people who do isomething because it works, not because it's good programming".
// TODO: Find out a better way to do this
do.this(true)