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,面向服务架构,粗粒度.开放式.松耦合的服务结构,将应用程序 ...
随机推荐
- Sorting arrays in NumPy by column
https://stackoverflow.com/questions/2828059/sorting-arrays-in-numpy-by-column I suppose this works: ...
- phpcms9-6-0 一键getshell工具
介绍 一键化python 1.py http://xxx.com,如果是批量直接运行py文件即可 待办 [] 加入对有验证码phpcms网站的支持 [] 加入批量(已完成) 说明 依赖库的安装pip ...
- 题解——洛谷P2294 [HNOI2005]狡猾的商人(差分约束)
裸的差分约束 dfs判断负环,如果有负环就false,否则就是true 注意有多组数据,数组要清空 #include <cstdio> #include <algorithm> ...
- (转)Introduction to Gradient Descent Algorithm (along with variants) in Machine Learning
Introduction Optimization is always the ultimate goal whether you are dealing with a real life probl ...
- SPOJ 839 Optimal Marks(最小割的应用)
https://vjudge.net/problem/SPOJ-OPTM 题意: 给出一个无向图G,每个点 v 以一个有界非负整数 lv 作为标号,每条边e=(u,v)的权w定义为该边的两个端点的标号 ...
- 51nod 1215 数组的宽度(单调栈)
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1215 题意: 思路: 计算出以第i个数为最大值的区间范围,l_max[i ...
- SVN的常用功能使用教程
(一)导入项目到版本库中 1. 在SVN服务器的仓库中新建项目名称文件夹 2. 选择安装Visual SVN的本地计算机中的一个文件夹,右键选择导入,将本地项目导入到SVN服务中央仓库中 3. 输入在 ...
- NPOI导入导出EXCEL通用类,可直接使用在WinForm项目中
由于XSSFWorkbook类型的Write方法限制,Write完成后就自动关闭流数据,所以无法很好的支持的Web模式,网上目前也未找到好的解决方案. 注意:若直接使用在WinForm项目中,必需先下 ...
- bean之间的属性是怎么维护的
spring对象[bean]之间的属性是通过什么维护的: 1.构造方法:标签:constructor-arg 2.set方法:标签:property <beans xmlns="htt ...
- P2512 [HAOI2008]糖果传递
题目描述 有n个小朋友坐成一圈,每人有ai个糖果.每人只能给左右两人传递糖果.每人每次传递一个糖果代价为1. 输入输出格式 输入格式: 小朋友个数n 下面n行 ai 输出格式: 求使所有人获得均等糖果 ...