you are viewing a single comment's thread
view the rest of the comments
[–] 19 points 11 months ago (9 children)

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.

  • source
  • hideshow 9 child comments
  • [–] 13 points 11 months ago (4 children)

    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.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 12 points 11 months 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)
    
  • source
  • parent
  • [–] 6 points 11 months ago (1 child)

    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

  • source
  • parent
  • hideshow 1 child comment
  • [–] 7 points 11 months ago (2 children)

    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.”

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 11 months ago (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment