摘要: 最少知识原则(Least Knowledge Principle),或者称迪米特法则(Law of Demeter),是一种面向对象程序设计的指导原则,它描述了一种保持代码松耦合的策略。其可简单的归纳为:"Each unit should have only limited knowledge about other units: only units "closely" related to the current unit. 每个单元对其他单元只拥有有限的知识,只了解与当前单元紧密联系的单元;",简洁的说是:”Only talk to your immediate friends. 只和自己直接的 "朋友" 交谈。”。 阅读全文
posted @ 2014-06-23 08:25 sangmado 阅读(11231) 评论(10) 推荐(9) 编辑