Visually Localizing Design Problems with Disharmony Maps

Preview:

DESCRIPTION

Localizing design problems in a code city, by mapping the results of detection strategies. Presented at Softvis 2008 (Herrsching, Germany), September 2008.

Citation preview

Visually Localizing Design Problems with

Disharmony Maps

Richard Wettel and Michele LanzaREVEAL @ Faculty of Informatics,University of Lugano, Switzerland

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Overview

2

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Softwaredesign

Overview

2

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Softwaredesign

Codecities

Overview

2

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Softwaredesign

Codecities

Disharmonymaps

Overview

2

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Softwaredesign

Codecities

Disharmonymaps

Toolsupport

Overview

2

On software design

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Research around software design

4

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Research around software design

Conceptsheuristics [Riel 2000], principles [Martin 2002], patterns [Gamma et al.

1995], design harmony [Lanza & Marinescu 2006]

4

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Research around software design

Conceptsheuristics [Riel 2000], principles [Martin 2002], patterns [Gamma et al.

1995], design harmony [Lanza & Marinescu 2006]

bad smells [Fowler et al. 1998], design flaws [Marinescu 2002]

4

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Research around software design

Conceptsheuristics [Riel 2000], principles [Martin 2002], patterns [Gamma et al.

1995], design harmony [Lanza & Marinescu 2006]

bad smells [Fowler et al. 1998], design flaws [Marinescu 2002]

Techniquesdetection strategies [Marinescu 2002, Lanza & Marinescu 2006]

4

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Research around software design

Conceptsheuristics [Riel 2000], principles [Martin 2002], patterns [Gamma et al.

1995], design harmony [Lanza & Marinescu 2006]

bad smells [Fowler et al. 1998], design flaws [Marinescu 2002]

Techniquesdetection strategies [Marinescu 2002, Lanza & Marinescu 2006]

Visualizationsquality [Panas et al. 2005], principle violations [Langelier et al. 2005]

4

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Design disharmony

5

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Design disharmony

5

God Class

Brain Class

Data Class

Brain Method

Feature Envy

1.IdentityHow do I

define myself?

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Design disharmony

5

God Class

Brain Class

Data Class

Brain Method

Feature Envy

Intensive Coupling

Shotgun Surgery

Dispersive Coupling

1.Identity

2.Collaboration How do I interact with

others?

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Design disharmony

5

Futile Hierarchy

Tradition Breaker

Refused Parent Bequest

God Class

Brain Class

Data Class

Brain Method

Feature Envy

Intensive Coupling

Shotgun Surgery

Dispersive Coupling

1.Identity

2.Collaboration

3.Classification

How do I define myself with respect to my ancestors and

descendants?

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Design disharmony

5

Futile Hierarchy

Tradition Breaker

Refused Parent Bequest

God Class

Brain Class

Data Class

Brain Method

Feature Envy

Intensive Coupling

Shotgun Surgery

Dispersive Coupling

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Definition of God Class

6

“In a good object-oriented designthe intelligence of a system is uniformly distributed among the top-level classes.”

[Riel 1996]

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Characteristics of a God Class

7

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Heavily accesses data of other “lightweight” classes,either directly or using accessormethods.

Characteristics of a God Class

7

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Heavily accesses data of other “lightweight” classes,either directly or using accessormethods.

Is large

Characteristics of a God Class

7

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Heavily accesses data of other “lightweight” classes,either directly or using accessormethods.

Is large

Has a lot of non-communicative behavior

Characteristics of a God Class

7

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Heavily accesses data of other “lightweight” classes,either directly or using accessormethods.

Is large

Has a lot of non-communicative behavior

Characteristics of a God Class

7

GodClass

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The God Class detection strategy

8

Software systems as cities

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The city metaphor

10

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The city metaphor

10

domain mapping

class building

package district

system city

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The city metaphor

10

domain mapping

class building

package district

system city

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The city metaphor

10

domain mapping

class building

package district

system city

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The city metaphor

10

domain mapping

class building

package district

system city

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The city metaphor

10

domain mapping

class building

package district

system city

number of methods (NOM) height

number of attributes (NOA) base size

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The city metaphor

10

domain mapping

class building

package district

system city

nesting level color

number of methods (NOM) height

number of attributes (NOA) base size

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The city metaphor

10

domain mapping

class building

package district

system city

nesting level color

number of methods (NOM) height

number of attributes (NOA) base size

[Wettel & Lanza, ICPC 2007]

[Wettel & Lanza, VISSOFT 2007]

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

“Reading” a code city (ArgoUML)

11

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

“Reading” a code city (ArgoUML)

11

skyscrapers(NOM, NOA)

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

“Reading” a code city (ArgoUML)

11

skyscrapers(NOM, NOA)

parking lots(NOM, NOA)

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

“Reading” a code city (ArgoUML)

11

skyscrapers(NOM, NOA)

parking lots(NOM, NOA)

office buildings(NOM, NOA)

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps 12

Cities of the Java case studies

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

System NOP NOC LOC

