本文主要是介绍系统操作规约(System Operation Contract),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
领域建模补充
问题:
- 联系有方向性
- 属性有类型
- 领域模型尽量避免出现界面相关的东西
习题
问题
考察点
系统操作规约
示例
A)
Operation: MakeSale()
Cross References: UC:Purchase
Preconditions: User has logged in
Postconditions:
An ProductList w was created.
Attributes of w were initialized.
契约CO2
checkEnemyHealth
操作
checkEnemyHealth(enemyId)
交叉引用
无
前置条件
·角色c (Character类)和敌人e (Enemy类) 已创建
·characterAttack()或dealDamage(enemyId)操作已完成
·游戏处于“活动”状态
后置条件
返回敌人e(Enemy)的血量,精度为float
模板
CO1:
Operation:
Cross References:
Preconditions:
Postconditions:
原则性问题:
- 没有SSD的每一个系统操作编写SSC
- SOC名字对应系统操作的名字
- 部分Postcondition 和实际情况有较大差别。
解析
每个契约均为前面SSD图用户向系统发出的动作
例如
Contract CO1: Login(WorkerId, psw)
Contract CO2: AddItem()
Contract CO3: EnterItemDetails:(Name, PartitionNum, ShelfNum, LayerNum)
Contract CO4: ConfirmAddition()
Operation: 与Contract CO1相同
Cross References: 所填内容为SSD图所画的用例名
Preconditions: 前置条件
Postconditions: 后置条件
我的答案
- System Operation Contract
CO1: enterBook(BookID)
Operation: enterBook(BookID)
Cross References: UC: Borrow Books
Preconditions: ongoing book borrowing service
Postconditions: • The book whose BookID equals the parameter named BookID was associated with b.
CO2: borrowBook(BookID)
Operation: borrowBook(BookID)
Cross References: UC: Borrow Books
Preconditions: ongoing book borrowing service
Postconditions: • For all Book instances which were associated with b,
BorrowStatus became “borrowed.”
• b.dueDate was initialized.
可参考第二组的图书管理系统做法,该小组做法更严谨
这篇关于系统操作规约(System Operation Contract)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!