Introducing 

Prezi AI.

Your new presentation assistant.

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

Loading…
Transcript

Modern IDEs support many refactorings.

Refactoring is a common practice.

We recruited 26 programmers.

Programmers underuse the refactoring tools.

Our data collectors captured detailed refactoring data.

We conducted a field study.

There is interest in automating more refactorings.

Need

Unsafe Refactorings

4 of the 15 most frequent refactoring messages

10 external

We asked the interviewees three questions about each refactoring.

Reviving Automated Refactoring

http://codingspectator.cs.illinois.edu

26 programmers

Unjustified Uses

Preview

Programmers compose refactorings.

Configuration

Most UDC users use few automated refactorings.

11 grads

Lab study participants preferred compositions.

Eclipse Usage Data Collector (UDC)

Implications

Qualitative comparison of compositional and wizard-based.

Implications

Awareness

Complexity

16 internal

Mohsen Vakilian

Our analysis revealed several refactoring composition patterns.

Light-weight methods of invoking refactorings are popular.

Naming

Limitations

Domain

Sample Publications

Qualitative

Quantitative

Survey participants preferred the compositional style.

Predictability

We characterized the use, disuse, and misuse of automated refactorings.

5 interns

CodingTracker

CodingSpectator

Trust in refactoring tools is highly influenced by usability.

E-mail: mvakili2@illinois.edu

Complexity Ratings:

Prior studies found an underutilization rate of about 90% [Murphy-Hill et al., ICSE 2009].

Type Message Count Performed (%)

Refactorings

Extract Constant, Local Variable, or Method

Inline Constant, Local Variable, or Method

Pull Up

Push Down

Conclusions

Implications

Performed Count

821

283

9

8

http://codingspectator.cs.illinois.edu

Twitter: @MohsenVakilian

  • 82% of the configuration times were at most 8 seconds.
  • Average configuration time of Push Down = 39 seconds

Eclipse-based data collectors

Semi-structured interviews

In addition to being fast and reliable, automated refactorings should be predictable.

Disuse

  • Other IDEs should support Quick Assist.
  • Quick Assist should be tied to smell detectors for more visibility.

parallelism and concurrency

security

type inference

library migration

FSE'09, ICSE'09, ICSE'11

ESSoS'09

OOPSLA'04, ECOOP'05

OOPSLA'05

http://codingspectator.cs.illinois.edu

Use

Misuse

opportunity to use

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.

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.

"Generally, I don't try them if I don't know what they do. I might occasionally try them if I can kind of guess what they do even though I'm not sure, but I don't do that very often."

ease of learning

1. Did you know that Eclipse supported this refactoring?

2. Do you know what this automated refactoring does?

3. Do you ever perform this refactoring manually? Why?

# of survey respondents

2

4

11

7

satisfaction

correctness

ease of use

  • Exchange of programmers' knowledge can raise their awareness.
  • We need alternative methods for reviewing refactorings.
  • Programmers prefer seamless configuration of refactorings.

# of years of programming

1-2

2-5

5-10

> 10

Parasuraman and Riley, "Humans and Automation: Use, Misuse, Disuse, Abuse," J. Human Factors and Ergonomics Soc., 1997

control

  • Quick Assist (QA): 35%
  • QA except Rename: 65%
  • 6 interviewees knew about QA.

Count

1,499

1,094

281

Count (%)

52

38

10

Complexity

Simple

Moderate

Complex

The data set consists of a total of 112,885 refactorings events from 1,188 active UDC users.

  • Some participants were at the university.
  • The participants' numbers of programming hours varied.
  • There is a low chance of Hawthorne effect.
  • We instrumented 23 out of 33 refactorings
  • We fixed bugs in our data collectors and Eclipse.
  • Our study was specific to Java and Eclipse.

52%

preferred compositional refactoring

  • The rate of refactoring false warnings should be reduced.
  • Validating refactorings can improve their safety.
  • Trainers should warn about excessive trust.

Even though refactoring tools have bugs [FSE'07, OOPSLA'08, bug repositories], they are highly reliable.

of 26 automated refactorings were unknown to the majority of our interviewees, e.g. Move Instance Method.

9

1. Refactoring Closely Related Entities

2. Adapting Extract Method

3. Backtracking Refactorings

4. Composition-over-configuration

5. Multiple Refactorings on an Entity

University of Illinois at Urbana-Champaign

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

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

"[...] If it affects only one file then I kind of know exactly what the refactoring does and I can look at the result instantly afterwards. [...] If the thing that the [refactoring] tool does is so complicated that it isn't easy to figure out things are alright, I'm kind of discouraged to use the tool."

12%

had no preference

http://dx.doi.org/10.1109/ICSE.2012.6227190

"To me, whenever you go into these refactorings you have some dialogs and you have to figure out what it's doing [...]"

  • Refactoring automation is more than rewriting code and behavior-preservation.
  • Underuse is mostly due to usability issues, e.g., unpredictability.
  • Programmers prefer compositional refactoring tools over monolithic ones.
  • Less is sometimes more in the automation of software evolution tasks.

9

3

0

7

1

4

7

0

5

9

2

1

6

4

2

7

3

2

composition

wizard

similar

35%

preferred wizard-based refactoring

# of interviewees

lengths of interviews

9

1 hour

duration of the study

duration of programming

# of automated refactorings

3 months

1,268 hours

3,049

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

Quick Assist (CTRL+1)

Quick Assist Preview

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.

of 26 automated refactorings had names unfamiliar to the majority of our interviewees, e.g. Generalize Declared Type.

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.

7

"There is also a notion of not trusting the [refactoring] tool. If the interface of the tool is not good enough, how do I know that the implementation is not sketchy?"

Size of Automated Refactorings:

"I know that there are many refactorings. But, many times I think that it's easier to just do something manually than try to learn a very particular refactoring that does something that I don't do very often."

of 26 automated refactorings were known to but underused by the majority of our interviewees, e.g. Extract Class.

5

94

77

54

83

89

31

13

6

Code modification may not be accurate as affected resource <name> has compile errors.

Found potential matches. Please review changes on the preview page.

Selected statements contain a return statement but not all possible execution flows end in a return. Semantics may not be preserved if you proceed.

A variable with name <name> is already defined in visible scope.

Warning

Error

Error

Warning

http://hdl.handle.net/2142/30851

  • 82% affected at most 6 lines.
  • 84% affected only 1 file.

Refactoring Wizard Preview

  • 88% of refactorings with warning were performed.
  • 68% of refactorings with error were performed.

"Most of them [the automated refactorings] I know about by using Quick Assist. [...] Quick Assist will tell me if they are applicable in a certain context. [...] It always annoys me when they [automated refactorings] are not available through Quick Assist like Change Method Signature. [...] I really like Quick Assist."

"[...] I admit I don't really enjoy looking at diffs and I prefer to get a sense of the change (if it is local) by undoing/redoing, often several times."

"[...] Doing it [a refactoring] manually gives me a sense of how things have changed as a design review so that I can see the different options and reevaluate my choices."

Learn more about creating dynamic, engaging presentations with Prezi