4
simus
4y

i'm the only one thinking naming variable can and could be something a little bit subjective? or are everybody else can find the perfect name that make it crystal clear for any person reading it?

Comments
  • 2
    I like to keep them relevant to the context. If it's some private variables it's np to name them shorter. And as always.. Name things what they are. It usually means contemplating longer than writing, but it quickly pays off.
  • 2
    I think "notYourConcernGreg" is crystal clear for everyone.
  • 2
    This is how you make Greg a living legend between us regular souls. Nice to find these when looking at the source 2 years later with Greg long 404
  • 2
    Totaly agree with @Orang , and don't forget CamelCase
  • 2
    i made this rant because my co-worker alway want to change variable name like something_id to id_something and other unsignificant change, and i can't understant why.

    @Baguette your 'CamelCase' is writed in PascalCase, you probably mean camelCase (another thing my co-worker bother me with, but i can understand why)
  • 0
    @simus I'm not in your coworker's head, but for the first part, it might be to help identified all "id" variables since they would all start in the same way.
  • 1
    @simus hmmm, that's good to know, thanks mate
  • 0
    It can be subjective insofar as there are synonyms for that name in a thesaurus (which is a tool I use a lot). Being capable of expanding your vocabulary is a good programming-relevant skill to have.

    var money, cash, currency, coins, dough, greenStuff, etc can all be seen as the same thing (context permitting).
Add Comment