What is the Contract® design?

Design by Contract® is a method used to develop software that relies on the creation of a well -defined interface or contract parameters for all parts of the program. Although Contract®'s design can be considered a style of conceptual development that is implemented through documentation or modeling, it is more used to indicate a native or third party mechanism in some programming languages ​​that actually require the implicit encoding of contracts within the program. The aim of using Design by Contract® is that the program will be developed and finally coded in a much more complete way that removes more trivial errors, while promoting contracts by supporting language makes it easy to find and captured residual errors. A program that uses contracts for functions and classes can have a modular design in which individual classes can be reused in other programs for a clear definition of their contracts.

Propraract® Programming Philosophy's Basisthe real world contracts. In this model, each method and a class in an object -oriented program defines a contract, which must be followed by any other method or object that interacts with it. Each class can also have a contract called invariant class that it must follow internally to ensure that external contracts do not endanger its ability to function.

The two parts of the contract that are most important during design and coding are the prerequisites and post-kontice. These two parts of the design according to the Contract® model define the status of the program before calling the method and the status of the program after completion of the method. Other parts of the contract may vary by implementing, but may include cross references to other modules, synchronization conditions and order requirements.

By developing contracts for each class and method, the interaction of different parts of the program can be easily mapped and predicted. Recovery of contracts, whether by means of claims or other mechanismsIt also ensures that the program does not attempt to make a breach of contracts, because any output created in this state would be equally invalid. In implementation as a native language function, Design by Contract® can help ensure that the final product works as expected with a small chance of unforeseen errors.

Some complications that come using Contract® philosophy design include longer design times and more detailed development of the system before the start of coding, which can sometimes be difficult with a large project. It is practically more practical, the mechanism of validation of the contract used in the programming language that natively supports contracts can slow the program. Poor understanding of TNAVRH according to Contract® methodology can lead to a program that uses contracts to carry out basic error control, which potentially leads to an application that is prone to sudden accident.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?