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 ...
随机推荐
- Windows10 家庭版 关闭Windows defender
管理员权限打开cmd,输入下面命令: reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender&quo ...
- Centos7下搭建LAMP环境,安装wordpress(不会生产博客,只是一名博客搬运工)(菜鸟)
1.搭建MySQL数据库 安装MariaDB yum install mariadb-server -y 启动MySQL服务 emctl start mariadb #启动服务 emtcl enabl ...
- MongoDB 备份(mongodump)与恢复(mongorestore)
MongoDB 备份(mongodump)与恢复(mongorestore) 备份:使用mongodump命令导出所有数据库到指定目录 参数说明: --host:MongoDB所在服务器IP. -- ...
- python tkinter Label
"""小白随笔,大佬勿喷""" #Label标签 用于可显示文本或图片,不可编辑 import tkinter as tk #初始化窗口 w ...
- python基础(8)-装饰器函数&进阶
从小例子进入装饰器 统计一个函数执行耗时 原始版本 import time # time模块有提供时间相关函数 def do_something(): print("do_something ...
- 【JVM】-NO.110.JVM.1 -【JDK11 HashMap详解】
Style:Mac Series:Java Since:2018-09-10 End:2018-09-10 Total Hours:1 Degree Of Diffculty:5 Degree Of ...
- node 解析图片二维码的内容
const {readFile, readFileSync} = require('fs'); const decodeImage = require('jimp').read; const qrco ...
- form提交所有数据
HTML: <div class="panel"> <div class="panel-body"> <h3>完善简历< ...
- matlab之导入txt文件并取其中一列数据
1.我想导入下面这个文件的内容,并且获取这个文件中的两列数据. 2.首先确保Matlab当前所在文件夹为txt文件所在文件夹,然后命令行执行: X = load('2019_03_21_08_59_0 ...
- sql 小技巧
declare @pids varchar(max)='' ),pid)+','+@pids from product where pname like '%red%' select @pids