Comment from my group project teammate. You don’t need to comment every line lol

  • RustyNova@lemmy.world
    link
    fedilink
    arrow-up
    3
    arrow-down
    3
    ·
    edit-2
    18 days ago

    It’s not that bad. It definitely helps in long functions.

    I’m an advocate for code commenting itself, but sometimes it’s just better to comment on what you’re doing, and in those cases it helps to over commentate.

    Instead of letting the reader interweave code reading and comment reading, I think it’s better to do either. Either you go full self describing code, letting the reader parse it as code,m, or you abstract everything, making it more of an explanation of your reasoning, and abstract lines that may look too complicated.

    Not every comment needs to be useful, but I still write them to not have this switch between reasoning and thinking in code. It can also double as rubber duck debugging too!