loading...
 This Article 
   
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
39th International Conference and Exhibition on Technology of Object-Oriented Languages and Systems (TOOLS39)
Simple Support for Design by Contract in C++
Santa Barbara, California
July 29-August 03
ISBN: 0-7695-1251-8
Pedro Guerreiro, Universidade Nova de Lisboa
Abstract: Design by contract can be seen as an advanced software engineering technique for building quality software in a professional environment or as a fundamental programming concept, useful even for elementary programming. If design by contract is an afterthought, sophisticated tool support, with macros, preprocessors or patterns is acceptable. If it is to be used from the very first programs, it must not be yet another difficult obstacle to the novice programmer. This point of view seems to recommend Eiffel as the sole vehicle for the early introduction of design by contract. However, compromises are possible, if your organization mandates C++, for example. For design by contract in C++ we use a class template, Assertions , which is inherited by the classes we are specifying. This class handles preconditions, postconditions and class invariants, and supports the "old" notation. The assertions themselves are not difficult to implement, but the "old" notation, which is necessary in order to compare the value of an attribute in a postcondition with its value at an earlier stage in the function, raises interesting issues. In most common situations, using the assertions is straightforward. There are, however, more rare cases involving inheritance and recursion that must be handled with a discipline.
Citation:
Pedro Guerreiro, "Simple Support for Design by Contract in C++," tools, pp.0024, 39th International Conference and Exhibition on Technology of Object-Oriented Languages and Systems (TOOLS39), 2001
Usage of this product signifies your acceptance of the Terms of Use.