• CodeBlooded@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    15 hours ago

    Or, it appeals to people that have had had to take over an old codebase where the comments were all lies.

    “Code never lies. Comments sometimes do.”

    • ChickenLadyLovesLife@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      6 hours ago

      It’s funny, the exact same logic applies to method and variable names. There’s no compiler that ensures that a method’s name accurately describes what the method does or ensures that a variable’s name accurately describes what the variable represents. Yet nobody ever says “you shouldn’t use descriptive method and variable names because they might be misleading”. And this is hardly academic: I can’t count the number of times I’ve run into methods that no longer do what the method name implies they do.

      And yet method and variable names are exactly what people mean when they talk about “self-documenting” code.