You can do the same thing for the Contract class, as shown in Listing 3.
您可以为contract类做相同的事情,如清单3所示。
Perhaps a first-class Contract class should be created to represent the relationship between Book and Author better.
或许应该创建一个一级类Contract来更好地表示Book与Author之间的关系。
Middle-class families contract with a puller to take a child to school and pick him up; the puller essentially becomes a family retainer.
中产阶级家庭与车夫签订合同,让他送孩子去学校以及接孩子放学。车夫实际上变成了一位家仆。
One of the major benefits of Design by Contract is that it provides explicit information within the interface or class itself about expected behavior.
契约式设计的一个主要优势是,它在接口或类本身当中提供了关于预期行为的显式信息。
This interface defines the contract between the class and any of its clients.
此接口将在类与其所有使用者之间定义契约。
That way, the parameter declaration would serve as a contract between the class and its clients, and we could statically check that both obey the contract.
参数声明将充当类与其客户机之间的契约,这样我们可以静态地检查这两者是否遵守契约。
When you're writing code, think about the contract — the particular bit you're writing will expose to its client, whether it's a method, a class, or a group of interacting classes.
当编写代码时,应考虑到这个契约——您将要编写的特定内容都将暴露给它的客户机,无论此内容是一个方法、一个类,还是一个与类交互的组。
Design by Contract lets the class designer concentrate on the logic that implements the class functionality without worrying about the validity of arguments.
契约式设计让类的设计者专注于实现了类的功能性的逻辑,而不用担心实参的有效性。
Design by contract avoids extra code and improves performance, as long as all clients of a class abide by the contract.
契约式设计避免了额外的编码并提高了性能,只要所有的客户都遵守契约。
What's more, in pure DBC terms, a class that abides by DBC rules has a contract with the outside world about the internal consistency that it will maintain, which is known as the class invariant.
另外,在纯dbc术语中,遵循dbc规则的类针对其将维护的内部一致性与外部世界有一个契约,即人所共知的类不变式。
For modeling a Service Contract, you can apply the Service Contract stereotype (Figure 4) on a class or an interface.
为了对ServiceContract建模,您可以在一个类或者界面上应用Service Contract构造型(图4)。
The concept of Design by Contract allows you to define some constraints and invariants of your class. Statically typed languages have a primitive version of this.
契约设计这样的概念允许我们在类中定义一些约束和限制。
Furthermore, I'd be tempted to simply consider the entire hierarchy as one entity for now, since the remaining class, Country, only adds one contract, and frankly it's not all that exciting.
而且,现在我会倾向于把整个层次结构简单地看作一个实体,因为剩余的类Country仅仅添加了一个契约,坦白地说它并不是那样令人兴奋。
Any class that implements that interface agrees to the contract.
实现interface的所有类都遵循该契约。
Contract programming means that one class provides a contract to another — in other words: "Here is what I will do, and you don't need to know how it's done."
契约编程意味着一个类向另一个类提供一张契约——换言之:“这是我要做的工作,你不需要知道它是怎样完成的”。
Blue even allows you to extend classes dynamically and contract them (that is, remove class attributes from an extended class).
Blue甚至允许您动态地扩展类并收缩类(即移除已扩展的类的属性)。
This class fulfills the business component contract with the CAI architecture by implementing interfaces of the CAI component SPI.
这个类通过实现CAIComponentSPI的接口,使用CAI架构履行业务组件契约。
The API-contract way is to define a class known to both the throwing client and the catching harness.
API契约方式需要定义抛出异常的客户机和捕捉异常的装置都需要知道的类。
Following contract award, it would develop and integrate an advanced combat system for the new submarine class, serving as the prime contractor and systems integrator.
签订合同后,洛·马公司将为新一代潜艇开发整合先进的作战系统,并作为主承包商和系统集成商提供服务。
But in the States I think students come to class to learn as much from each other as from the teacher, and so participation is viewed positively and seen as part of the unwritten contract.
我认为,两者间最大的差别是,我们坚信课堂教学过程中,学生不但要向教授学习,更需要互相启发、分享见解,所以互动式教学是有积极意义的,也是一种美国式的约定俗成。
The endpoints specify a contract that defines which methods of the service class will be accessible through the endpoint.
端点指定了服务类通过它来访问的方法的contract。
The procurement contract for two ships of the Mistral-class is to be signed by year-end.
这两艘Mistral级舰船的采购合同将于年底前签署。
The contract specification for BankAccount includes a class-wide invariant that the balance must always be greater than or equal to zero (sorry, no overdrafts allowed!).
BankAccount的接口规范包含一个类范围的不变条件测试,即余额总要大于或等于0(对不起,不允许透支)。
There are also loop invariants and a few others, but pre contract element condit- and post-conditions and class invariants are really the basic fabric of contracts.
还有循环契约要素条件不变式等等,但前置、后置条件和类不变式是基本要素。
We use fetch to tune performance. We may use lazy to define a contract for what data is always available in any detached instance of a particular class.
我们可以采用延迟去定义一些契约,用抓取来改善性能,对某特定类的某个脱管的实例,知道有哪些数据是可以使用的。
I told you that we want first class goods. So the quality, specification and price are clarified in our contract. Do you remember those details?
当初我说过要一等品。所以合同里将质量、规格和价钱都写的很明确。你还记得吗?
Generally, such as changing the class and dropping out for a certain time all belong to the contract alteration.
现实生活中常见的转班、休学一段时间等情形属于教育合同变更范畴。
Your contract interface can also inherit this class.
您的合约介面也可以继承这个类别。
It is followed by the implementation of the new contract module in detail, including the class diagram and class methods which are derived from the requirement.
随后对新契约模块的实现做了详细的介绍,陈述了从需求推导而来的类结构图以及类的方法。
It is followed by the implementation of the new contract module in detail, including the class diagram and class methods which are derived from the requirement.
随后对新契约模块的实现做了详细的介绍,陈述了从需求推导而来的类结构图以及类的方法。
应用推荐