7.2 GRASP原则二:信息专家 Information Expert
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的更多相关文章
- 7.3 GRASP原则三: 低耦合 Low Coupling
3.GRASP原则三: 低耦合 Low Coupling How to support low dependency, low change impact and increased reuse? ...
- 运用GRASP原则来做uml交互类图-------pos机实例
重要的几个GRASP原则:1.控制器模式 2.创建者模式 (原则)3.信息专家模式(原则) 4. 高内聚 低耦合 这里所说的模式并不是java中针对具体的事件的设计模式 主成功场景的几个操作: ...
- 7.7 GRASP原则七: 纯虚构 Pure Fabrication
GRASP原则七: 纯虚构 Pure Fabrication 如果依据信息专家原则获得的解决方案不合适,既不想违反低耦合.高内聚,也不想违 反其他的原则, 该如何把职责分配给对象? 左右为难… ...
- 7.6 GRASP原则六: 多态 Polymorphism
GRASP原则六: 多态 Polymorphism How to handle alternative behaviors based on type 如何处理依据类型不同而有 不同行为的一类需求 ...
- 7.4 GRASP原则四:控制器 Controller
4.GRASP原则四:控制器 Controller What first object beyond the UI layer receives and co-ordinates (control ...
- 7.1 通用的职责分配软件原则 GRASP原则一: 创建者 Creator
1.GRASP原则一: 创建者 Creator Who should be responsible for creating a new instance of some class 由谁来负责创 ...
- Effective C# 学习笔记(原则二:为你的常量选择readonly而不是const)
原则二.为你的常量选择readonly而不是const Prefer readonly to const 对于常量,C#里面有两个不同的版本:运行时常量(readonly)和编译时常量(co ...
- 7.9 GRASP原则九: 隔离变化
GRASP原则九: 隔离变化 Protected Variations 需求一定会变化的!如何做到以系统的局部变化为代价就可以应对这一点?4.1 GRASP rule9: Protected ...
- 7.8 GRASP原则八: 间接 Indirection
GRASP原则八: 间接 Indirection 若两个对象直接连接,导致耦合太紧,如何解决?3.1 GRASP rule8: Indirection 间接 Name: Indirection ...
随机推荐
- vc关于大文件读写
http://blog.csdn.net/believefym/article/details/1162461 在做tcp发送大文件的问题时,怎么读取大文件,现在还没有这方面的需求,留作以后处理: 在 ...
- post方式接口测试(二)_参数化
一.在postman中可设置环境变量和全局变量 二.设置好后直接在请求中使用: 三.get请求,需要将参数直接出现在URL上,直接点击 Params
- word简单优化--提高效率
1.文件 ---选项---校对(去掉下面这些项) 2.点击自动更正,去掉如下 3.文件--选项--保存
- Fiddler过滤
1.REGEX:\.(js|css|js|png|gif|\?.*|css\?.*)$ 2..css .js .gif .png .jpg .swf
- com.mysql.jdbc.Driver 与 org.gjt.mm.mysql.Driver的区别
com.mysql.jdbc.Driver的前身是org.gjt.mm.mysql.Driver,现在主要用com.mysql.jdbc.Driver,但为了保持兼容性保留了org.gjt.mm.my ...
- HBase 笔记2
Hadoop 服务启动顺序: zookeeper ->journalnode->namenode -> zkfc -> datanode HBase Master WEB控制台 ...
- C#ImageList和ListView的使用
一.ImageList ImageList组件,又称为图片存储组件,它主要用于存储图片资源,然后在控件上显示出来,这样就简化了对图片的管理.ImageList组件的主要属性是Images,它包含关联 ...
- 笔记-ASP.NET WebApi
本文是针对ASP.NET WepApi 2 的笔记. Web API 可返回的结果: 1.void 2.HttpResponseMessage 3.IHttpActionResult 4.其他类型 返 ...
- phpcms首页替换
大图轮播替换 {pc:content action="lists" catid="13" order="id DESC" num=" ...
- Centos7.2 Install subversion server
l 安装svn yum install subversion l 查看svn版本 svnserve --version l 创建svn版本库目录 mkdir -p /projects/ ...