销售化妆品生产原料需要前置前置条件和后置条件件吗

另一个前置条件是运行前述约束检测算法所需的数据,要在模型中是实际可用的。
The other precondition is that the data that is needed to run the constraint-checking algorithm defined above is actually available in the model.
假设有一个具有互斥分支的循环流;每个分支都有一些应用于该分支中所有活动的前置条件和不变量。
Consider a cyclic flow that has mutually exclusive branches; each branch has preconditions and invariants that apply to all activities in the branch.
在运行时使用属性文件或API调用,可以开启或禁止所有测试,即前置条件测试、后置条件测试或者不变条件测试。
Using property files or API calls at run time, you can enable or disable all tests, just precondition tests, just postcondition tests, or just invariant tests.
类似地,默认的方法前置条件要求所有非基本的输入参数不能为空,默认的方法后置条件要求返回值不能为空。
Similarly, the default method precondition requires all input arguments that aren't primitives to be non-null, and the default method postcondition requires the return value to be non-null.
前置条件:客户为了正确调用外部组件而必须满足的责任。
Pre-conditions: Obligations that the client must fulfill in order to call the external component correctly.
用OVal为方法指定前置条件必须对方法参数进行标注。
To specify preconditions for a method with OVal, you must annotate method parameters.
对组件输入(例如传递给方法的参数)的测试叫做前置条件测试。
Tests on component inputs (such as parameters passed to methods) are called precondition tests.
这些天来,你一直在这样作,一直在签入没有检查其前置条件的代码,而这样作的结果就是某些人将要付出沉重的代价。
One of these days, you dispenser of depraved dementia, you are going to check in code that doesn't check its preconditions, and it's going to cost someone dearly!
某些派别的信徒支持使用异常来检查参数和其他的前置条件,使用错误编码来报告程序中出错的处理。
Some disciples espouse using exceptions to check parameters and other preconditions, and error codes to report processing errors within the function.
将异常处理改为断言去掉了前置条件赐予的保护膜。
Changing the exception to an assertion removed the blessed protection of the precondition tests.
功能性开发使得为方法指定前置条件和后置条件成为可能。
Among other things, functional development makes it possible to specify preconditions and postconditions of a method.
后置条件测试确保组件完成操作的时候结果符合要求,假设前置条件已经满足。
Postcondition tests are guarantees that the component promises to satisfy when it completes the operation, assuming the preconditions are met.
根据这个用例的目标,在测试用例的前置条件或者设置中还需要一些数据输入。
Depending on the goal of the use case, some data input will be required in the pre-conditions or setup of the test case.
契约实现(有前置条件、后置条件和不变量检查)。
A contract implementation (with pre-condition, post-condition, and invariants checks)
前置条件可检查构造函数或方法的调用是否得到了正确的参数。
Pre-conditions are used, for example, to verify that a constructor or a method is called using the right parameter values.
如下所示,前置条件通常作为方法体中的参数验证,如下所示
This precondition is generally used for parameter validation when entering a method’s body as in the example below
@Pre、@Post和 @Invar标注分别定义前置条件测试、后置条件测试和不变条件测试。
The @Pre, @Post, and @Invar annotations define precondition, postcondition, and invariant tests, respectively.
Jacobson的方法涉及一系列进入和退出的准则,分别被称作前置条件和后置条件,和一个称为事件流的核心准则。
Jacobson's method involves a set of entry and exit criteria called pre-conditions and post-conditions respectively, and a core criteria called the flow of events.
前置条件和后置条件方法可以看到作为函数参数 (args)传递的值。
The pre-condition and post-condition methods can also see the values passed as function arguments (args).
前置条件测试由before建议处理,该建议就在对应的方法执行连接点之前执行。
Precondition tests are handled by before advice, which is executed just before the corresponding method execution join point.
withdraw()有额外的前置条件,要求取款的数额不能超过现有余额。
withdraw() has the additional precondition requirement that the amount can't exceed the existing balance.
在本例中,只要是我指定了OVal约束条件的地方,在OVal代码中定义的逻辑就会编入我的代码,进而充当起前置条件和后置条件。
In this case, everywhere I specify an OVal constraint, the logic defined in OVal code will be weaved into my code, thus acting like preconditions and postconditions.
这就与我们在调用main之前需要确认的很多前置条件的概念吻合了。
This matches our concept of a number of pre-conditions we want to make sure of before calling the main code.
合约还有几个前置条件,要求客户传递给withdraw()和deposit()的参数大于或等于0。
The contract also has preconditions that require clients to pass in an amount greater than or equal to zero to both withdraw() and deposit().
可以将断言语句作为方法的前置条件或后置条件来添加。
You can add assertion statements as the pre- or post-conditions of a method.
为了能够表达消息的语义,以及它们对系统状态的影响,我们引入了前置条件和后置条件。
To be able to express semantics of messages and their effects on system state we introduced pre- and postconditions.
请注意,它是一个非常简单的类,几乎所有函数都有前置条件。
Please note that this is a very simple class, with preconditions on almost all its functions.
当然对含有部份函数的每个表示式,您必须核实参数是否满足对应的前置条件。
You must of course verify , for every expression involving partial functions, that the arguments satisfy the corresponding preconditions.
应该接收同样的参数,返回同样类型,并且遵循同样的前置条件和后置条件。
It should take the same parameters, return the same type, and obey the same preconditions and postconditions.
我们将会学习后置条件,类不变式,ADT前置条件和公理的其它非适用性的具体形式,作为断言和契约设计讨论的一部分。
Postconditions, class invariants and other non-applicative avatars of an ADT's preconditions and axioms will be studied as part of the discussion of assertions and Design by Contract.
$firstVoiceSent
- 来自原声例句
请问您想要如何调整此模块?
感谢您的反馈,我们会尽快进行适当修改!
请问您想要如何调整此模块?
感谢您的反馈,我们会尽快进行适当修改!C/C++(57)
软件工程(39)
用 NVI 模式来实现契约的前置条件、后置条件和不变式
参考书[1]中的&简单栈&的例子是用 Eiffel 语言写的。
下面的例子是我在C++中用 NVI 模式[2]来实现契约的前置条件、后置条件和不变式。
////////////////////////////////////////////////////////////////////////////////
// 负责表示一个简单的栈
template&class T&
class CSimpleStack
&&& virtual ~CSimpleStack(void){}
&&& // 基本查询: 栈中元素数目
&&& int Count(void)const
&&&&&&& return DoCount();
&&& // 基本查询: 逻辑位置为i的元素,栈顶逻辑位置是Count()-1
&&& T ItemAt(int i)const
&&&&&&& ASSERT(i&=0 && i&Count()); // 前置条件
&&&&&&& T ret = DoItemAt(i);
&&& // 派生查询: 栈是否为空
&&& bool IsEmpty(void)const
&&&&&&& bool ret = DoIsEmpty();
&&&&&&& ASSERT(ret == (Count()==0)); // 后置条件
&&& // 派生查询: 查询栈顶元素
&&& T Item(void)
&&&&&&& ASSERT(Count()&0); // 前置条件
&&&&&&& T ret = DoItem();
&&&&&&& ASSERT(ret == ItemAt(Count()-1); // 后置条件
&&& // 创建命令: 初始化
&&& void Init(void)
&&&&&&& DoInit();
&&&&&&& ASSERT(Count()==0); // 后置条件
&&& // 其他命令: 将t压入栈顶
&&& void Put(T t)
&&&&&&& int nOldCount = Count();
&&&&&&& DoPut();
&&&&&&& ASSERT(Count()==nOldCount+1);&& // 后置条件
&&&&&&& ASSERT(ItemAt(Count()-1) == t); // 后置条件
&&&&&&& ASSERT(Invariant());&&&&&&&&&&& // 不变式
&&& // 其他命令: 移除栈顶元素
&&& void Remove(void)
&&&&&&& ASSERT(Count()&0);&&&&&&&&&&& // 前置条件
&&&&&&& int nOldCount = Count();
&&&&&&& DoRemove();
&&&&&&& ASSERT(Count()==nOldCount-1); // 后置条件
&&&&&&& ASSERT(Invariant());&&&&&&&&& // 不变式
&&& // 不变式
&&& bool Invariant(void)
&&&&&&& return Count()&=0;
&&& virtual int&&&& DoCount(void)const = 0;
&&& virtual T&&&&&& DoItemAt(int i)const = 0;
&&& virtual bool&&& IsEmpty(void)const = 0;
&&& virtual T&&&&&& DoItem(void)const = 0;
&&& virtual T&&&&&& DoInit(void) = 0;
&&& virtual void&&& DoPut(void) = 0;
&&& virtual void&&& DoRemove(void) = 0;
按契约式设计,上面的这段代码带来很多好处,简单枚举一下:
1 自释义,写继承类的人可以很清楚自己需要达到的目标;
2 自动验证,不正确的实现很容易暴露出来;
3 减少了单元测试的工作。
1 Design by Contract,by Example Richard Mitchell,Jim McKim,Addison-Wesley
&&&&& 中文版 Design by Contract 原则与实践 Richard Mitchell,Jim McKim& 译者:孟岩 人民邮电出版社
2 http://acloudblog./.html
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:99074次
积分:1909
积分:1909
排名:千里之外
原创:85篇
评论:35条
(1)(1)(1)(1)(1)(1)(1)(3)(1)(2)(2)(3)(11)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(1)(2)(2)(1)(3)(1)(1)(1)(1)(1)(2)(1)(2)(3)(1)(1)(2)(6)(2)(1)(2)(1)什么叫做后置条件
UML用例文档中,后置条件怎样描述
09-06-18 &匿名提问
什么是前置条件,什么是后置条件?什么是前置条件,什么是后置条件?还想问一下,有没有具体的测试用例.发我邮箱借鉴一下.邮箱是
请登录后再发表评论!

我要回帖

更多关于 前置条件 后置条件 的文章

 

随机推荐