ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

6.4 操作契约 Operation Contracts

2019-03-17 19:39:02  阅读:357  来源: 互联网

标签:associations 后置 created Contracts formed SalesLineItem 6.4 契约 Operation


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 对领域模型的修改

标签:associations,后置,created,Contracts,formed,SalesLineItem,6.4,契约,Operation
来源: https://www.cnblogs.com/mayZhou/p/10548440.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有