• hark@lemmy.world
    link
    fedilink
    arrow-up
    8
    arrow-down
    2
    ·
    1 year ago

    Single-letter constant/variable names are strongly discouraged in programming but standard in math.

    • StarManta@lemmy.world
      link
      fedilink
      arrow-up
      7
      arrow-down
      1
      ·
      1 year ago

      Math standard practices were created at a time when everyone was doing them by hand. Absolutely no one would write out “coefficient of gravity” or whatever 20 times by hand while trying to solve a physics equation.

      Single letter variable names were common in early programming for basically the same reason, only with typing.

      Ever since the proliferation of autocomplete and intellisense in programming IDE’s, typing a 4-word-long variable name has become a few key letters and then hitting tab. Ever since then, code readability has trumped the desire to type out fewer letters.

    • Kogasa
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      Complicated math generally contains a lot more explicit definitions of the variables involved, either in English or with previously established notation. Writing proofs is more about communicating the result than it is proving it. In that sense it is similar to programming with an emphasis on maintainability.

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

        Sure, the variables have explicit definitions somewhere, but it still requires you to go back and reference them every time you forget what y stood for.

        With more verbose identifiers like in code, you don’t need these reminders. The cognitive load is reduced, because you no longer need to hold a table in your head that correlates these random letters with their definitions.

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

          I assure you the cognitive load would not be reduced. It would just be less readable.