• 0 Posts
  • 3 Comments
Joined 1 year ago
cake
Cake day: June 6th, 2023

help-circle

  • vtrtoProgrammingA quick tip for better variable names
    link
    fedilink
    English
    arrow-up
    12
    arrow-down
    1
    ·
    1 year ago

    That seems akin to commenting. The problem with this approach is that text is not code. It’s very easy to forget to change text. In that case it becomes the worst of both worlds, you have a variable name that actually misleads you.

    Much safer than this is to encode this kind of information into the code itself in such a way the program won’t compile of the types are incorrect.