7.8 GRASP原则八: 间接 Indirection
GRASP原则八: 间接 Indirection
若两个对象直接连接,导致耦合太紧,如何解决?
3.1 GRASP rule8: Indirection 间接
Name: Indirection
Problem: 把职责分配到哪里可以避免两个或者多个对象之间的 直接耦合?如何解耦对象以保持较高的可重
用性?
Where to assign a responsibility to avoid direct coupling between two or more objects? How to
de-couple objects so that reuse potential remains higher
Solution: 把职责分配给一个中介对象,隔离对象与其他构件或 者服务,使它们不产生直接耦合
Assign the responsibility to an intermediate object to mediate between other components or services
so that they are not directly coupled
因为中介对象是一种特殊的作用,一般对象与中间对象之间的直接耦合, 相对比较简单
7.8 GRASP原则八: 间接 Indirection的更多相关文章
- 7.6 GRASP原则六: 多态 Polymorphism
GRASP原则六: 多态 Polymorphism How to handle alternative behaviors based on type 如何处理依据类型不同而有 不同行为的一类需求 ...
- 7.1 通用的职责分配软件原则 GRASP原则一: 创建者 Creator
1.GRASP原则一: 创建者 Creator Who should be responsible for creating a new instance of some class 由谁来负责创 ...
- 运用GRASP原则来做uml交互类图-------pos机实例
重要的几个GRASP原则:1.控制器模式 2.创建者模式 (原则)3.信息专家模式(原则) 4. 高内聚 低耦合 这里所说的模式并不是java中针对具体的事件的设计模式 主成功场景的几个操作: ...
- 7.9 GRASP原则九: 隔离变化
GRASP原则九: 隔离变化 Protected Variations 需求一定会变化的!如何做到以系统的局部变化为代价就可以应对这一点?4.1 GRASP rule9: Protected ...
- 7.7 GRASP原则七: 纯虚构 Pure Fabrication
GRASP原则七: 纯虚构 Pure Fabrication 如果依据信息专家原则获得的解决方案不合适,既不想违反低耦合.高内聚,也不想违 反其他的原则, 该如何把职责分配给对象? 左右为难… ...
- 7.5 GRASP原则五:高内聚 High Cohesion
GRASP原则五:高内聚 High Cohesion How to keep objects focused, understandable and manageable, and as a si ...
- 7.4 GRASP原则四:控制器 Controller
4.GRASP原则四:控制器 Controller What first object beyond the UI layer receives and co-ordinates (control ...
- 7.3 GRASP原则三: 低耦合 Low Coupling
3.GRASP原则三: 低耦合 Low Coupling How to support low dependency, low change impact and increased reuse? ...
- 7.2 GRASP原则二:信息专家 Information Expert
2.GRASP原则二:信息专家 Information Expert What is a general principle of assigning responsibility to obje ...
随机推荐
- spark优化设置
->>>配置参数优化 SparkConf sc = new SparkConf().setAppName("com.sp.test.GroupTop3").set ...
- qmp的简单使用
QMP是一种基于JSON格式的传输协议,可使用QMP与一个QEMU虚拟机实例进行交互,例如查询虚拟机的相关状态等,以下就QMP的使用进行简单介绍. 可以通过libvirt向一个运行的虚拟机发送qmp命 ...
- JavaScript 模拟 Dictionary
function Dictionary() { var items = {}; //判断是否包含Key值 this.has = function(key) { return key in items; ...
- python基础(10)-匿名函数&内置函数
匿名函数 例子 返回两个数的和 def add(x, y): return x + y # 等价于 add = lambda x, y: x + y 返回字典中值最大的key dic = {'a': ...
- JAVA基础——集合——HashMap
HashMap集合: 常用方法(JDK1.8): 从此映射中移除所有映射关系(元素): public void clear() 返回此 HashMap 实例的浅表副本:并不复制键和值本身: p ...
- java代码操作solr搜索引擎的增删查改
所需的包如图: 代码如下:package solr; import java.util.List;import java.util.Map; import org.apache.solr.client ...
- Struts2重要知识点总结
一.interceptor拦截器的使用 第一种情况(指定action使用该拦截器):struts.xml文件的配置: <interceptors> <interceptor name ...
- appium元素获取
查看安卓手机的界面元素: 1.打开模拟器: 2.启动服务: 在cmd 输入: adb connect 127.0.0.1:62001 回车 可以输入 adb devices 查看启动状态 3.在a ...
- Exercise about Shape
#include <iostream> using namespace std; class point { int x; int y; public : point () { x=y=; ...
- UI框架搭建DAY2
今天的主要任务是完善NormalPanel, 搭建PopupPanel. 在编写PanelManager的过程中,发现了一个bug.昨天把panelPath直接传给了ResourceManager.G ...