Introducing 

Prezi AI.

Your new presentation assistant.

Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.

Loading content…
Loading…
Transcript

Predictability

Rename

Modern IDEs support many refactorings.

Configuration Cost

Programmers compose multiple refactorings to adapt Extract Method.

Extract Local Variable

Programmers compose refactorings to avoid configuration cost.

Our prior study revealed some of the important factors that lead to the underuse of automated refactorings.

The Illinois data set contains detailed refactoring data.

Most Eclipse users use few automated refactorings.

Extract Method

Programmers frequently invoke multiple refactorings in a short time span.

We manually inspected a sample of refactoring batches.

Inline

Programmers systematically compose automated refactorings.

Extract Local Variable

Rename

Researchers propose more automated

refactorings.

Programmers underuse the refactoring tools.

Move

Extract Method

Rename

A Compositional Paradigm of Automating Refactorings

We conducted a comparative lab study.

Need

Awareness

Naming

Invocation

Eclipse-based data collectors

  • 112,885 refactorings
  • 1,188 active UDC users

More than 1/3 of refactorings are clustered.

Change Method Signature

We decomposed refactorings into a set of primitive ones.

Predictability

Occurrences

Refactoring Composition Patterns

We conducted a survey study with 100 participants.

The existing practice inspired us to develop the compositional paradigm.

1. How frequently do multiple kinds of automated refactorings occur in a short time span?

Extract Constant

We implemented 4 refactorings in the compositional paradigm.

Lab study participants preferred compositions.

Survey participants preferred the compositional paradigm.

The Eclipse foundation data set involves many programmers.

Compositional refactoring leads to a language of refactorings.

Related Work

Domain

Sample Publications

Study Limitations

Awareness

Qualitative comparison of compositional and wizard-based.

We answered our research questions through a lab study.

The compositional paradigm is faster and more reliable.

Conclusions

Extract Method

Extract Local Variable

refactoring

batches

refactoring batch kinds

Refactoring is a common practice.

More than half of the refactorings are performed manually.

http://codingspectator.cs.illinois.edu

Participants compared the 2 tools qualitatively.

Mohsen Vakilian, Nicholas Chen, Roshanak Zilouchian Moghaddam, Stas Negara, and Ralph E. Johnson

Desired criteria of primitive refactorings

Rename

Inline

We propose a new paradigm of automating refactoring:

Extract Local Variable

Inline

Composite Refactorings

Configuration

Employee

HourlyEmployee

Extract Method

Inline

Compositional Refactoring

http://codingspectator.cs.illinois.edu

Extract Interface from type 'C' =

Some automated refactorings are underused even when programmers are aware of them.

Need

parallelism and concurrency

security

type inference

library migration

FSE'09, ICSE'09, ICSE'11

ESSoS'09

OOPSLA'04, ECOOP'05

OOPSLA'05

Convert Local Variable to Field

  • The compositional paradigm is likely to improve the utilization of automated refactorings because:

1. Are programmers likely to adopt the compositional paradigm?

[ICSE'06, FASE'12, ...]

47

34

12

8

6

1. Refactoring Closely Related Entities

2. Adapting Extract Method

3. Backtracking Refactorings

4. Composition-over-configuration

5. Multiple Refactorings on an Entity

52%

preferred compositional refactoring

getId()

getName()

getManager()

opportunity to use

Move

Rename

2. How diverse are the refactorings frequently invoked in a short time span?

[Negara et al, ECOOP 2013]

compositional

wizard-based

Wizard-based vs. Compositional

getId()

getName()

getManager()

getBiWeaklyPay()

Create new interface 'NewI' for 'C'

ease of learning

Sample

139

32

# of programmers

duration of the study

duration of programming

# of automated refactorings

  • scripting refactorings
  • analysis of refactoring batches
  • refactoring decomposition

30

3 months

> 2000 hours

> 3000

[ICSE'09, ECOOP'13]

1. Which paradigm do programmers prefer?

The second [compositional] one provides a more stepwise view, giving me more intermediate feedback, as well as an ability to run my tests at each step. This goes a long way to making sure the refactoring is the right decision.

satisfaction

Usually, I’m extracting a common superclass to remove duplication from more than one similar class, so I’d need to be able to select multiple classes.

