Files in this item

FilesDescriptionFormat

application/pdf

application/pdfimmutator.pdf (476Kb)
Main articlePDF

Description

Title:Refactoring for Immutability
Author(s):Kjolstad, Fredrik Berg; Dig, Danny; Acevedo, Gabriel; Snir, Marc
Subject(s):refactoring
refactoring tools
immutability
program analysis
Eclipse
program transformation
Abstract:It is common for Object-Oriented programs to contain mutable and immutable classes. Immutable classes simplify sequential programing because the programmer does not have to reason about side-effects. Immutable classes also simplify parallel programming because they are embarrassingly thread-safe. Sometimes programmers write immutable classes from scratch, other times they refactor mutable into immutable classes. To refactor a mutable class, programmers must find (i) all methods that mutate its transitive state and (ii) all objects that can enter or escape the state of the class. The programmer must also update client code to use the class in an immutable fashion. The analysis is non-trivial and the rewriting is tedious. Fortunately, this can be automated. We present Immutator, a technique and tool that enables the programmer to safely refactor a mutable class into an immutable class. Immutator also repairs client code to use the refactored class in an immutable fashion. Experience with refactoring several open-source programs shows that Immutator is useful: (i) it reduces the burden of making classes immutable, (ii) is fast enough to be used interactively, and (iii) is much safer than manual refactorings performed by open-source developers.
Issue Date:2010-06-07
Genre:Technical Report
Article
Type:Text
Language:English
URI:http://hdl.handle.net/2142/16399
Publication Status:unpublished
Peer Reviewed:is peer reviewed
Date Available in IDEALS:2010-06-07


This item appears in the following Collection(s)

Item Statistics

  • Total Downloads: 581
  • Downloads this Month: 11
  • Downloads Today: 0