The Journal of Object Technology

Search

Abstract

Program understanding is a major obstacle during program
maintenance. In an object-oriented
language, understanding an operation requires understanding its type
and its effect on the object network. The effect is particularly important
for scripting languages where there is neither class structure that
restricts the shape of an object nor any other kind of access control.
We have designed and implemented JSConTest, a tool that provides
a facility to annotate JavaScript programs with
type and effect contracts and to create random tests out of the
contracts. Run-time monitoring for contracts is
implemented with a program transformation.
The effect of an operation is described by access permissions, which
abstract sets of access paths along which the operation reads or writes object
properties. Type contracts can also be used to drive guided random
testing of the program.
JSConTest contains an algorithm for computing access permissions from
a set of access paths obtained by running the program.
The main ingredient of the algorithm is a novel heuristic that
produces precise and concise results without user interaction.
It has been applied to a range of examples with encouraging results.