1
pepega
5y

How often and in which cases do you write comments in your code?

Comments
  • 5
    - When I need to explain a weird design decision
    - When the code itself isn't straight forward and needs to be explained
    - todos
  • 4
    @alexbrooklyn yeah explaining weird design decisions so I will understand them in 6 months time
    ⊙īšâŠ™
  • 2
    Usually only when something is not immediately obvious.
  • 5
    Well, usually for generating api documentation.
  • 4
    - consumed api docs over each method [if docs change - methods will too]. I find this more useful than looking for docs online every time
    - the WHYs that aren't and cannot be made obvious
    - todos
    - copyright
    - if the code is to be shared - interfaces' methods.
  • 1
    Most of times as a way to get over writers block. Pseudo code, and todos.

    Later I remove most of them.
  • 1
    Docs for future reference, todos, and when I'm bored/frustrated.
    I usually mantain conversations with myself through time through comments, like:
    @highlight
    //maybe use that thing YEAH GOOD IDEA not anymore, that's gone
  • 0
    Never

    Not even a joke
  • 1
    Anything that isn't immediately obvious, or that will help a future dev. Also, explanations of why, and sometimes section markers.
  • 1
    When there is a chance not doing so will blow someone up in the future. I try to be empathic about the people who will be maintaining my code and avoid being a justifying case for, "that last dev's code was complete shit."
  • 0
    I comment pretty much everything, which might be excessive, but I want to make sure that the next person isn't left with too much spaghetti on their plate.

    I keep my comments short and to the point, mainly to explain the algorithms as I write them in pieces.
Add Comment