law of demeter
来源:互联网 发布:万科荣华金域名城 编辑:程序博客网 时间:2024/05/19 01:13
Explanation in plain English:
Here's an exact quote briefly summarizing the topic from a slide for auniversity course found on the web, maybe it'll help clarify thehistorical confusion on this page:Law of Demeter
- Your method can call other methods in its class directly
- Your method can call methods on its own fields directly (but not on the fields' fields)
- When your method takes parameters, your method can call methods on those parameters directly.
- When your method creates local objects, that method can call methods on the local objects.
- One should not call methods on a global object (but it can be passed as a parameter ?)
- One should not have a chain of messages a.getB().getC().doSomething() in some class other than a's class.
Here's an exact quote briefly summarizing the topic from a slide for auniversity course found on the web, maybe it'll help clarify thehistorical confusion on this page:Law of Demeter
- governs the communication structure within an object-oriented design
- restricts message-sending statements in method implementations
- only talk to your immediate friends
- message target can only be one of the following objects:
- the method's object itself (C++, Java, C#: this; Smalltalk: self, super; VB.NET: Me)
- an object that is an argument in the method's signature
- an object referred to by the object's attribute
- an object created by the method
- an object referred to by a global variable
- law of demeter
- The law of Demeter
- 迪米特法则(Law of Demeter)
- 迪米特法则 Law of Demeter
- 迪米特法则 (Law of Demeter, LoD)
- 迪米特法则(Law of Demeter)
- 迪米特法则(Law of Demeter)
- 得墨忒耳定律(Law of Demeter)
- 迪米特法则(Law of Demeter) 简介
- 迪米特法则(Law of Demeter)
- 迪米特原则(Law of Demeter)
- 迪米特法则(Law of Demeter)
- 【六大设计原则】5. 迪米特法则 -Law of Demeter
- 得墨忒耳定律 (Law of Demeter,缩写LoD)
- 面向对象设计原则:迪米特法则(Law of Demeter)
- 软件设计原则(六)迪米特法则 -Law of Demeter
- 迪米特法则(Law of Demeter)与领域模型行为
- 设计模式原则(5)--Law of Demeter(LoD)--迪米特法则
- Qt 简介
- 看不完的DotNet程序设计书籍
- 用TreeView实现树菜单
- 西历和历转换
- 高性能网页开发新20条规则详解[转]——好东东 先收藏
- law of demeter
- CSDN的程序员不应该犯这种错误吧?
- 多种方式读取GridView某行的值
- 写给金融危机下年轻人的16条忠告(
- Vdsp(bf561)中的浮点运算(3):FLT_MIN
- GTK+与MFC不完全对比
- 深入嵌入式系统的 BootLoader
- 使用Win2003 R2实现对文件夹的限额
- DATE_GET_MONTH_LASTDAY 函数之怪事