4 ms·
'name' is the one worst variable names possible. Its like calling your program 'program', your function 'function'. There is always a better choice.
by ape4 10y ago
'name' is the one worst variable names possible. Its like calling your program 'program', your function 'function'. There is always a better choice.
- lallysingh 10y agoDepends on the context. If other vars are 'addess' and 'phoneNumber', 'name' looks pretty reasonable.
- deleted 10y ago[deleted]
- masklinn 10y agoHardly. Is it a person's full name? legal name? first name? last name? nick name? desired call name? a company name? the name (alias) of the stored address?
- gohrt 10y agolegal name in which country? name order varies between UK and China. What's a "call"? Whose company? what kind of address? Following this line of thinking, communication is impossible because everything is ambiguous.
- masklinn 10y ago> Following this line of thinking, communication is impossible because everything is ambiguous. And making everything as ambiguous as possible makes communication easier… how?
- TeMPOraL 10y agoIf you're digging into that specific meaning of the word "name" (as a property of a person), you're likely doing something wrong: http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/ http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-b...
- masklinn 10y ago> If you're digging into that specific meaning of the word "name", you're likely doing something wrong: If you're not you're definitely doing something wrong. > (as a property of a person) The original comment does not specify that it's "a property of a person". It could be a company, it could be a non-specific delivery address, etc...
- rbonvall 10y agoWhen I taught programming to freshmen, the example I used to use when they called variables "number" or "string" was: "that's like calling your baby 'baby'."
- jstimpfle 10y agoPeople do that and in many situations it's the most suitable choice.
- jstimpfle 10y agoWhy would anyone downvote this? Without any comments? Did you never say or hear "the baby is crying"? I will now end my concern about being downvoted and get a life. The discussion culture in this thread is mad.
- rbonvall 10y agoI didn't downvote, but what I really meant is "giving your baby the name 'Baby'".
- jstimpfle 10y agoVery fair - thanks for the update. Maybe it helps to think not as giving variables fixed names (like Luke or Lisa) but seeing them as data accessed by descriptors that describe their qualities (the ones that matter in the current context). Btw humans also have many names, depending on context. You might have had funny nicknames in your childhood, your friends speak to you by your first name, other might speak to you by your last name, others might call you "darling" etc... likewise it's also not totally uncommon to speak to babies by the handle "Baby", like "how are you doing Baby?".