• wols
    link
    fedilink
    arrow-up
    4
    ·
    9 months ago

    This works as a general guideline, but sometimes you aren’t able to write the code in a way that truly self-documents.
    If you come back to a function after a month and need half an hour to understand it, you should probably add some comments explaining what was done and why it was done that way (in addition to considering if you should perhaps rewrite it entirely).
    If your code is going to be used by third parties, you almost always need more documentation than the raw code.

    Yes documentation can become obsolete. So constrain its use to cases where it actually adds clarity and commit to keeping it up to date with the evolving code.