ease of use

correctness

[Negara et al., ECOOP 2013]

Change Method Signature

Rename

Invocation

control

We show that:

[ECOOP'09]

*

Extract Method

Extract Local Variable

Rename

(

)

Declare method 'm()' in interface 'NewI'

Move constant 'c' to interface 'NewI'

3

14%

had no preference

  • 13 professional programmers
  • refactoring an open-source project
  • within-subject
  • counterbalancing
  • questionnaire
  • follow-up interview

1. Extract Superclass

2. Extract Interface

3. Pull Up

4. Push Down

  • Expressiveness
  • Predictability
  • Learnability
  • Reusability
  • Adherence to coding conventions

Pull Up

Naming

In the compositional paradigm,

designers decompose,

programmers compose.

4

  • it is natural to programmers
  • it is effective
  • it is preferred by programmers
  • Eclipse Foundation Data Set
  • Participants
  • Generalizability
  • Refactoring Tasks
  • Participant Response Bias

University of Illinois at Urbana-Champaign

Use Supertype Where Possible

SalariedEmployee

16.5

`

Usability of Refactoring Tools

2. How do programmers compare the compositional and wizard-based paradigms?

10.5

natural

Inline

Extract Local Variable

Rename

  • Convert anonymous to nested class
  • Create new supertype
  • Create new interface
  • Declare method in interface
  • Move member to supertype
  • Copy member to subtype
  • Declare method in supertype as abstract
  • Move type to new file
  • Add a parameter for expression to method
  • Generate getter/setter for field
  • Replace read/write accesses to field by getter/setter
  • Inline all references to constant/method
  • Inline only this reference to constant/method
  • Convert local variable to field
  • Extract method
  • Extract local variable
  • Rename
  • Add an accept method for 'visit(C)' to type 'C'.
  • ...

median task completion time (minutes)

http://www.eclipse.org/epp/usagedata/

15

2. Which paradigm is faster?

34%

preferred wizard-based refactoring

12

6

1,633

Total

139

Extract Constant

Rename

Trust

11

10

HourlyEmployee

SalariedEmployee

2

7

2

4

7

1

5

9

3

1

compositional

wizard-based

no preference

6

5

2

7

4

2

  • predictability
  • control
  • opportunity
  • ...
  • safety checks
  • multi-selections
  • few steps
  • ...

[TSE'11, ICSE'12]

receptive

1. compositional refactoring is to programmers.

2. programmers are to compositional refactoring through a survey study.

3. compositional refactoring is , through a lab study.

5

getId()

getName()

getManager()

getMonthlyPay()

Extract Superclass from type 'C' =

7

[ICSE'08]

getMonthlyPay()

getBiWeaklyPay()

13

  • empirical studies
  • code selection and error messages
  • refactoring auto-completion
  • drag-and-drop and multi-touch refactoring

14

[ICSE'12]

We analyzed the UDC data that was collected during 20 months from 195,105 users.

effective

16

[Vakilian et al., ICSE 2012]

I was not sure if it [the compositional refactoring tool] was seeing the full picture of the changes. Since it was stepwise [and] I’m doing [each step] one by one, I’m not sure if each of the steps is going to be integrated correctly.

*

22

  • Less is sometimes more in the automation of software evolution tasks.

The wizard gives this illusion of just doing everything for you. [...] The downside is that there were a number of options that I read and didn’t quite make sense of, and said I guess I don’t have to care about that. And, of course, I found my sorrow that that wasn’t true. It did things that I completely didn’t expect. [...] And, it doesn’t give control.

3. Which paradigm is less error-prone?

3. What are some opportunities for improving the compositional paradigm?

(

Create new superclass 'NewC' for 'C'

Move 'm' to supertype 'NewC'

)

18

[ICSE'13, SoftVis'10]

25

26

Programmers refactor frequently [Xing et al., ICSM 2006], [Murphy-Hill et al., ICSE 2009].

https://illinois.edu/fb/sec/8454746

http://codingspectator.cs.illinois.edu/compositional-refactoring/

1

7

29

# of participants who refactored incorrectly

8

30

20

9

2

Use Supertype Where Possible

19

5

24

23

28

21

27

17

Learn more about creating dynamic, engaging presentations with Prezi