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的更多相关文章

  1. 核心概念 —— 契约(Contracts)

    1.简介 Laravel中的契约是指框架提供的一系列定义核心服务的接口. 例如 ,Illuminate\Contracts\Queue\Queue契约定义了队列任务需要实现的方法,Illuminate ...

  2. UML和模式应用5:细化阶段(6)---操作契约

    1.前言 操作契约使用前置和后置条件,描述领域模型里对象的详细变化,作为系统操作的结果. 操作契约可以作为有用的OOA相关的制品. 操作契约可以视为UP用例模型的一部分,它是对用例之处的系统操作的效用 ...

  3. UML-如何画操作契约?

    1.在编写契约过程中,发现之前的领域模型不对,此时是否需要修改? 需要修改.包括:概念类.属性.关联.这就是不断迭代和进化 2.用例中复杂场景里的状态变化细节,描述过多导致用例臃肿,让人看不下去,因此 ...

  4. 各种操作中心Operation Center一览

    Operation Center在中国可能有很多种名称,例如指挥中心.运维室.总控中心等等,国外可能也有很多名称,不管名称如何,任何一个上规模得数据总心或者运维单位一般都有一个这样得中心,来负责所管理 ...

  5. PythonStudy——文件操作 File operation

    # 文件:就是硬盘的一块存储空间 # 1.使用文件的三步骤: # 打开文件- 得到文件对象:找到数据存放在硬盘的位置,让操作系统持有该空间,具有操作权# 硬盘空间 被 操作系统持有# 文件对象f 被 ...

  6. PythonStudy——字典的操作 Dictionary operation

    dic = {'a': 1, 'b': 2} print(dic) # 增: 字典名[key] = 值 => key已存在就是修改值,不存在就是新增值 dic['c'] = 3 print(di ...

  7. [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 ...

  8. deferred.promise.then().then()异步链式操作(Chain operation)

    //deferred.promise.then().then() deferred.promise.then(function () { console.log('1 resolve'); retur ...

  9. WCF基础

    初入职场,开始接触C#,开始接触WCF,那么从头开始学习吧,边学边补充. SOA Service-Oriented Architecture,面向服务架构,粗粒度.开放式.松耦合的服务结构,将应用程序 ...

随机推荐

  1. Sorting arrays in NumPy by column

    https://stackoverflow.com/questions/2828059/sorting-arrays-in-numpy-by-column I suppose this works:  ...

  2. (转)ElasticSearch学习

    (二期)21.全文搜索引擎Elasticsearch [课程21]elasticsearch.xmind82.1KB [课程21]lucene.xmind0.8MB [课程21]基本用法....api ...

  3. cookie 简单用法

    cookie 简单用法 //当前登录人的组织Id HttpCookie SingleValueCookie = new HttpCookie("DepartmentId", &qu ...

  4. EDCheckPrefabRef

    using UnityEngine;using System.Collections;using UnityEditor;using UnityEngine.UI;using System.Refle ...

  5. Codeforces 85 D. Sum of Medians

    题目链接:http://codeforces.com/contest/85/problem/D 做法果然男默女泪啊..... 大概就是直接开了一个$vector$每次插入删除都用自带的$insert$ ...

  6. 【UOJ】#273. 【清华集训2016】你的生命已如风中残烛

    题目链接:http://uoj.ac/problem/273 $${Ans=\frac{\prod _{i=1}^{m}i}{w-n+1}}$$ #include<iostream> #i ...

  7. hdu 3094 A tree game 树上sg

    A tree game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Prob ...

  8. java之双缓冲的代码粘贴

    private Image offScreenImage = null; public void update(Graphics g) { if(offScreenImage == null) off ...

  9. 解决UnicodeEncodeError。python的docker镜像增加locale 中文支持

    用pandas的pd.read_excel()打开中文名的xlsx,报错,本来以为是xlrd的问题后来发现,是open()函数就报错: “UnicodeEncodeError: 'ascii' cod ...

  10. AtCoder Beginner Contest 113 D Number of Amidakuji

    Number of Amidakuji 思路:dp dp[i][j]表示经过(i, j) 这个点的方案数 然后一层一层地转移, 对于某一层, 用二进制枚举这一层的连接情况, 判断连接是否符合题意, 然 ...