How Do Developers React to API Deprecation? The Case of a Smalltalk Ecosystem

Preview:

Citation preview

How Do Developers React to

API Deprecation? The Case of a Smalltalk Ecosystem

Romain RobbesDavid Röthlisberger

University of Chile

Mircea LunguSoftware Composition GroupUniversity of Bern

FSE, 2012

SoftwareEcosystemsA Natural Ecosystem

A Software Ecosystem

A collection of software systems which are developed and co-evolve in the same environment.

Dependency

size

Activity (high)

Activity (low)A Software Ecosystem

A collection of software systems which are developed and co-evolve in the same environment.

A Software EcosystemA Software Ecosystem

A collection of software systems which are developed and co-evolve in the same environment.

[...] where is MOLabelShape, why was it deleted?? I use it and now is gone!!! I even had a specialization of it [...]

FillInTheBlank(deprecated)

UIManager(recommended)

Deprecating a class in the ecosystem

Tool Support...

Tool Support...

Empirical Evidence

First!

API Changes

Classes

Methods

Providers

API Changes

Ripple-inducing changes

• addition of provider

• change of provider

• removal of provider

Classes

Methods

Providers

API Changes

Ripple-inducing changes

• addition of provider

• change of provider

• removal of provider

Classes

Methods

Providers

Deprecation of provider = lower bounds

API Deprecation:Empirical Study

1. Frequency2. Magnitude3. Duration4. Adaptation

Contributors:Projects:Classes:

Commits:LOC:

SqueakSource{ 2.3002.500

95.000110.000

600.000.0008 years

How to model the history of SqueakSource?

Added

Removed

RequiredProvided

...

Vers

ion

1

Vers

ion

2

Vers

ion

i

Vers

ion

n

...

SystemVersion

Ecosystem History

History

...

System History

...Artifacts

History

History

Ecco - a lighweight model

Added

Removed

RequiredProvided

...

Vers

ion

1

Vers

ion

2

Vers

ion

i

Vers

ion

n

...

SystemVersion

Ecosystem History

History

...

System History

...Artifacts

History

History

Methodology

1. Generate list of candidates (577 methods, 186 classes)

2. Filter methods removed less than 3 times

3. Manual inspection of the rest of the candidates

4. Answer RQ for all the true deprecation-based ripples

Manual Inspection

+Retrieve changes involving deprecation

+Display changes in Ripple Browser

+Validate impacted projects

+Track replacement methods

= 180 methods + 20 classes

x2

Results

Results}Frequency

Magnitude

Duration

Adaptations

RQ1: Frequency of ripple effects triggered by API deprecation

14% of deprecated methods triggered ripple effects.

7% of deprecated classes triggered ripple effects.

RQ1: Frequency of ripple effects triggered by API deprecation

14% of deprecated methods triggered ripple effects.

7% of deprecated classes triggered ripple effects.

⤷developers do not know their clients and program defensively

RQ1: Frequency of ripple effects triggered by API deprecation

14% of deprecated methods triggered ripple effects.

7% of deprecated classes triggered ripple effects.

⤷developers do not know their clients and program defensively

clients may still be unaware of deprecations⤷

RQ2: Magnitude of ripple effects triggered by API deprecation

reacting projects●

020

40

60

80

(i) reacting projects

●●

020

40

60

80

100

120

(ii) reacting packages

RQ2: Magnitude of ripple effects triggered by API deprecation

reacting projects●

020

40

60

80

(i) reacting projects

●●

020

40

60

80

100

120

(ii) reacting packages

⤷ the impact on the ecosystem can be very large

⤷ several projects usually react

Viewing the magnitude from other angles

Projects Packages CommitsDevelopers0

20

40

60

A project reacting to an API change ...

Viewing the magnitude from other angles

Projects Packages CommitsDevelopers

⤷may involve several developers and packages

0

20

40

60

A project reacting to an API change ...

Viewing the magnitude from other angles

Projects Packages CommitsDevelopers

⤷may involve several developers and packages

0

20

40

60

⤷ is often a process involving several commits

A project reacting to an API change ...

RQ3: Duration of ripple effects triggered by API deprecation

