Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

28
Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough? Andrzej Olszak and Bo Nørregaard Jørgensen

description

CSMR'12

Transcript of Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

Page 1: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

Modularization of Legacy Features by Relocation and Reconceptualization:

How Much is Enough?

— ―

Andrzej Olszak and Bo Nørregaard Jørgensen

Page 2: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

Agenda

I. Prologue: The Case of NDVisII. Relocation & ReconceptualizationIII. Experimental DesignIV. Results

— 2 —

Page 3: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 3 —

Prologue

“Can you help us to migrate NDVis to the NetBeans Module System?”

Page 4: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 4 —

Dividing the monolith

Module System ≠ modularity Features are great candidates for

Modules!Feature is the unit of program functionality

…but getting there is difficult

 

 

Page 5: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 4 —

Dividing the monolith

Module System ≠ modularity Features are great candidates for

Modules!Feature is the unit of program functionality

…but getting there is difficult

Cont ro l l e r

Mode l

View

feature A feature B feature C

 

 

Page 6: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 4 —

Dividing the monolith

Module System ≠ modularity Features are great candidates for

Modules!Feature is the unit of program functionality

…but getting there is difficult

Cont ro l l e r

Mode l

View

feature A feature B feature C

 

 

Page 7: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 4 —

Dividing the monolith

Module System ≠ modularity Features are great candidates for

Modules!Feature is the unit of program functionality

…but getting there is difficult

Cont ro l l e r

Mode l

View

feature A feature B feature C

Scattering

 

Page 8: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 4 —

Dividing the monolith

Module System ≠ modularity Features are great candidates for

Modules!Feature is the unit of program functionality

…but getting there is difficult

Cont ro l l e r

Mode l

View

feature A feature B feature C

Scattering

Tangling

Page 9: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 4 —

Dividing the monolith

Module System ≠ modularity Features are great candidates for

Modules!Feature is the unit of program functionality

…but getting there is difficult

Cont ro l l e r

Mode l

View

feature A feature B feature C

Scattering

Tangling

Page 10: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 5 —

The case of NDVis

Mixin layers, aspects, etc. “Let’s stick to Java”

Independent feature-modules Reusable core modules

+ →

NDVis monolith

Featureous tool

Page 11: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 6 —

“Can we learn more about these restructurings?”

Page 12: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 7 —

Treatment of classes! Relocation

i.e. move-class refactoring Simple Automatable Classes remain tangled

         

pkg2

pkg1

feature A feature B feature C

Page 13: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 7 —

Treatment of classes! Relocation

i.e. move-class refactoring Simple Automatable Classes remain tangled

         

pkg2

pkg1

feature A feature B feature C

→feature A feature Bfeature C

Page 14: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 7 —

Treatment of classes! Relocation

i.e. move-class refactoring Simple Automatable Classes remain tangled

         

pkg2

pkg1

feature A feature B feature C

→→

feature A feature Bfeature C

Page 15: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 7 —

Treatment of classes! Relocation

i.e. move-class refactoring Simple Automatable Classes remain tangled

Reconceptualizationi.e. move-method refactoring Complex Inherently manual Untangles classes

pkg2

pkg1

feature A feature B feature C

→→

feature A feature Bfeature C

feature B

feature A

Student

feature C

Page 16: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 7 —

Treatment of classes! Relocation

i.e. move-class refactoring Simple Automatable Classes remain tangled

Reconceptualizationi.e. move-method refactoring Complex Inherently manual Untangles classes

pkg2

pkg1

feature A feature B feature C

→→

feature A feature Bfeature C

feature B

feature A

Student

feature C

→Studentread()eat()sleep()

feature B

feature C

feature A

Page 17: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 8 —

Experimental construct

   

 

Tang

ling

in p

kgs

Scattering in pkgs

Original design

Page 18: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 8 —

Experimental construct

   

 

Tang

ling

in p

kgs

Scattering in pkgs

Original design

Manual relocation + reconceptualization

Page 19: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 8 —

Experimental construct

― Q1 ―Manual modularization vs. Max relocation?

 

 

Tang

ling

in p

kgs

Scattering in pkgs

Max relocation

Original design

Manual relocation + reconceptualization

Page 20: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 8 —

Experimental construct

― Q1 ―Manual modularization vs. Max relocation?

― Q2 ―Isolated impact of manual reconceptualization?

 

Tang

ling

in p

kgs

Scattering in pkgs

Max relocation

Original design

Manual relocation + reconceptualization

Max relocation + manual reconceptualization

Page 21: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 8 —

Experimental construct

― Q1 ―Manual modularization vs. Max relocation?

― Q2 ―Isolated impact of manual reconceptualization?

― Q3 ―Relative impact of manual reconceptualization?

Tang

ling

in p

kgs

Scattering in pkgs

Max relocation

Max reconceptualization

Original design

Manual relocation + reconceptualization

Max relocation + manual reconceptualization

Page 22: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 9 —

Q1: Automatic Relocation design

Maximum relocation No reconceptualization

Multi-objective relocation of classes in original program—Scattering—Tangling—Cohesion—Coupling

Automatic relocation significantly more efficient Time-intensity: 35 hours vs. 5 minutes

0.05 0.1 0.15 0.2 0.25 0.3

0

0.05

0.1

0.15

0.2

0.25

Scattering

Tan

glin

g

Original

Manual

Automatic

Page 23: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 10 —

Q2: Manual+Automatic design

Maximum relocation Manual reconceptualization

Multi-objective relocation of classes in manual design

Contribution of manual reconceptualization is minor

Manual approach better at selected features

0.05 0.1 0.15 0.2 0.25 0.3

0

0.05

0.1

0.15

0.2

0.25

Scattering

Tan

glin

g

Original

Manual

Manual+Automatic

Automatic

Page 24: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 11 —

Q3: Automatic Split design Maximum relocation Maximum reconceptualization

Simulated clean splits in manual design

Multi-objective relocation of classes in resulting design

Manual restructuring achieved a high degree of reconceptualization

Maximum effects of reconceptualization << relocation

0.05 0.1 0.15 0.2 0.25 0.3

0

0.05

0.1

0.15

0.2

0.25

Scattering

Tan

glin

g

Original

Manual

Manual+Automatic

Automatic

split

AutomaticStuden

tread()eat()sleep()feature

B

feature C

feature A

Page 25: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

— 12 —

Conclusions

Reconceptualization with mixin layers or aspects would not give us a lot…

Focus on relocation – reconceptualize sparingly Dynamic dependencies among features Module system constraints

Better yet: Relocate automatically before you

reconceptualize!

Page 26: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

― END ―

Page 27: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?
Page 28: Modularization of Legacy Features by Relocation and Reconceptualization: How Much is Enough?

Controller

Model

View

feature Afeature B

feature C

Treatment of classes

→→

feature Afeature B

feature C

Studentread()eat()sleep()

feature B

feature C

feature Bfeature C

Student

feature C

feature B

eat(){ if (values.length==0){ read(); return; }

this.numbers = values; number = values.length; quicksort(0, number - 1);

}

←… ←