Dynamic contract layers

  • Authors:
  • Robert Hirschfeld;Michael Perscheid;Christian Schubert;Malte Appeltauer

  • Affiliations:
  • University of Potsdam, Germany;University of Potsdam, Germany;University of Potsdam, Germany;University of Potsdam, Germany

  • Venue:
  • Proceedings of the 2010 ACM Symposium on Applied Computing
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

Design by Contract (DBC) is a programming technique to separate contract enforcement from application code. DBC provides information about the applicability of methods and helps to narrow down the search space in case of a software failure. However, most DBC implementations suffer from inflexibility: Contract enforcement can only be activated or deactivated at compile-time or start-up, contracts are checked globally and cannot be restricted in their scope such as to the current thread of execution, and contracts cannot be grouped according to the concerns they relate to. In this paper, we present dynamic contract layers (DCL) for fine-grained and flexible contract management. Based on ideas from context-oriented programming, we extend DBC by a grouping mechanism for contracts, thread-local activation and deactivation of such groups, and selective contract enforcement at run-time. PyDCL, our proof-of-concept implementation of DCL, is built onto ContextPy, our COP extension for the Python programming language. We evaluate our approach by applying PyDCL contracts to the Moin-Moin Wiki framework.