Adaptation time (in days)

●●

0200

400

600

800

(i) reaction Time

010

20

30

40

50

60

(ii) adaptation time

For a given project, the adaptation time is the time between the first reaction and the last reaction to the API change

RQ3: Duration of ripple effects triggered by API deprecation

Adaptation time (in days)

⤷ most projects are quick to react and adapt;but not all are

●●

0200

400

600

800

(i) reaction Time

010

20

30

40

50

60

(ii) adaptation time

For a given project, the adaptation time is the time between the first reaction and the last reaction to the API change

RQ3: Duration of ripple effects triggered by API deprecation

Adaptation time (in days)

⤷ most projects are quick to react and adapt;but not all are

●●

0200

400

600

800

(i) reaction Time

010

20

30

40

50

60

(ii) adaptation time

For a given project, the adaptation time is the time between the first reaction and the last reaction to the API change

⤷ On the scale of the ecosystem, some ripple effects lasted for years.

RQ4: Do all projects adapt to API changes?

All Activeprojects

No counter-reactions

0

18

35

53

70

20%

40%

66%

RQ4: Do all projects adapt to API changes?

All Activeprojects

No counter-reactions

0

18

35

53

70

20%

40%

66%

Why so fewreacting projects?

RQ4: Do all projects adapt to API changes?

All Activeprojects

No counter-reactions

0

18

35

53

70

20%

40%

66%

Dead or stagnant projects?

Why so fewreacting projects?

RQ4: Do all projects adapt to API changes?

All Activeprojects

No counter-reactions

0

18

35

53

70

20%

40%

66%

Why so fewreacting projects?

RQ4: Do all projects adapt to API changes?

All Activeprojects

No counter-reactions

0

18

35

53

70

20%

40%

66%

Why so fewreacting projects?

Forks in theecosystem?

RQ4: Do all projects adapt to API changes?

All Activeprojects

No counter-reactions

0

18

35

53

70

20%

40%

66%

Why so fewreacting projects?

RQ4: Do all projects adapt to API changes?

All Activeprojects

No counter-reactions

0

18

35

53

70

20%

40%

66%

RQ4: Do all projects adapt to API changes?

All Activeprojects

⤷ common reasons for not reacting are stagnancy,forks, but also freezed dependencies and unawareness.

No counter-reactions

0

18

35

53

70

20%

40%

66%

RQ5: Consistency of adaptations

addEntity: was replaced by:

add:

addModel:

addObject:

addAll:

addSibling:

0 20 40 60 80

RQ5: Consistency of adaptations

020

40

60

80

100

Probability of most likely replacement

Frequency of most frequent replacementaddEntity: was replaced by:

add:

addModel:

addObject:

addAll:

addSibling:

0 20 40 60 80

RQ5: Consistency of adaptations

⤷ Many API deprecation have similar reactions

020

40

60

80

100

Probability of most likely replacement

Frequency of most frequent replacementaddEntity: was replaced by:

add:

addModel:

addObject:

addAll:

addSibling:

0 20 40 60 80

RQ5: Consistency of adaptations

⤷ Many API deprecation have similar reactions

020

40

60

80

100

Probability of most likely replacement

Frequency of most frequent replacementaddEntity: was replaced by:

add:

addModel:

addObject:

addAll:

addSibling:

0 20 40 60 80

16% of deprecations had a systematic replacement⤷

RQ6: Were deprecation messages useful?

foo: x self deprecated: ‘use method bar instead’

RQ6: Were deprecation messages useful?

We categorized deprecation messages according to whether developer followed the recommendation.

foo: x self deprecated: ‘use method bar instead’

RQ6: Were deprecation messages useful?

We categorized deprecation messages according to whether developer followed the recommendation.

Mostly followed: if “X” most people did X

Somewhat followed: most people did Y, but others did X

Not followed: most people did Y, Z ...

Missing: no recommendation, vague recommendation.

foo: x self deprecated: ‘use method bar instead’

RQ6: Were deprecation messages useful?

We categorized deprecation messages according to whether developer followed the recommendation.

Mostly followed: if “X” most people did X

Somewhat followed: most people did Y, but others did X

