Programming with assertions -

Programming with assertions

An assertion is a formal constraint on the behavior of a software application. Programmers commonly write such a constraint as an annotation, and it usually describes what the application is supposed to do, rather than how the application should do it.

An effective assertion does not restate code statements but rather states an important property of the application, succinctly and unambiguously. The use of assertions originated, of course, in the procedural language realm, where programmers use them to do the following:

• specify preconditions on a function,
• specify postconditions on a function,
• place constraints on the function’s return value, or
• specify a constraint on an intermediate state of a function

The advantage gained in using assertions is that they provide a basis for determining if a program is correct:

Developers have deployed assertions in applications written in procedural and object-oriented languages. Because the types of assertions deployed in procedural software are, for the most part, a subset of those in object-oriented software, Our main focus in this paper is its used in object-oriented languages. .

Here, we provide a prospectus on programming with assertions, including a summary of their important features and the prospects of exploiting assertions to improve software applications.

To read this external content in full, download the complete paper from the author’s article archives at Clemson University.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.