ArgoUML 144 2,542 137,000

JHotDraw 72 998 30,000

iText 149 1,250 80,000

Jmol 105 1,032 85,000

JDK 1.5 137 4,715 160,000

12

Cities of the Java case studies

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

System NOP NOC LOC

ArgoUML 144 2,542 137,000

JHotDraw 72 998 30,000

iText 149 1,250 80,000

Jmol 105 1,032 85,000

JDK 1.5 137 4,715 160,000

12

Cities of the Java case studies

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

System NOP NOC LOC

ArgoUML 144 2,542 137,000

JHotDraw 72 998 30,000

iText 149 1,250 80,000

Jmol 105 1,032 85,000

JDK 1.5 137 4,715 160,000

12

Cities of the Java case studies

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

System NOP NOC LOC

ArgoUML 144 2,542 137,000

JHotDraw 72 998 30,000

iText 149 1,250 80,000

Jmol 105 1,032 85,000

JDK 1.5 137 4,715 160,000

12

Cities of the Java case studies

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

System NOP NOC LOC

ArgoUML 144 2,542 137,000

JHotDraw 72 998 30,000

iText 149 1,250 80,000

Jmol 105 1,032 85,000

JDK 1.5 137 4,715 160,000

12

Cities of the Java case studies

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

System NOP NOC LOC

ArgoUML 144 2,542 137,000

JHotDraw 72 998 30,000

iText 149 1,250 80,000

Jmol 105 1,032 85,000

JDK 1.5 137 4,715 160,000

12

Cities of the Java case studies

Disharmony maps

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Inspired by health maps

14

World distribution of Myxobolus cerebralis

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Disharmony map: focus+context

15

God classes of JDK 1.5

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

JDK’s disharmony map

16

Brain classes

God classes

Data classes

12

65

109

16

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

JDK’s disharmony map

16

Brain classes

God classes

Data classes

12

65

109

16

ComponentNOA 88, NOM 280

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

JDK’s disharmony map

16

Brain classes

God classes

Data classes

12

65

109

16

SecurityNOA 3, NOM 30

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

JDK’s disharmony map

16

Brain classes

God classes

Data classes

12

65

109

16

java.awt.event

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

JDK’s disharmony map

16

Brain classes

God classes

Data classes

12

65

109

16KeyEventNOA 205, NOM 18

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

JDK’s disharmony map

16

Brain classes

God classes

Data classes

12

65

109

16

InputEventNOA 21, NOM 14

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

JDK’s disharmony map

16

Brain classes

God classes

Data classes

12

65

109

16

java.awt.geom

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

ArgoUML’s disharmony map

17

Brain classes

God classes

Data classes

8

24

17

9

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

ArgoUML’s disharmony map

17

Brain classes

God classes

Data classes

8

24

17

9

JavaRecognizerNOA 79, NOM 176

ModellerNOA 15, NOM 52

GeneratorPHP4NOA 4, NOM 33

GeneratorCPPNOA 34, NOM 100

CPPParserNOA 85, NOM 204

FacadeNOA 1, NOM 337

FacadeMDRImplNOA 3, NOM 349

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Granularity of representation

18

NOM

= 7

NOA = 2

NOA = 2

class C

coarse

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Granularity of representation

18

NOM

= 7

NOA = 2

NOA = 2

class C

coarse fine-grained

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Granularity of representation

18

NOM

= 7

NOA = 2

NOA = 2

class C

class C

coarse fine-grained

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Granularity of representation

18

NOM

= 7

NOA = 2

NOA = 2

class C

class Cm4

m1 m3

m5 m7

m6

m2

coarse fine-grained

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps 19

Feature envy map of JmolFeature envy

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps 19

1,500 methods (25 %)

Feature envy map of JmolFeature envy

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Shotgun surgery map of ArgoUML

20

Shotgun surgery

FacadeNOM 140/337

PseudostateKindNOM 6/6

VisibilityKindNOM 4/4

ModelNOM 28/44

AggregationKindNOM 3/3

Tool support

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The toolchain

22

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The toolchain

22

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The toolchain

22

Moose

parsing

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The toolchain

22iP

lasma

Moose

parsing

parsing

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The toolchain

22iP

lasma

Moose

parsing

parsing

modelexchange

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

The toolchain

22iP

lasma

Moose

parsing

parsing

modelexchange

CodeCity

OpenGL rendering

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Demo time!

23

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Closing remarks

24

Design disharmonies overview actual design problems in context.

www.inf.unisi.ch/phd/wettel/codecity.html

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Closing remarks

24

=+

Design disharmonies overview actual design problems in context.

www.inf.unisi.ch/phd/wettel/codecity.html

Richard Wettel and Michele Lanza Visually Localizing Design Problems with Disharmony Maps

Closing remarks

24

=+

Design disharmonies overview actual design problems in context.

www.inf.unisi.ch/phd/wettel/codecity.html

Acknowledgments:

Richard Wettelhttp://www.inf.unisi.ch/phd/wettel

http://creativecommons.org/licenses/by/3.0/

Recommended