But it's possible to have a descriptive variable name that describes the same thing in a local and global context. If I have a list of scheduledAppointments globally accessible, but I want to maintain a separate list to stage for saving scheduledAppointments would be an equally descriptive name for a variable in the saveTemporaryAppointments function. It's completely asinine to think that calling it "temporarilyScheduledAppointments" is solving a problem. (If someone can think up a better use case, that'd be awesome. This is just the one I forced into the situation.)
Overly-descriptive variable names can make code visually heavy, and thus less legible quickly. That makes it just as much a pain to maintain as undescriptive code.
I can see your point.. It would become overly verbose if you were to name every variable with its life story just to ensure it's unique..
I would probably prefer structuring the scopes a little better and group my variables into objects and classes.. you could have calendar.appointments and stage.appointments.. so you can still use the same name in different scopes as long as they don't overlap..
I must admit I don't fully understand why CS works this way.. I guess it just comes down to a matter of taste.. I'm not trying to prove anyone wrong here.. just providing an alternate perspective..
View all comments
Show parent comment
3
u/Jinno Jul 26 '13
But it's possible to have a descriptive variable name that describes the same thing in a local and global context. If I have a list of scheduledAppointments globally accessible, but I want to maintain a separate list to stage for saving scheduledAppointments would be an equally descriptive name for a variable in the saveTemporaryAppointments function. It's completely asinine to think that calling it "temporarilyScheduledAppointments" is solving a problem. (If someone can think up a better use case, that'd be awesome. This is just the one I forced into the situation.)
Overly-descriptive variable names can make code visually heavy, and thus less legible quickly. That makes it just as much a pain to maintain as undescriptive code.