Model variables: cleanly supporting abstraction in design by contract: Research Articles

  • Authors:
  • Yoonsik Cheon;Gary Leavens;Murali Sitaraman;Stephen Edwards

  • Affiliations:
  • Department of Computer Science, University of Texas at El Paso, El Paso, TX 79902, U.S.A.;Department of Computer Science, Iowa State University, Ames, IA 50010, U.S.A.;Department of Computer Science, Clemson University, Clemson, SC 29634, U.S.A.;Department of Computer Science, Virginia Tech, Blacksburg, VA 24061, U.S.A.

  • Venue:
  • Software—Practice & Experience
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

Abstract

In design by contract (DBC), assertions are typically written using program variables and query methods. The lack of separation between program code and assertions is confusing, because readers do not know what code is intended for use in the program and what code is only intended for specification purposes. This lack of separation also creates a potential runtime performance penalty, even when runtime assertion checks are disabled, due to both the increased memory footprint of the program and the execution of code maintaining that part of the program's state intended for use in specifications. To solve these problems, we present a new way of writing and checking DBC assertions without directly referring to concrete program states, using ‘model’, i.e. specification-only, variables and methods. The use of model variables and methods does not incur the problems mentioned above, but it also allow one to write more easily assertions that are abstract, concise, and independent of representation details, and hence more readable and maintainable. We implemented these features in the runtime assertion checker for the Java Modeling Language (JML), but the approach could also be implemented in other DBC tools. Copyright © 2005 John Wiley & Sons, Ltd.