迪米特法则(LOD)
1.高内聚:把相似功能放在同一类中,方便集中修改,类似单一职责
2.低耦合:类与类之间尽量减少依赖,关系尽量简单
迪米特法则:不该有直接依赖的类之间,不要有依赖,有依赖关系的类之间,尽量只依赖必要的接口
Each unit should have only limited knowledge about other units:only units '' closely '' related to the current unit.
Or : Each unit should only talk to its friends; Don't talk strangers.
评论区