Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
lotd77757yAwesome.
Not pointing at anybody as I'm guilty myself, but especially those "magic" double underscore (accessor, delegator) props & methods need a comment or two... :) -
elazar10307yDocument your interfaces.
Write straightforward code with meaningful names.
Comment only on messy or surprising parts of your logic. -
devios157017yI always say think of comments as something you want to explain to your future self after you forget everything you've just done. Then you'll hate writing them less and appreciate them more when you have them.
-
elazar10307y@devios1 that's good attitude, but think about code review: when a piece of code requires explanation, then it's not ideal to begin with. Sometimes the effort needed for explaining it is better directed towards making it straightforward so it doesn't require explanation.
That said, of course sometimes there's no straightforward way, and sometimes there are pitfalls in the "obvious" solution. These demand comments.
In other words, comments describe the anomalies in the code. One should strive not to have such things at all. -
devios157017y@elazar Can't disagree with that, but as I'm sure you know it rarely works out that way. ;)
-
elazar10307y@devios1 true. So it's not "cool, I've even commented it" but rather "well, that's the best I could have hoped for under the circumstances, but at least I have explained it in the comments".
-
I think you just posted the title here to start the discussion. You did not write some description or content related to it and leave the people or participants to write about that topic. You may be adopted an approach like https://analyzedu.com/writing-servi... and it is good and people like to participate in such discussion.
Related Rants
I promise (for myself) I'll comment my code from now on...
undefined
comments
code
comments make lives easier