应该遵循的规范:
类/接口/属性名,使用名词或形容词;
方法名使用动词。
Java Naming Conventions:
http://www.oracle.com/technetwork/java/codeconventions-135099.html
Ixxx、Service、servieimpl、dao、daoimpl,真的有必要吗?
Naming the Java Implementation Classes:
http://isagoksu.com/2009/development/java/naming-the-java-implementation-classes/
http://stackoverflow.com/questions/2814805/java-interfaces-implementation-naming-convention
对象的 State & Behavior:
state is stored in fields and behavior is shown via methods
对象的属性及其对应的值构成对象的状态:An object's state is defined by the attributes of the object and by the values these have.通俗的讲可以将state理解成对象的属性(字段)。
很多的设计模式中,都遵循“separate state and behavior”的原则。state即字段,behavior即方法,既然要分离出对象的行为(方法)来,而类/接口的名称约定一般为名词,所以,分离出的行为接口的命名,一般也就遵循“动词变名词”的原则,如发送email有个方法叫send,分离出发送行为后,可以将其命名为EmailSender;某类Xxx有个print方法,分离出打印的行为后,可以将其命名为XxxPrinter等;分离出账单类Bill的计算账单方法calculate()后,可以将分离出的"计算账单"这一行为的接口命名为BillCalculator等,诸如此类。
包的划分原则:Package by feature or layer?
http://stackoverflow.com/questions/11733267/is-package-by-feature-approach-good
包的划分,可以按 feature(功能)来,也可能按 layer(action/controller/service/dao/model 等)来。
但有一点需要注意的是,在同一层级上,不要混合使用 feature-based 和 layer-based 划分策略,不然容易造成混乱。
一个建议的划分方法是,先按 feature 划分,再在各个 feature 下按 layer 来划分。如:
引用
com
--xxx
----email
------composer
--------service
--------dao
--------model
--------and so on
------sender
--------service
--------dao
--------model
--------and so on
问题,分离 Api(interface) 和 Impl 的包结构,属于 feature-based 还是 layer-based?
DB 的 table name 及其对应的 Java Entity name,应该是写作单数形式(Singular)还是复数形式(Plural)?
http://stackoverflow.com/questions/808992/singular-or-plural-database-table-names引用
分享到:
相关推荐
Oracle Solaris 11 Oracle Solaris Administration:Naming and Directory Services-262
innovus instance 命名规则 Title The Naming Convention for Clock Tree Optimization Repeaters Description Question: When clock tree synthesis or clock tree optimization is run, a lot of buffers with the...
Oracle Solaris 10 System Administration Guide: Naming and Directory Services (NIS+)-498
Oracle Solaris 9 - System Administration Guide: Naming and Directory Services (FNS and NIS+)-730
Oracle Solaris 9 -System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP)-350
JNDI(Java Naming and Directory Interface)是SUN公司提供的一种标准的Java命名系统接口,JNDI提供统一的客户端API,通过不同的访问提供者接口JNDI SPI的实现,由管理者将JNDI API映射为特定的命名服务和目录系统,...
check-file-naming-convention插件 用法 首先,安装gulp-check-file-naming-convention作为开发依赖项: npm install --save-dev gulp-check-file-naming-convention 然后,将其添加到您的gulpfile.js : var ...
IPC-7351指导硬件开发中PCB封装库的相关设计,根据不同的封装类型定义不同的焊盘形式,以便实现可...附件中资源为Library Expert Land Pattern Naming Convention,与IPC-7351B相比有很大提升,命名规则更加贴近使用。
Maven坐标:com.pig4cloud.nacos:nacos-naming:2.0.4.RELEASE; 标签:pig4cloud、naming、nacos、jar包、java、中文文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 ...
自定义规范:通过自定义变更命名规范、注释规范完成代码审查。 二、功能列表 Info(内容):获取文件内容; Measure(度量):度量代码基本要素; Naming(命名):审查变量命名情况; Comment(注释):审查文件、类、函数等...
jndi,就是命名服务(n:naming)和目录服务(d:directory). 命名服务:把对象映射到方便记忆的名字的机制.可以通过域名系统dns来理解,例如我们访问百度,只要输入www.baidu.com而不是百度的IP地址. 目录服务:其实也是一种...
Maven坐标:com.pig4cloud.nacos:nacos-naming:2.0.4.RELEASE; 标签:pig4cloud、naming、nacos、jar包、java、中英对照文档; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容...
PEP 8命名约定 根据命名约定检查您的代码。...2.0 (pep8: 1.4.3, pyflakes: 0.6.1, naming: 0.2) 默认情况下,该插件处于启用状态。 错误代码 发出以下错误代码: 代码 样本信息 N801 类名应使用CapWords约定() N8
java.lang 提供利用 Java 编程语言进行程序设计的基础类。 java.lang.annotation 为 Java 编程语言注释设施提供库支持。 java.lang.instrument 提供允许 Java 编程语言代理检测运行在 JVM 上的程序的服务。 java....
npm install naming-convention-transfer 浏览器(iife) 请此文件。 并在您的文档中嵌入脚本标签。 < script src =" ./dist/naming-convention-transfer.js " > </ script > 例子 Nodejs的 import { ...
资源来自pypi官网。 资源全名:naming-0.5.0.tar.gz