I just recently started documenting my code as it helped me. Though I feel like my documentations are a bit too verbose and probably unneeded on obvious parts of my code.
So I started commenting above a few lines of code and explain it in a short sentence what I do or why I do that, then leave a space under it for the next line so it is easier to read.
zarlin@lemmy.world 11 months ago
The code already describes what it does, your comments should describe why it does that, so the purpose of the code.
Carighan@lemmy.world 11 months ago
Yeah, my general rule of thumb is that the following 4 things should be in the documentation:
MagicShel@programming.dev 11 months ago
Yep. I mostly document why the obvious or best practice solution is wrong. And the answer is usually because of reliance on other poorly written code - third party or internal.