问题描述
我经常看到Java类名称,如
I often see Java class names like
XmlReader
而不是
XMLReader
我的直觉是完全是大写的首字母缩略词,但显然很多人都有不同的看法。或许这只是因为许多代码生成器在使用首字母缩略词时出现问题......
My gut feeling is to completely upper case acronyms, but apparently many people think differently. Or maybe it's just because a lot of code generators are having trouble with acronyms...
所以我想听听公众意见。
如何将包含首字母缩略词的类名称大写?
So i would like to hear the the public opinion.How do you capitalize your class names containing acronyms?
推荐答案
我们使用像Java和.NET这样的驼峰案例约定做。不是出于代码生成器的原因,而是出于可读性。考虑在一个名称中组合两个首字母缩略词的情况,例如将XML转换为HTML的类。
We use the camel case convention like Java and .NET do. Not for reasons of code generators, but for readability. Consider the case of combining two acronyms in one name, for example a class that converts XML into HTML.
XMLHTMLConverter
或
XmlHtmlConverter
您更喜欢哪一个?
这篇关于缩略语Camel Back的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!