您的位置:首页 > 其它

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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: