标识符的冗长程度如何影响程序员的性能? [英] How does the verbosity of identifiers affect the performance of a programmer?

查看:159
本文介绍了标识符的冗长程度如何影响程序员的性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是想知道:是否有任何严重的事实表明更短或更长的标识符更好?

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

示例: p>

Example:

clrscr()


$ b b

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?

编辑: 请问:在这种情况下,你会做什么?。我问为什么喜欢一个比另一个,即这不是一个民意调查问题的原因。

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.

如果可以的话,请在为什么 / p>

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

推荐答案

缩写给读者带来了更大的负担。他们是模糊的;它们是间接的;他们很难区分。他们也负责作家,因为他/他必须总是问,命令Cmd,Cmd ...还是Cm?。他们冲突 - 一个给定的缩写规则可以产生两个(或更多)不同词的相同缩写。

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.

这篇关于标识符的冗长程度如何影响程序员的性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