比如一个资源管理的类Manager设置成单例模式。而其他很多的地方都需要用到资源,是不是应该将Manager暴露给所有的类来访问?如果这样的做话,会导致大量的类依赖Manager,这还能算是一种好的设计吗?
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
Single instance does not mean that interfaces (such as pure virtuality and abstraction) cannot be used. Interfaces can be used to reduce coupling.
To put it simply, the whole world is just one instance~
Single instance does not mean that interfaces (such as pure virtuality and abstraction) cannot be used. Interfaces can be used to reduce coupling.
To put it simply, the whole world is just one instance~