• lukas@lemmy.haigner.me
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    If someone must explain to me what code does in comments, then I think that code is bad.

    Developers invented high-level programming languages for a reason. If someone writes bottom-top, unreadable code with comments, then they might as well write top-bottom, readable code without comments instead. That’s what I believe self-documenting code is.

    But if someone explains to me why code does what it does in comments, then that’s fine. Essential complexity exists. The point is that that code is readable already, we know what it does, but not why. That’s what needs an explanation in comments.