API Protocol Compliance in Object-Oriented Software
Abstract:
Modern software development is highly reliant on reusable APIs. APIs often define usage protocols that API clients must follow in order for code implementing the API to work correctly. Loosely speaking, API protocols define legal sequences of method calls on objects. In this work, protocols are defined based on typestates Strom and Yemini, 1986 DeLine and Fahndrich, 2004b. Typestates leverage the familiar intuition of abstract state machines to define usage protocols. The goal of this work is to give developers comprehensive help in defining and following API protocols in object-oriented software. Two key technical contributions enable the proposed approach 1 Object state spaces are defined with hierarchical state refinements. Hierarchical state spaces make specifications more succinct, elegantly deal with subtyping, express uncertainty, and enable more precise reasoning about aliasing. 2 A novel abstraction, called access permissions, combines typestate and aliasing information. Access permissions capture developers design intent regarding API protocols and enable sound modular verification of API protocol compliance while allowing a great deal of flexibility in aliasing objects.