Design Quality Assessment in Practice
Radu Marinescu
radum@cs.upt.romy two hats... Associate Professor
since 2006Co-Founder and Head
since 2003Co-Founder (2008)
http://www.intooitus.com/
Design Quality Assessment in Practice my two hats... Radu - - PowerPoint PPT Presentation
Design Quality Assessment in Practice my two hats... Radu Marinescu radum@cs.upt.ro http://www.intooitus.com/ Associate Professor Co-Founder and Head since 2006 since 2003 Co-Founder (2008) 1 1 Assessment with metrics Assessment with
Design Quality Assessment in Practice
Radu Marinescu
radum@cs.upt.romy two hats... Associate Professor
since 2006Co-Founder and Head
since 2003Co-Founder (2008)
http://www.intooitus.com/
1
Assessment with metrics
2
Assessment with pictures
3
Assessment with tools
Assessment with metrics
Software is complex.
The Standish Group, 200453% Challenged 18% Failed 29% Succeeded
forward engineering } { } { } { } {When, due to constraints, I design quickly and dirty, my project is loaded with
W.Cunningham, 1992technical debt.
How can I control this... You cannot control what you cannot measure.
Tom de MarcoMetrics compress system traits into numbers. Let’s see some examples...
Examples of metrics
LOC - number of lines of code CYCLO - cyclomatic complexity of a function NOF - number of functions FANOUT - outgoing coupling NOA - number of attributes DIT - depth of inheritance tree TCC - tight class cohesion Lorenz, Kidd, 1994 Chidamber, Kemerer, 1994Trouble in paradise...
Trouble 1: Thresholds
Metric Value
LOC 35175 NOM 3618 NOC 384 CYCLO 5579 NOP 19 FANOUT 8590Are these numbers “normal” ?
We need means to compare. We need comparable metrics.
Size Communication Inheritance
Overview Pyramid provides a metrics overview.
Marinescu, Lanza 0.31 ANDC NOM 20.21 19 0.12 35175 NOP NOC 418 0.15 8590 LOC 3618 9.42 5579 NOM CALLS 15128 384 FANOUT 9.72 0.56 AHH CYCLOSize
Overview Pyramid provides a metrics overview.
Marinescu, Lanza 0.31 ANDC NOM 20.21 19 0.12 35175 NOP NOC 418 0.15 8590 LOC 3618 9.42 5579 NOM CALLS 15128 384 FANOUT 9.72 0.56 AHH CYCLOOverview Pyramid provides a metrics overview.
Marinescu, Lanza ... HIGH 0.30 16 15 10 9 0.25 AVG C++ 4 5 0.20 LOW Java AVG LOW HIGH 0.24 10 13 7 0.20 10 0.16 7 4 NOM/NOC LOC/NOM CYCLO/LOC4 . + OSS projects 5 . . + LOC
The Overview Pyramid provides a metrics
The Overview Pyramid provides a metrics
The Overview Pyramid provides a metrics
Trouble 2: Granularity
Metrics are aggregated in quality models...
McCall, 1977Problem:
we don’t reason in terms of metrics, but in terms of design principlesCapture violations of design principles & best practices
in an automatic manner...
An example...
Detection Strategies are metric-based queries to detect design flaws.
METRIC 1 > Threshold 1 Rule 1 METRIC 2 < Threshold 2 Rule 2 AND Quality problem MarinescuGod Classes tend to centralize the intelligence of the system, to do everything and to use data from small data-classes. A.Riel, 1996
God Classes tend to centralize the intelligence of the system, to do everything and to use data from small data-classes. God Classes centralize the intelligence of the system, do everything and use data from small data-classes. God Classes are complex, are not cohesive, access external data.
Compose metrics into queries using logical operators
A God Class centralizes too much intelligence in the system.
ATFD > FEW Class uses directly more than a few attributes of other classes WMC ≥ VERY HIGH Functional complexity of the class is very high TCC < ONE THIRD Class cohesion is low AND GodClass Marinescu, LanzaMeasure quality deficit based on design problems
Specifi Understandab Size & Complexity En 1 2 2 andability Quality Changeability Reusability Hierarchies Cohesion Coupling Encapsulation 1 1 2 2 1 1 2 2 2 2 2 2 2 2 2 2 God Class Brain Class Feature Envy Data Class Brain Method Significant Duplication Intensive Coupling Dispersed Coupling Shotgun Surgery Tradition Breaker Refused Parent Bequest uses has is has has has (partial) is partially has is is has Futile Hierarchy uses has has is has (subclass)Measure quality deficit based on design problems
Stay tuned for the inFusion demo inCode demos
1
Assessment with metrics
2
Assessment with pictures
3
Assessment with tools
Assessment with pictures
Polymetric views show up to 5 metrics
Color metric Width metric Height metric Position metrics
Use metrics in a visual context!
Lanza, Ducasse, 2003Example
System Complexity shows class hierarchies
lines attributes methods1000+ classes in one picture...
ArgoUML, 200411.000+ classes in one picture...
Java JDK 1.5, 2011Trouble in paradise...
Trouble 1: Heterogeneity
They are simply too many... Trouble 2: Edges are a pain...
E d g e s w
k
l y i n d e m
a n d r e s e a r c h p a p e r s . :
Beyond polymetric views...
Polymetric Maps
Visualize various design concerns.
Reuse the layout!
Example: Package Maps
Package Map: Layout
Eclipse-JDT, 2010Package Map: Design Problems
Eclipse-JDT, 2010 severe no affected by design problemsPackage Map: Coupling
Eclipse-JDT, 2010 client (uses other classes) provider (is used by other classes) many many none nonePackage Map: Coupling
Eclipse-JDT, 2010Interactive! A picture is worth a thousand words
ProverbA demo is worth a thousand pictures
Assessment with tools
inFusion
inFusion 1
Quality Deficit becomes quantifiable
2
Detection of well-know design problems
3
Meaningful contextual advices
4
Interactive visualizations
1 3 . 5 MLOC
A demo is worth a thousand pictures It’s demo time!
inFusion
Try out yourself!
http://www.intooitus.com/products/infusion
Design Quality Assessment in Practice
Radu Marinescu
radum@cs.upt.ro