Determining Coupling In JavaScript Using Object Type Inference

Printer-friendly version

Publication Type:

Conference Paper

Source:

Proceedings of the 13th International Working Conference on Source Code Analysis and Manipulation (SCAM13) (2013)

Keywords:

abstract interpretation, analysis, coupling, javascript, metrics, type inference

Abstract:

<p>Coupling in an object-oriented context is often defined in terms of access to instance variables and methods of other classes. JavaScript, however, lacks static type informa- tion and classes, and instead features a flexible object system with prototypal inheritance. In order to determine coupling in JavaScript, we infer object types based on abstract interpretation of a program. Type inference depends on both structure and behavior of objects, and common patterns for expressing classes and modules are supported. We approximate a set of accessed types per function, and classify every access as either local or foreign. Examples demonstrate that our object type inference, together with some additional heuristics concerning property access, enable determining coupling in JavaScript in a meaningful way.</p>