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

    There are no comments in the code

    At my last job, I was assigned to a project being run by a straight-out-of-college developer who felt that not only were comments unnecessary, they were actually a “code smell”, a sign of professional incompetence on the part of whoever added them. It’s an insane philosophy that could only appeal to people who have never had to take over an old codebase.

    • CodeBlooded@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      3 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.”

    • ipkpjersi@lemmy.ml
      link
      fedilink
      arrow-up
      7
      ·
      6 hours ago

      I kind of get the idea that code should be self-documenting, but at the same time, there’s so many crazy business rules that comments are basically a necessity if nothing else other than to explain why in the hell the crazed mess that provides the required functionality for the business rules exists.

      • jjjalljs@ttrpg.network
        link
        fedilink
        arrow-up
        2
        ·
        2 hours ago

        Yeah some comments are not useful

        # returns the value as a string
        return str(user.id)
        

        Some comments are

        # returns the user id as a string because ZenDesk's API throws errors if it gets a number.
        # See ticket RA-1037
        # See ZenDesk docs: https://etc/
        return str(user.id)
        
      • PonderingPotato@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        3
        ·
        4 hours ago

        That’s typically what people who advocate for less/no comments really mean. The code should self explain “what” it does, but if the “why” isn’t obvious (i.e. confusing business logic) nobody argues that you shouldn’t comment it. That’s how I’ve worked in every company I’ve been at (and all developers around me) from 50 person start ups to >2k people. It’s really common mentality with Ruby developers

        • JcbAzPx@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          3 hours ago

          Anyone complaining about commenting should be forced to code in assembly for a while.