introduction
- lichpin= key ['lin(long s)pin] of teamwork
- Something literal :可以考虑在Java Collection里关于list关于defination(Specification)和implement的论述, Specification是一个标准,一个规定,一个规范,是抽象的,是difination。implement是具体的实现,是code . 就像 类 和 实例的关系。
- delegate responsibility for implementing a method withour a specification 把代码实现的活给分了,各自干一部分delegate
- acts as a contract 就像个合同,甲方和乙方。the impliementer is responsible for meeting the contract 乙方有责任实现合同的内容 a client can rely on the contract 甲方也依据合同使唤乙方
- like real legal contracts ,specifications depends on both parties.就像正式的合同,Specification取决于双方-甲方和乙方,甲方有前提,乙方有责任
- tthe role played by specifications of methos
- method’s specification的角色
- 英语有个特点哦 表示归属的定语也会放到后面
- precondition postcondition前置条件 后置条件
- exception 免责条款
- dive into 深入
*## 理解 理解 ”理“ 的是结构 ”解“的是实践中的问题
Why specifications?
-
Something literal : 应该是为了好沟通吧 只要是信息的交流 就要有协议 有一致的对字符的意义的定义 况且这里还抽象了 程序又不是一个人写的 就显而易见 实在实践中总结出来的
-
Precise specification 精确的规约 好处大大的有 spare you the agnoy 去掉大大的痛苦
-
便于甲方读代码
-
corner case极端情况
-
好像有点明白 规约的意思了 ,约是约定约束的意思,规是规定的意思, 约还有是什么变小的意思 比如 最大公约数 约分 约是相同的意思 。
-
decoupling 去耦合 ,只要遵照约定Specifiaction /contract/对权责的定义defination随便甲方乙方怎么样。
Behavioral equivalence
- 行为等价性
- our question is whether we substitude pne implementatation for the otther
- notion =concept
- in the eye of the beholder 在甲方眼中
Specification structure
Specification={clauses}
clauses 条款 contract的entry
Specification={clausese}=precondition+post condition
invoke=call
the overall structure is a logical implication 总的结构是逻辑上不显式的
the precondition does not hold前提条件不成立 the implementation is no bound by the postcondition 乙方的实现不受后置条件的约束 随心所欲 lt is free to do anything
Specifications in Java
- enforce the contracts 执行合同
- incorporate = include
- 像c语言标准 iso 99
- doed not go quite so far 还没走到这一步
- effitively part of 有力的一部分
- preceding the method 在方法前
** convention 惯例
NUll references
What a specification may talk about ?
- 突然想起来可能有个词叫 需求规约
- 应该就是 金主爸爸(甲方) 和 产品经理(乙方) 之间的contract
-
- parameters
- return value (no local …)
Testing and specifications
测试与method 规约
- black box tests / glass box tests mustfollow the specification
Testing units
… 未完待续