• ToriborA
    link
    fedilink
    English
    arrow-up
    17
    ·
    6 months ago

    “What does this section of code do?”

    Run it and find out, coward.

    • Maalus@lemmy.world
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      6 months ago

      Nah. It should be obvious by just looking at it in code. If it isn’t, you haven’t extracted single purpose methods out of it yet.

      • magic_lobster_party@kbin.run
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        6 months ago

        Just having clear and concise variable names often goes a long way. Avoid using abbreviations.

        Breaking out the code into functions helps limit the number of variables within a scope, which makes it easier to name them.