2、GRASP原则二:信息专家 Information Expert
   What is a general principle of assigning responsibility to objects?

    为一个对象 分配职责的一般原则是什么?

   “鸡鸣狗盗” 战国时候,齐国的孟尝君喜欢招纳各种人做门客,号称宾客三千….
2.2 GRASP rule2: Information Expert

   Name: Information Expert (信息专家)

   Problem:

     What is a general principle of assigning responsibility to objects?

   Solution:

     Assign responsibility to the class that has the information necessary to fulfill responsibility
   Information

     an object's own state,

     about other objects, the world around an object,

     information the object can derive,

     and so forth

   Answer to Mini exercise 2
2.3 Information Expert — How to?

   步骤

     1)Clearly state the responsibility

     2)Look in Design Model for relevant classes

     3)Else look in Domain Model and create design classes

   信息专家的优点

     封装性 Encapsulation

       对象充分利用自身的信息 objects support their own information

       支持低耦合 supports low coupling

     系统行为分布到不同的类 Behavior is distributed across classes

       支持高内聚 supports high cohesion

7.2 GRASP原则二:信息专家 Information Expert的更多相关文章

  1. 7.3 GRASP原则三: 低耦合 Low Coupling

    3.GRASP原则三: 低耦合 Low Coupling  How to support low dependency, low change impact and increased reuse? ...

  2. 运用GRASP原则来做uml交互类图-------pos机实例

    重要的几个GRASP原则:1.控制器模式   2.创建者模式 (原则)3.信息专家模式(原则) 4. 高内聚 低耦合   这里所说的模式并不是java中针对具体的事件的设计模式 主成功场景的几个操作: ...

  3. 7.7 GRASP原则七: 纯虚构 Pure Fabrication

    GRASP原则七: 纯虚构 Pure Fabrication  如果依据信息专家原则获得的解决方案不合适,既不想违反低耦合.高内聚,也不想违 反其他的原则, 该如何把职责分配给对象?  左右为难… ...

  4. 7.6 GRASP原则六: 多态 Polymorphism

    GRASP原则六: 多态 Polymorphism  How to handle alternative behaviors based on type 如何处理依据类型不同而有 不同行为的一类需求 ...

  5. 7.4 GRASP原则四:控制器 Controller

    4.GRASP原则四:控制器 Controller  What first object beyond the UI layer receives and co-ordinates (control ...

  6. 7.1 通用的职责分配软件原则 GRASP原则一: 创建者 Creator

    1.GRASP原则一: 创建者 Creator  Who should be responsible for creating a new instance of some class 由谁来负责创 ...

  7. Effective C# 学习笔记(原则二:为你的常量选择readonly而不是const)

    原则二.为你的常量选择readonly而不是const      Prefer readonly to const 对于常量,C#里面有两个不同的版本:运行时常量(readonly)和编译时常量(co ...

  8. 7.9 GRASP原则九: 隔离变化

    GRASP原则九: 隔离变化  Protected Variations  需求一定会变化的!如何做到以系统的局部变化为代价就可以应对这一点?4.1 GRASP rule9: Protected ...

  9. 7.8 GRASP原则八: 间接 Indirection

    GRASP原则八: 间接 Indirection  若两个对象直接连接,导致耦合太紧,如何解决?3.1 GRASP rule8: Indirection 间接  Name: Indirection ...

随机推荐

  1. [redis] 与redis cluster有关的学习笔记

    主要是以下三个官方文档,只略读了前两个,第三个还没有读. <redis cluster tutorial> <redis sentinel> <redis cluster ...

  2. h5新增标签及css3新增属性

    - h5新增的标签 新增元素 说明 video 表示一段视频并提供播放的用户界面 audio 表示音频 canvas 表示位图区域 source 为video和audio提供数据源 track 为vi ...

  3. git常用操作命令使用说明

    设置用户名和邮箱 git config --global user.email 'xxx' git config --global user.name 'xxx' 创建分支 git branch xx ...

  4. Redis入门到高可用(十五)—— GEO

    一.简介 二.应用场景 三.API 1.geoadd 2.geopos 3.geodist 4.georadius 四.相关说明

  5. python进阶之 网络编程

    1.tcp和udp协议的区别 TCP协议 面向连接\可靠\慢\对传递的数据的长短没有要求 两台机器之间要想传递信息必须先建立连接 之后在有了连接的基础上,进行信息的传递 可靠 : 数据不会丢失 不会重 ...

  6. node Sream

    const fs = require('fs'); let readerStream = fs.createReadStream('input.txt'); let writerStream = fs ...

  7. 小程序 navigator 无法跳转 tabBar上的页面

    解决方法一: navigator 的 open-type 设置为 switchTab 解决方法二: 使用 wx.switchTab({ url: ‘../cart/index’ }) 进行跳转

  8. git pull 冲突拉取不到新的代码

    本地文件已经有冲突或者在pull的过程中拉取的文件和本地文件冲突时,拉取不到新的代码,git pull出现报错,如下: 这个时候,如果你有两种选择,如果你需要这些改动,那个你就需要手动解决冲突,然后a ...

  9. CentOS 7 搭建CA认证中心实现https取证

    CA认证中心简述 CA :CertificateAuthority的缩写,通常翻译成认证权威或者认证中心,主要用途是为用户发放数字证书 功能:证书发放.证书更新.证书撤销和证书验证. 作用:身份认证, ...

  10. Select input 两个元素的宽度高度跟设定值不一致的问题

    在做登录框的时候,需要一个select 元素作为账号输入,一个input作为密码输入框.在css 文件中,将这两个元素的position 设置为relative ,并且width 设置为100%.刷新 ...