![]() | 1 sinsin 2015-03-10 14:57:48 +08:00 很多缩写已经被当成普通词使用了,使用CamelCase风格命名时,包括spring framework的作者们也愿意使用前者。这样大小写分明,分词可编程性也强得多(ry 顺便还有像首词只有一个字母时,Upper camelcase是写IFace还是iFace的这类蛋裂问题233 |
![]() | 2 mgcnrx11 2015-03-10 15:31:52 +08:00 选renderHTML,理由是HTML在书写时都是大写的 |
3 Sharuru 2015-03-10 15:44:57 +08:00 IDE 说啥我信啥 233 |
![]() | 4 incompatible 2015-03-10 15:46:51 +08:00 @sinsin 说到首词只有一个字母时,我不得不提一下java bean spec里的一个烂坑 when we extract a property or event name from the middle of an existing Java name, we normally convert the first character to lower case. However to support the occasional use of all upper-case names, we check if the first two characters of the name are both upper case and if so leave it alone. So for example, - “FooBah” becomes “fooBah” - “Z” becomes “z” - “URL” becomes “URL” 如果你不巧有一个bean,它有一个field名字叫做uRL, 然后它的getter叫getURL 那么在introspect这个bean时,jdk会认为你有一个property叫做URL,而不是uRL |
![]() | 5 mimzy 2015-03-10 16:08:23 +08:00 感觉这东西还是看语言和团队规范的。 在写 C# 的时候,我一般遵循 ReShaper 的建议,缩略词只首字母大写。除非是只有两个字母的缩略词,比如 IO 这种,就全部大写。 这一点在 Framework Design Guidelines 中有很清晰的描述 https://msdn.microsoft.com/en-us/library/ms229042.aspx |
![]() | 6 mimzy 2015-03-10 16:09:20 +08:00 补充:具体位置在 Capitalization Conventions 这一节 https://msdn.microsoft.com/en-us/library/ms229043.aspx |
![]() | 7 cst4you 2015-03-10 16:45:43 +08:00 render_html() //逼死你们这些强迫症 |