RouterOS的DHCP中继代理配置
2015-12-14 11:55
155 查看
1. Interfaces should be used only to define types. They should not be used to export constants.
2. The constant interface pattern is a poor use of interfaces. That a class uses some constants internally is an implementation detail. Implementing a constant interface causes this implementation detail to leak into the class’s exported API.
3. The constant interface represents a commitment: if in a future release the class is modified so that it no longer needs to use the constants, it still must implement the interface to ensure binary compatibility. If a non-final class implements a constant interface, all of its subclasses will have their namespaces polluted by the constants in the interface.
4. If the constants are strongly tied to an existing class or interface, you should add them to the class or interface. (i.e. Integer.MIN_VALUE, Double.MAX_VALUE)
5. If the constants are best viewed as members of an enumerated type, you should export them with an enum type.
6. In other cases, you should export the constants with a non-instantiable utility class. (Make the constructor private to prevent instantiation)
7. If you make heavy use of the constants exported by a utility class, you can avoid the need for qualifying the constants with the class name by making use of the static import facility, introduced in release 1.5.
2. The constant interface pattern is a poor use of interfaces. That a class uses some constants internally is an implementation detail. Implementing a constant interface causes this implementation detail to leak into the class’s exported API.
3. The constant interface represents a commitment: if in a future release the class is modified so that it no longer needs to use the constants, it still must implement the interface to ensure binary compatibility. If a non-final class implements a constant interface, all of its subclasses will have their namespaces polluted by the constants in the interface.
4. If the constants are strongly tied to an existing class or interface, you should add them to the class or interface. (i.e. Integer.MIN_VALUE, Double.MAX_VALUE)
5. If the constants are best viewed as members of an enumerated type, you should export them with an enum type.
6. In other cases, you should export the constants with a non-instantiable utility class. (Make the constructor private to prevent instantiation)
7. If you make heavy use of the constants exported by a utility class, you can avoid the need for qualifying the constants with the class name by making use of the static import facility, introduced in release 1.5.
相关文章推荐
- 带有指示器的progressbar
- 点击空白处让输入法隐藏的比较好用的方法
- 使用 pm2-web 监控 pm2 服务运行状态
- 利用virt-manager远程linux虚拟机
- C#编程语言
- online_judge_1088
- js学习大法:用好firebug,走遍天下都不怕
- AAndroid系统的启动分析init篇
- 2015.12.14-2015.12.20 大论文计划
- [转]Android 5.0——Material Design详解(动画篇)
- JSP 标准标签库(JSTL)
- SQL 第一范式、第二范式、第三范式、BCNF
- Android CTF SECCON 2015 – Reverse engineering Android APK 2 – 400
- Win10更新时先是出现错误0x80070422,后出现0x8024001e错误的解决方法
- poj 1063 Flip and Shift 冒泡排序的扩展运用
- EditText弹出输入框问题
- Eclipse安装FindBugs,并进行静态代码扫描
- CUDA学习笔记之 CUDA存储器模型
- 反转链表
- #学习笔记#(18)信封&卷角&贴布-photoshop