Design rules 设计原则
Keep configurable data at high levels.
Prefer polymorphism to if/else or switch/case.
Separate multi-threading code.
Prevent over-configurability.
Use dependency injection.
Follow Law of Demeter. A class should know only its direct dependencies.
配置性数据放在高层。
采用多态代替if/else和switch/case。
隔离多线程代码。
不要过度可配置。
使用DI(依赖注入)。
Demeter原则:父类不需要知道子类的实现。
Last updated
Was this helpful?