• psysop@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    I’m honestly prefer short but (usually) complete words. Somewhere along the line I realized that being explicit really helps when you need to change it later.

    • jdaxe@infosec.pub
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      due to convention everybody understands what i and j are, I don’t think they need longer names. If it’s something more complicated than a counter or index then maybe you should be using a foreach loop instead (if language supports it)

      • psysop@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        I generally use ‘count’ for a counter and ‘idx’ for index.

        I’m not using C or Java languages though - if I were I would probably go with the more classic terse approach.

        Also, if I’m reviewing a PR and I have to load more of the diff context to understand what a variable represents, then that variable has the wrong name.