• Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    1
    ·
    edit-2
    1 year ago

    The liberty to not name things that are obvious.

    and that’s yet another way to end up with hard to read code.

    Variables hold values that have meaning. Learn how to name things and you’ll write good code.

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

      This makes me want to write a function for you to add to numbers where the variables are leftumber and rightnumber, instead of x and y.

      • Miaou
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Lhs and rhs are much better than x and y

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

          In what way? If you encountered a function that had x and y which just added them together, that’s not readable enough?

          • Miaou
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            Well in a vacuum yes sure, you’re right, but in practice there’s always some context. x and y could be referring to axes, where an addition makes little sense. However lhs and rhs make more sense if you’re overloading an operator