<分区>
如果我的类(class)名称包含任何首字母缩略词,那么我该如何命名?
例如:SomeDAO 或 SomeDao
此外,如果任何变量有首字母缩写词,我该如何命名?
例如:private String appUID
或 private String appUid
谢谢!
标签 java
<分区>
如果我的类(class)名称包含任何首字母缩略词,那么我该如何命名?
例如:SomeDAO 或 SomeDao
此外,如果任何变量有首字母缩写词,我该如何命名?
例如:private String appUID
或 private String appUid
谢谢!
最佳答案
来自 code convention对于 oracle 提供的 java:
Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML
由于 DAO 被广泛使用和接受,我会选择 SomeDAO
关于java命名类命名约定有首字母缩略词吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20046262/