简体   繁体   English

有关在Code Complete中在CamelCase中使用缩写的建议

[英]Recommendation on using abbreviations in CamelCase from Code Complete

In the latest code review I was asked, why did I change the method name from GetHDRFrame to GetHdrFrame , while HDR is an abbreviation. 在最新的代码回顾中,有人问我,为什么将方法名称从GetHDRFrameGetHdrFrame ,而HDR是缩写。 I'm pretty sure there was such recommendation in Code Complete: when using abbreviations in CamelCase names, treat them as regular words. 我很确定在Code Complete中有这样的建议:在CamelCase名称中使用缩写时,请将它们视为常规单词。 But I cannot find the place where it is written. 但是我找不到写它的地方。 Could somebody give me an exact phrase in Code Complete, where it is stated? 有人可以在“代码完整”中给我一个确切的短语吗?

There is a similar question with the useful links to MS rules, but I'm looking for Code Complete quote. 使用MS规则的有用链接也有一个类似的问题 ,但我正在寻找“代码完整”报价。

As far as I've been able to determine, there is no such advice in Code Complete. 据我所能确定的,在“代码完成”中没有这样的建议。 But it does say: 但是确实说:

People have managed to have zealous, blistering debates over fine points such as whether the first character in a name should be capitalized ( TotalPoints vs. totalPoints ), but as long as you and your team are consistent, it won't make much difference. 人们已经就细微的问题进行了激烈而激烈的辩论,例如名称中的第一个字符是否应该大写( TotalPointstotalPoints ),但是只要您和您的团队保持一致,就不会有太大的不同。

And that may help you avoid such nitpicking in future code reviews. 这样可以帮助您避免在以后的代码审查中挑剔。 ;-) ;-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM