Applying the Decorator Pattern for Profiling Object-Oriented Software

  • Authors:
  • Edward B. Duffy;J. Paul Gibson;Brian A. Malloy

  • Affiliations:
  • -;-;-

  • Venue:
  • IWPC '03 Proceedings of the 11th IEEE International Workshop on Program Comprehension
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

A profiler can provide valuable information to a developer to facilitate program optimization, debugging or testing. In this paper, we describe the use of the Decorator pattern for non-intrusive profiling of object-oriented applications. We provide a formal specification of the Decorator pattern, and show that the pattern can be used as a program transformation without altering the external, observable behavior of the system. We refer to such a transformation as a correctness preserving transformation, or CPT. As a CPT, the Decorator pattern can be used to non-intrusively profile object-oriented applications and we illustrate this application with an invariant validator for enforcement of Design by Contract, and for profiling memory. We provide a case study to compare the cost trade-offs of validating invariants at different points in a program.