It also hurts the design of your domain classes because this utility class must now sit at the top of your object hierarchy, not allowing you to use inheritance to consolidate common behavior.
这还不利于域类的设计,因为这个实用类现在必须位于对象层次结构的顶层,不允许您使用继承来整合常见行为。
And you probably don't require a 30-megabyte class library, a team of ontologists to design the object model, and dependencies on 15 other packages either.
可能并不需要30兆字节大小的类库、由一组本体专家(ontologists)来设计对象模型,或者依赖15个其他软件包。
The singleton pattern is probably one of the most often used OOP design patterns; it restricts the number of object instances of a class to one.
单例模式可能是最常用的OOP设计模式之一了;它限制了一个类的对象实例数只能为1。
应用推荐