6.4 操作契约 Operation Contracts
4、操作契约 Operation Contracts
“用例描述”的补充
强调: 用例中重要的动作,其开始与结束是需要一些约束
4.5 操作契约的后置条件
定义Definition
后置条件描述了领域对象状态的变化 describe changes in the state of objects in the domain model
状态变化包括
是否创建、删除了对象?instances created / deleted
对象间的关系是否发生变化?associations formed or broken
有对象的属性变化了吗?and attributes changed
为什么要后置条件? Why post-condition
也不是始终都需要的 they aren't always necessary
如果开发人员很容易明白该如何去做,就不用写操作契约了
If developers can comfortably understand what to do without them, then avoid writing contracts 操作契约比较细节地、精确地定义了一个操作应该承担的职责
契约,是面向对象分析过程中非常有用的工具
把问题说清楚、无歧义
先不考虑设计,集中于分析 what must happen 而不是how it is to be accomplished
4.6 创建后置条件
建议 Apply the following advice to create contracts
Identify system operations from the SSDs .
For system operations that are complex and perhaps subtle in their results,
or which are not clear in the use case, build a contract
To describe the postconditions, use the following categories:
instance creation and deletion
attribute modification
associations formed and broken
常见错误
描述契约
(better) A SalesLineItem was created
(worse) A SalesLineItem is created; or Create a SalesLineItem
忘记对象之间的关系发生了变化
The SalesLineItem was associated with the Sale (association formed)
4.7 后置条件 & 领域模型
后置条件体现在领域模型的对象 postconditions are expressed in the context of the Domain Model objects What instances can be created?
those from the Domain Model
What associations can be formed?
those in the Domain Model
and so on
在定义契约的过程中,经常触发对领域模型的修改
记录新的概念类、属性 ?
领域模型是否有新的关系 ?
4.8 对领域模型的修改
6.4 操作契约 Operation Contracts的更多相关文章
- 核心概念 —— 契约(Contracts)
1.简介 Laravel中的契约是指框架提供的一系列定义核心服务的接口. 例如 ,Illuminate\Contracts\Queue\Queue契约定义了队列任务需要实现的方法,Illuminate ...
- UML和模式应用5:细化阶段(6)---操作契约
1.前言 操作契约使用前置和后置条件,描述领域模型里对象的详细变化,作为系统操作的结果. 操作契约可以作为有用的OOA相关的制品. 操作契约可以视为UP用例模型的一部分,它是对用例之处的系统操作的效用 ...
- UML-如何画操作契约?
1.在编写契约过程中,发现之前的领域模型不对,此时是否需要修改? 需要修改.包括:概念类.属性.关联.这就是不断迭代和进化 2.用例中复杂场景里的状态变化细节,描述过多导致用例臃肿,让人看不下去,因此 ...
- 各种操作中心Operation Center一览
Operation Center在中国可能有很多种名称,例如指挥中心.运维室.总控中心等等,国外可能也有很多名称,不管名称如何,任何一个上规模得数据总心或者运维单位一般都有一个这样得中心,来负责所管理 ...
- PythonStudy——文件操作 File operation
# 文件:就是硬盘的一块存储空间 # 1.使用文件的三步骤: # 打开文件- 得到文件对象:找到数据存放在硬盘的位置,让操作系统持有该空间,具有操作权# 硬盘空间 被 操作系统持有# 文件对象f 被 ...
- PythonStudy——字典的操作 Dictionary operation
dic = {'a': 1, 'b': 2} print(dic) # 增: 字典名[key] = 值 => key已存在就是修改值,不存在就是新增值 dic['c'] = 3 print(di ...
- [Swift]LeetCode583. 两个字符串的删除操作 | Delete Operation for Two Strings
Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 t ...
- deferred.promise.then().then()异步链式操作(Chain operation)
//deferred.promise.then().then() deferred.promise.then(function () { console.log('1 resolve'); retur ...
- WCF基础
初入职场,开始接触C#,开始接触WCF,那么从头开始学习吧,边学边补充. SOA Service-Oriented Architecture,面向服务架构,粗粒度.开放式.松耦合的服务结构,将应用程序 ...
随机推荐
- 配置Codeblocks
1.安装mingw 官网:http://www.mingw.org/找到左边Navigation里面的Download(选择下图第一个即可,安装管理器,可自己手动选择要安装的组件)下图是安装管理器界面 ...
- php的内核组成模块和运行原理
php总共包括3个模块: php内核,zend引擎,php扩展层. 内核: 用于处理请求,文件流,错误处理等相关处理 zend引擎: 将源文件转换成机器语言(实际上是字节码opCode),然后再zen ...
- php的__autoload和php的__call
首先, __call是php语言自身就具有的一种语言features...,不是thinkphp的语言特征. 关于__call参考: http://love-love-l.blog.163.com/b ...
- Java lambda例子
简单数据类型int,跟Integer在lambda中的使用还不一样,有区别 code: package com.qhong.lambda.testDemo; import java.util.Arra ...
- ZOJ 3609 Modular Inverse(扩展欧几里得)题解
题意:求乘法逆元最小正正数解 思路:a*x≡1(mod m),则称x 是 a 关于 m 的乘法逆元,可以通过解a*x + m*y = 1解得x.那么通过EXGcd得到特解x1,最小正解x1 = x1 ...
- First Steps: Command-line
This brief tutorial will teach how to get up and running with the Flyway Command-line tool. It will ...
- Win32汇编学习(4):绘制文本
这次,我们将学习如何在窗口的客户区"绘制"字符串.我们还将学习关于"设备环境"的概念. 理论: "绘制"字符串 Windows 中的文本是一 ...
- 【基本知识】Flume基本环境搭建以及原理
系统:CentOS6.5JDK:1.8.0_144Flume:flume-ng-1.6.0-cdh5.12.0 一.什么是Flume flume 作为 cloudera 开发的实时日志收集系统,受到了 ...
- JQ插入节点方法
1.append() appendTo() prepend() prependTo() 2. before() insertBefore() after() insertAfter()
- c# 之 System.Type.GetType()与Object.GetType()与typeof比较
Object.GetType()与typeof的区别 //运算符,获得某一类型的 System.Type 对象. Type t = typeof(int); //方法,获取当前实例的类型. ; Con ...