Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Programming
  3. This Overly Long Variable Name Could Have Been a Comment | Jonathan's Blog

This Overly Long Variable Name Could Have Been a Comment | Jonathan's Blog

Scheduled Pinned Locked Moved Programming
programming
41 Posts 27 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V [email protected]

    The biggest problem with comments is that they can become outdated. If you change code but forget to change comment you introduce very dangerous situation where they become not only not useful, but also misleading.

    If you rely on variable names, you've got a single source of truth, one thing to change at a time. Information updates itself.

    E This user is from outside of this forum
    E This user is from outside of this forum
    [email protected]
    wrote last edited by
    #41

    The same thing can be true about variable names, and it is often more time consuming and error prone to change a variable name to match its new meaning than to simply update a comment. Especially if the variable name is public facing through an API or library then there is a huge cost to change the name everywhere that might reference it.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups