Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the verbosity of identifiers affect the performance of a programmer?

I always wondered: Are there any hard facts which would indicate that either shorter or longer identifiers are better?

Example:

clrscr()

opposed to

ClearScreen()

Short identifiers should be faster to read because there are fewer characters but longer identifiers often better resemble natural language and therefore also should be faster to read.

Are there other aspects which suggest either a short or a verbose style?

EDIT: Just to clarify: I didn't ask: "What would you do in this case?". I asked for reasons to prefer one over the other, i.e. this is not a poll question.

Please, if you can, add some reason on why one would prefer one style over the other.

like image 990
Daniel Rikowski Avatar asked Aug 05 '09 09:08

Daniel Rikowski


2 Answers

I'd go for clarity over verbosity or brevit.

ClearScreen() 

is easier to parse than

clrscr() 

in my opinion, but

ClearScreenBeforeRerenderingPage() 

is just noise.

like image 166
Rich Seller Avatar answered Sep 28 '22 07:09

Rich Seller


Abbreviations put a much greater burden on the reader. They are ambiguous; they are indirect; they are harder to discriminate. They burden the writer, too, for s/he must always be asking, "was that Cmd for Command, or Cmnd... or Cm?". They clash - a given abbreviation rule could produce the same abbreviation for two (or more) different words.

Because they are ambiguous, the reader must take time to think about what word is intended; if the word itself is present, the reader need only think about its meaning.

Because they are indirect, they are analogous to a pointer - just as there's a little processing time consumed by every pointer dereference, there's a little (human) processing time consumed, and additional memory occupied, by every abbreviation.

like image 22
Carl Manaster Avatar answered Sep 28 '22 06:09

Carl Manaster