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
-
zshh38487yJust out of curiosity, when should you document your code then? If you have good code I don't see the need for documentation.
-
@simeg Documentation is good when done properly as it allows you to see at a glance what the function does without reading it.
-
@simeg Just imagine if you started using React but there was no documentation. It is after all written by good coders, right? Nobody would like to go through your code to understand how to use a function.
-
@floatright
Something like head nail hit on.
It depends on how a language/framework code style is set in said project
@nblackburn
Most of the time, the only comment I give to a function is it's dependency once I have to explain a function it's getting to big. This is my rule of thumb. -
@nblackburn oooooh. Sorry, I'm kinda new here. Didn't know about those weekly stuff 🙇
-
zshh38487y@nblackburn Documentation easily becomes duplicated information that will eventually differ from the truth (the code) because someone will change the code but forget to change the documentation. That's why I don't think documentation by default is good, it's dangerous. By this I mean documentation in the code.
@floatright The kind of documentation you are referring to will always be useful, of course. It's a framework we're talking about, not a function. -
@simeg Any kind of documentation can fall out of sync, in any event it's down the developer to make sure what ever type they provide is current.
-
kb8816047ybest approach: write code the way that it doesn't need documentation. then write documentation 😁
Related Rants
Only bad code needs documenting...
undefined
wk66