Professional Documents
Culture Documents
Software Development
The Demeter Method
Adaptive Programming
Demeter/Java Aspect-Oriented Progr. strategy graphs
Java class graphs
Java environment principles
principles object graphs
UML heuristics
heuristics state graphs
XML patterns
patterns
idioms
idioms
requirements theorems
theorems use cases
domain analysis algorithms
algorithms interfaces
design traversals
implementation Demeter Method
visitors
iterative development
packages
spiral model
10/1/98 AOOP / Demeter 5
Agenda
• UML class diagrams. Perspective: analysis,
design, implementation
• Class graphs as special cases of UML class
diagrams
• Textual representation of class graphs
• Default implementation of UML class
diagrams as class graphs
Aspect 1
structure
Aspect 2
synchronization
High-level view,
implementation may
be different
buses
0..*
BusList BusStop
waiting
0..* passengers
Bus PersonList
Person 0..*
10/1/98 AOOP / Demeter 20
2: Traversals / Collaborating
classes
• To process objects we need to traverse them
• Traversal can be specified by a group of
collaborating classes
buses OO solution:
one method 0..*
BusList for each red BusStop
class
waiting
0..* passengers
Bus PersonList
Person 0..*
10/1/98 AOOP / Demeter 23
3: Traversal Strategy Graphs
• Want to define traversals succinctly
• Use graph to express abstraction of class
diagram
• Express traversal intent: useful for
documentation of object-oriented programs
buses
0..*
BusList BusStop
waiting
0..* passengers
Bus PersonList
Person 0..*
10/1/98 AOOP / Demeter 25
find all persons waiting at any bus stop on a bus route
Traversal Strategy
from BusRoute through BusStop to Person
busStops
BusRoute BusStopList
buses
0..*
BusList BusStop
waiting
0..* passengers
Bus PersonList
Person 0..*
10/1/98 AOOP / Demeter 26
find all persons waiting at any bus stop on a bus route
Traversal Strategy
Altern.: from BusRoute bypassing Bus to Person
busStops
BusRoute BusStopList
buses
0..*
BusList BusStop
waiting
0..* passengers
Bus PersonList
Person 0..*
10/1/98 AOOP / Demeter 27
find all persons waiting at any bus stop on a bus route
Robustness of Strategy
from BusRoute bypassing Bus to Person
villages
BusRoute BusStopList
buses VillageList
busStops 0..*
0..*
BusList BusStop
Village
waiting
0..* passengers
Bus PersonList
Person 0..*
10/1/98 AOOP / Demeter 28
Filter out noise in class diagram
•only three out of seven classes
are mentioned in traversal
strategy!
busStops
BusRoute BusStop
0..*
waiting 0..*
buses 0..*
passengers
Bus Person
0..*
buses VillageList
busStops 0..*
0..*
BusList BusStop
Village
waiting
0..* passengers
Bus PersonList
VillageList
busStops 0..*
0..*
BusStop
Village
busStops
BusRoute BusStop
0..*
edge -> path
10/1/98 AOOP / Demeter 32
Benefits of interface class graph
• Shields program from details of application
class graph
• Makes program more robust and simpler
• Dilemma:
•Small method problem of OO (if followed) or
•Unmaintainable code (if not followed)
A1 family
Object-Oriented Programs
A2 family
10/1/98 AOOP / Demeter 38
Adaptive Programming
Strategy Diagrams
are use-case based
abstractions of
Class Diagrams
define family of
Object Diagrams
10/1/98 AOOP / Demeter 39
Adaptive Programming
Strategy Diagrams
define traversals
of
Object Diagrams
Strategy Diagrams
guide and
inform
Visitors
10/1/98 AOOP / Demeter 41
Strategy Diagrams
BusRoute BusStop Person
Nodes: positive information: Mark corner
stones in class graph: Overall topology
of collaborating classes. 3 nodes:
from BusRoute
through BusStop
to Person
10/1/98 AOOP / Demeter 42
Strategy Diagrams
bypassing edges incident with Bus
BusRoute Person
www.tendril.com
weaver
structure-shy structure-shy
communication behavior
(*.ridl) (*.beh)
distribution compiler/ strategies and
weaver visitors
structure-shy
object description
synchronization (*.cool) (*.input, at runtime)
multi threading
10/1/98 AOOP / Demeter 49
Cross-cutting in Demeter/Java
generated Demeter/Java program
Java program
structure-shy
functionality
structure replicated!
synchronization