What is a class invariant?

  • Authors:
  • Adam Brooks Webber

  • Affiliations:
  • Webber Labs and University of Wisconsin - Milwaukee

  • Venue:
  • PASTE '01 Proceedings of the 2001 ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineering
  • Year:
  • 2001

Quantified Score

Hi-index 0.00

Visualization

Abstract

This paper is a progress report on our research into the problem of automatically identifying and using class invariants in object-oriented programs. We introduce an example of a class invariant in Java, and review applications for class invariants in software engineering tools and in compiler optimization. We then focus on an elementary problem of definition: what is a class invariant? This question gives an interesting perspective on programming language design. We conclude that there are many reasonable categories of class invariants, and that the problem of finding good definitions cannot be solved by a thought experiment. The only way to choose good categories is to experiment with the analysis of real programs, to see which categories of class invariant are actually useful. Our current research focuses on these experiments.