Transformation for class immutability

Fredrik Kjolstad, Danny Dig, Gabriel Acevedo, Marc Snir

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract

It is common for object-oriented programs to have both mutable and immutable classes. Immutable classes simplify programing because the programmer does not have to reason about side-effects. Sometimes programmers write immutable classes from scratch, other times they transform mutable into immutable classes. To transform a mutable class, programmers must find all methods that mutate its transitive state and all objects that can enter or escape the state of the class. The analyses are non-trivial and the rewriting is tedious. Fortunately, this can be automated. We present an algorithm and a tool, Immutator, that enables the programmer to safely transform a mutable class into an immutable class. Two case studies and one controlled experiment show that Immutator is useful. It (i) reduces the burden of making classes immutable, (ii) is fast enough to be used interactively, and (iii) is much safer than manual transformations.

Original languageEnglish (US)
Title of host publicationICSE 2011 - 33rd International Conference on Software Engineering, Proceedings of the Conference
Pages61-70
Number of pages10
DOIs
StatePublished - Jul 7 2011
Event33rd International Conference on Software Engineering, ICSE 2011 - Waikiki, Honolulu, HI, United States
Duration: May 21 2011May 28 2011

Publication series

NameProceedings - International Conference on Software Engineering
ISSN (Print)0270-5257

Other

Other33rd International Conference on Software Engineering, ICSE 2011
CountryUnited States
CityWaikiki, Honolulu, HI
Period5/21/115/28/11

Keywords

  • immutability
  • program transformation

ASJC Scopus subject areas

  • Software

Fingerprint Dive into the research topics of 'Transformation for class immutability'. Together they form a unique fingerprint.

Cite this