大写缩写的命名约定
应该调用返回 XML 流的方法
public Stream getXmlStream();
还是改为调用
public Stream getXMLStream();
您对此有何看法?什么被认为是最佳实践?
Should a method that returns an XML stream be called
public Stream getXmlStream();
or instead
public Stream getXMLStream();
What's your opinion about that? What's considered best practice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
没有一个正确的答案。此 wiki 摘录很有帮助:
There is no one correct answer. This wiki extract is helpful:
“惯例”就是这样——它不是“规则”。但是,我强烈认为
getXmlStream()
是最好的选择。考虑多个此类术语:将getSQLDBIOXML()
与getSqlDbIoXml()
进行比较A "convention" is just that - it's not a "rule". However, I feel strongly that
getXmlStream()
is the best option. Consider multiple such terms: comparegetSQLDBIOXML()
togetSqlDbIoXml()
您可能应该选择
getXmlStream
。想想 parseDBMXML 或更复杂的示例,这些示例会使代码不可读。来自维基百科 CamelCase
You should probably go for
getXmlStream
. Think ofparseDBMXML
or more complicated examples that make the code unreadable.Comes from wikipedia CamelCase
我并不是说
应该
是这样,但对于某些人来说,他们可以自动调整/期望当存在一连串大写字母后跟小写字母时,某处会出现首字母缩略词。我的意见
是使用getXmlStream()
——我认为
对大多数人来说更容易与立即能够轻松读取getXMLStream()
的人数相比......I'm not saying it
should
be this way but for some, they can automatically adjust/expect that when there's a sequential string of upper-cased letters followed by lower-cased letters there is an acronym somewhere. Myopinion
is to go withgetXmlStream()
--it's something that Ithink
is something easier for most people to read, compared to the number of those instantly able to readgetXMLStream()
with ease..建议使用
public Stream getXMLStream();
缩写最好保持原意
using
public Stream getXMLStream();
will be advisableIts better to keep original meaning of abbreviation