Withdraw
Loading…
Refactoring for Immutability
Kjolstad, Fredrik Berg; Dig, Danny; Acevedo, Gabriel; Snir, Marc
Loading…
Permalink
https://hdl.handle.net/2142/16399
Description
- Title
- Refactoring for Immutability
- Author(s)
- Kjolstad, Fredrik Berg
- Dig, Danny
- Acevedo, Gabriel
- Snir, Marc
- Issue Date
- 2010-06-07
- Keyword(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.
- Type of Resource
- text
- Language
- en
- Permalink
- http://hdl.handle.net/2142/16399
Owning Collections
Manage Files
Loading…
Edit Collection Membership
Loading…
Edit Metadata
Loading…
Edit Properties
Loading…
Embargoes
Loading…