打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Naming conventions for Java

Use terminology applicable to the domain

If your users refer to their clients as customers, then use the term Customer for the class, not Client. Many developers make the mistake of creating generic terms for concepts when perfectly good terms already exist in the industry or domain.


Use abbreviations sparingly and intelligently

This means you should maintain a list of standard short forms (abbreviations), you should choose them wisely, and you should use them consistently. For example, if you want to use a short form for the word number, then choose one of nbrno, or num, document the one you choose (it doesn't really matter which one), and use only that one.


Avoid long names (15 characters max is a good idea)

Although the class name PhysicalOrVirtualProductOrService might seem to be a good class name at the time (OK, I'm stretching it on this example), this name is simply too long and you should consider renaming it to something shorter -- perhaps something like Offering.


Avoid names that are too similar or that differ only in case

The variable names persistentObject and persistentObjects should not be used together, nor should anSqlDatabaseand anSQLDatabase.


Capitalize the first letter of standard acronyms

Names will often contain standard abbreviations, such as SQL for Standard Query Language. Names such as sqlDatabase for an attribute or SqlDatabase for a class are easier to read than sQLDatabase and SQLDatabase.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
初中英语教师课堂教学用语100句-
英文图解里的缩写
2014年秋新目标九年级英语Unit 1 How can we become good learners?单元测试题附答案
小学生生活情景英语会话分类大全
英语教师课堂常用语
每天一句口语练习:We are on good terms
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服