Not followed: most people did Y, Z ...

Missing: no recommendation, vague recommendation.

foo: x self deprecated: ‘use method bar instead’

self deprecated: ‘removed functionality’self deprecated: ‘use canvas API’self deprecated: ‘ugly method, do not call it!’

RQ6: Were deprecation messages useful?

Mostlyfollowed

Somewhatfollowed

Missing

0

13

25

38

50 46.8%

7.4%

40.4%

Notfollowed

5.3%

Recommendation ...

RQ6: Were deprecation messages useful?

⤷ half of deprecation messages are missing or not useful

Mostlyfollowed

Somewhatfollowed

Missing

0

13

25

38

50 46.8%

7.4%

40.4%

Notfollowed

5.3%

Recommendation ...

Threats to validity

Code duplication, name clashes introduce noise

We only consider explicit deprecation so far

Partially manual analysis

Single case study with peculiarities:– Dynamically typed language (Smalltalk)– Fork in the community

Related work

Empirical studies:– Studies of API changes and client evolution [Dig & Johnson, 2005]– Studies of ripple effects at the system level [Yau et al., 1978; Black, 2001]

Adapting to API changes:– Replaying refactorings [Henkel & Diwan 2004; Ekman & Asklund 2005; Dig et al. 2007]– Detecting systematic changes [Kim and Notkin 2009]– Adapting to evolving frameworks [Dagenais & Robillard 2008; Shäfer et al. 2008]– Filtering irrelevant changes [Holmes and Walker, 2010]

Conclusions and implications

Added

Removed

RequiredProvided

...

Vers

ion

1

Vers

ion

2

Vers

ion

i

Vers

ion

n

...

SystemVersion

Ecosystem History

History

...

System History

...Artifacts

History

History

Conclusions and implications

⤷ The quality of deprecation guidelines should be improved

Added

Removed

RequiredProvided

...

Vers

ion

1

Vers

ion

2

Vers

ion

i

Vers

ion

n

...

SystemVersion

Ecosystem History

History

...

System History

...Artifacts

History

History

Conclusions and implications

⤷ The quality of deprecation guidelines should be improved

⤷ Some API deprecations have a large impact

Added

Removed

RequiredProvided

...

Vers

ion

1

Vers

ion

2

Vers

ion

i

Vers

ion

n

...

SystemVersion

Ecosystem History

History

...

System History

...Artifacts

History

History

Conclusions and implications

⤷ The quality of deprecation guidelines should be improved

⤷ Some API deprecations have a large impact

⤷ Developers do not know how their software is used

Added

Removed

RequiredProvided

...

Vers

ion

1

Vers

ion

2

Vers

ion

i

Vers

ion

n

...

SystemVersion

Ecosystem History

History

...

System History

...Artifacts

History

History

Conclusions and implications

⤷ The quality of deprecation guidelines should be improved

⤷ Some API deprecations have a large impact

⤷ Developers do not know how their software is used

⤷ Reactions to API changes can be partially automated

Added

Removed

RequiredProvided

...

Vers

ion

1

Vers

ion

2

Vers

ion

i

Vers

ion

n

...

SystemVersion

Ecosystem History

History

...

System History

...Artifacts

History

History

Conclusions and implications

⤷ The quality of deprecation guidelines should be improved

⤷ Some API deprecations have a large impact

⤷ Developers do not know how their software is used

⤷ Reactions to API changes can be partially automated

⤷ Tool support is needed to help with API changes

Added

Removed

RequiredProvided

...

Vers

ion

1

Vers

ion

2

Vers

ion

i

Vers

ion

n

...

SystemVersion

Ecosystem History

History

...

System History

...Artifacts

History

History

Conclusions and implications

⤷ The quality of deprecation guidelines should be improved

⤷ Some API deprecations have a large impact

⤷ Developers do not know how their software is used

⤷ Reactions to API changes can be partially automated

⤷ Tool support is needed to help with API changes

Added

Removed

RequiredProvided

...

Vers

ion

1

Vers

ion

2

Vers

ion

i

Vers

ion

n

...

SystemVersion

Ecosystem History

History

...

System History

...Artifacts

History

History