Title :
Contract-checking wrappers for C++ classes
Author :
Edwards, Stephen H. ; Sitaraman, Murali ; Weide, Bruce W. ; Hollingsworth, Joseph
Author_Institution :
Comput. Sci. Dept., Virginia Tech., Blacksburg, VA, USA
Abstract :
Two kinds of interface contract violations can occur in component-based software: A client component can fail to satisfy a requirement of a component it is using, or a component implementation can fail to fulfill its obligations to the client. The traditional approach to detecting and reporting such violations is to embed assertion checks into component source code, with compile-time control over whether they are enabled. This works well for the original component developers, but it fails to meet the needs of component clients who do not have access to source code for such components. A wrapper-based approach, in which contract checking is not hard-coded into the underlying component but is "layered" on top of it, offers several relative advantages. It is practical and effective for C++ classes. Checking code can be distributed in binary form along with the underlying component, it can be installed or removed without requiring recompilation of either the underlying component or the client code, it can be selectively enabled or disabled by the component client on a per-component basis, and it does not require the client to have access to any special tools (which might have been used by the component developer) to support wrapper installation and control. Experimental evidence indicates that wrappers in C++ impose-modest additional overhead compared to inlining assertion checks.
Keywords :
C++ language; data encapsulation; formal specification; formal verification; object-oriented programming; program debugging; C++ class; assertion checker; binary component; class invariant; component source code; component-based software; contract-checking wrapper; design by contract; wrapper-based approach; Assembly systems; Computer Society; Contracts; Debugging; Investments; Modular construction; Runtime; Software engineering; Software systems; Testing; 65; Index Terms- Assertion checkers; binary components; class invariants; coding techniques; debugging aids; design by contract; postconditions; preconditions; specification.;
Journal_Title :
Software Engineering, IEEE Transactions on
DOI :
10.1109/TSE.2004.80