TY - GEN
T1 - Transformation for class immutability
AU - Kjolstad, Fredrik
AU - Dig, Danny
AU - Acevedo, Gabriel
AU - Snir, Marc
PY - 2011
Y1 - 2011
N2 - 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.
AB - 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.
KW - immutability
KW - program transformation
UR - http://www.scopus.com/inward/record.url?scp=79959914773&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=79959914773&partnerID=8YFLogxK
U2 - 10.1145/1985793.1985803
DO - 10.1145/1985793.1985803
M3 - Conference contribution
AN - SCOPUS:79959914773
SN - 9781450304450
T3 - Proceedings - International Conference on Software Engineering
SP - 61
EP - 70
BT - ICSE 2011 - 33rd International Conference on Software Engineering, Proceedings of the Conference
T2 - 33rd International Conference on Software Engineering, ICSE 2011
Y2 - 21 May 2011 through 28 May 2011
ER -