jgs
SER 516
Software Agility
Lecture 21: Dependency Principles III
Dr. Javier Gonzalez-Sanchez
[email protected]
javiergs.engineering.asu.edu | javiergs.com
PERALTA 230U
Office Hours: By appointment
jgs
516 00010000
Stable Abstraction Principle
More stable a package is,
the more abstract it should be.
Slide 5
Slide 5 text
jgs
516 00010000
Stable Abstraction Principle
Abstract
concrete
Stable
Hard to Change
Only incoming dependencies
Unstable
Changeable
Only outgoing dependencies
Slide 6
Slide 6 text
jgs
516 00010000
Question
Slide 7
Slide 7 text
jgs
516 00010000
Question
A)
B)
Slide 8
Slide 8 text
jgs
Stable Dependency Principle
Slide 9
Slide 9 text
jgs
516 00010000
Stable Dependency Principle
§ Every dependency between modules should terminate on a module whose
Instability metric is less than or equal to the depending
module's Instability metric.
§ Every dependency between modules should terminate on a module whose
Abstractness metric is greater than or equal to the depending
module's Abstractness metric.
Slide 10
Slide 10 text
jgs
516 00010000
Question 3 (again)
A)
B)
Slide 11
Slide 11 text
jgs
516 00010000
SAP + SDP
§ Distance: how far a package is away from
the Main Sequence
§ D = A + I – 1
§ Values -1 to 1
§ Absolute Distance |D|
jgs
516 00010000
Question
public class Foo {
Bar b= new Bar(new Car());
public Foo (Car c) {
c.doIt(b);
}
public void m (Delta d) {
d.action(b);
}
}
public class System {
public ... main ( ...) {
Foo f = new Foo();
//...
}
}
Slide 15
Slide 15 text
jgs
516 00010000
Question
public class Foo {
Bar b= new Bar(new Car());
public Foo (Car c) {
c.doIt(b);
}
public void m (Delta d) {
d.action(b);
}
}
public class System {
public ... main ( ...) {
Foo f = new Foo();
//...
}
}
• Tangled:
• ISystem
=
• IFoo
=
• IBar
• Afoo
• Any candidate for “painful”
zone:
jgs
516 00010000
Reference
§ Agile Software Development: Principles, Patterns, and Practices. Robert C.
Martin. Prentice Hall. 2006.
Chapter 30.
Slide 19
Slide 19 text
jgs
SER 516 Software Agility
Javier Gonzalez-Sanchez
[email protected]
Spring 2021
Disclaimer. These slides can only be used as study material for the class SER516 at ASU. They cannot be distributed or used for another purpose.