![Page 1: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/1.jpg)
LubA language for Dynamic Context
Oriented Programming
Steven CostiouMickaël Kerboeuf, Glenn Cavarlé, Alain Plantec
UMR CNRS 6285, Lab-STICC/MOCSUniversité de Bretagne Occidentale
![Page 2: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/2.jpg)
▪ The drones are flying in close formation
▪ One of the drones loses its guidance system
▪ Assumption: the fail-safe behaviour for that case has not been anticipated
▪ Possible solution: dynamically change the drone fleet’s behaviour• The faulty drone behaviour is changed to use the GPS of a mate
drone
The drone fleet example
![Page 3: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/3.jpg)
1. Problematic: Dynamic behavior adaptation
2. Our proposition: Lub, a language for behavior adaptation through dynamic lookup instrumentation
3. Evaluation with Pharo: The drone example experiment
![Page 4: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/4.jpg)
● Autonomous systems need for dynamic behaviour adaptation in case of unexpected Events
● The system must not be lost
● The mission must not be cancelled
Dynamic behavior adaptation
![Page 5: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/5.jpg)
● The runtime system must be able to dynamically updates its behavior
● One must be able to communicate with the system and safely push the new behavior
Dynamic behavior adaptation
![Page 6: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/6.jpg)
Existing approaches for dynamic behavior update ?
![Page 7: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/7.jpg)
● Adaptation through architectural reconfiguration
Navigation ComponentComponent AGPS
Component BOther
positioning system
pinPoint()
pinPoint()
Component based solutions
![Page 8: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/8.jpg)
● Many COP languages▪ ContextL (Costanza and Hirschfeld 2005), ContextJ (Appeltauer et al.
2011), EventCj (Kamina et al. 2011), etc.▪ Combination “per-instance” + “no-scope-limitation” hard to find
:navigation
pinPoint()
pinPoint()
pinPoint()with LayerB { pinPoint() }
:positionTracker
LayerA
LayerB
LayerCPositionTracker
instance of
Navigation
instance of
Context Oriented Programming (COP)
![Page 9: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/9.jpg)
● Lookup delegated to a third party object● Modifies the lookup semantics
:navigation:positionTracker
pinPoint()
Specify
Add
pinPoint()
Navigation
PositionTracker
instance of
instance of
Talents (Ressia 2014)
:talent
![Page 10: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/10.jpg)
Comparisons of these approaches
![Page 11: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/11.jpg)
1. Problematic: Dynamic behavior adaptation
2. Our proposition: Lub, a language for behavior adaptation through dynamic lookup instrumentation
3. Evaluation with Pharo: The drone example experiment
![Page 12: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/12.jpg)
Comparisons of these approaches
![Page 13: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/13.jpg)
● Proposition: Changeable lookup base
● Lookup base▪ The class where the lookup starts from
:a
A
MESSAGE SEND
A1
A2A2’
LOOKUP
START LOOKUP
LOOKUP FAILUREdoesNotUnderstand:
Lookup base
![Page 14: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/14.jpg)
● Implements changeable lookup base
● OO language, Class/Instance based
● Instance based adaptation at runtime
● Preserved self reference: structural links and states are unchanged
● Two dedicated operators▪ to change the lookup base▪ to select methods impacted by the lookup base
change
The Lub language
![Page 15: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/15.jpg)
The Lub metamodel
![Page 16: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/16.jpg)
Lub adaptation example
![Page 17: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/17.jpg)
Definition of a LookupBase (LUB): references a class where to perform the lookup.
Lub adaptation example
![Page 18: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/18.jpg)
Definition of a LookupBase (LUB): references a class where to perform the lookup.
Instance of the LookupBase, set as the current one of the object to adapt.
Lub adaptation example
![Page 19: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/19.jpg)
:a
A
MESSAGE SEND
A1
A2A2’
LOOKUP
START LOOKUP
LOOKUP FAILUREdoesNotUnderstand:
Lookup mechanics extension
● Lookup base
![Page 20: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/20.jpg)
:a
:lookupBase
A
MESSAGE SEND
A1
A2A2’
B
B1
B2B2’
LOOKUP
LOOKUP
START LOOKUP
LOOKUP FAILURE
START LOOKUP
LOOKUP FAILUREdoesNotUnderstand:
Lookup mechanics extension
● Lookup base● Lookup extension
![Page 21: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/21.jpg)
class PeerPositionTracker {
attributes { }operations {
pinPoint: drone“Computes the drone’s position using the GPS of a mate drone”
printTracker^’Adapted Tracker’
}}
LookupBase PeerTrackerLookupBase {class := PeerPositionTracker.
}
A Lub specification
![Page 22: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/22.jpg)
class PeerPositionTracker {
attributes { }operations {
pinPoint: drone“Computes the drone’s position using the GPS of a mate drone”
printTracker^’Adapted Tracker’
}}
LookupBase PeerTrackerLookupBase {class := PeerPositionTracker.
}
Definition of an adaptation: dynamic adding of the PeerPositionTracker class
A Lub specification
![Page 23: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/23.jpg)
class PeerPositionTracker {
attributes { }operations {
pinPoint: drone“Computes the drone’s position using the GPS of a mate drone”
printTracker^’Adapted Tracker’
}}
LookupBase PeerTrackerLookupBase {class := PeerPositionTracker.
}
Definition of an adaptation: dynamic adding of the PeerPositionTracker class
Definition of a Lookup Base: references the PeerPositionTracker class
A Lub specification
![Page 24: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/24.jpg)
tracker := (simulation agentNamed: ‘dr2’) positionTracker.tracker lookupBase: PeerTrackerLookupBase
Change of dr2’s LookupBase
A Lub specification
![Page 25: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/25.jpg)
1. Problematic: Dynamic behavior adaptation
2. Our proposition: Lub, a language for behavior adaptation through dynamic lookup instrumentation
3. Evaluation with Pharo: The drone example experiment
![Page 26: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/26.jpg)
dr2
dr1
target
GPS LOSS
BEHAVIOR ADAPTATION
Drone fleet example simulation
t2
t1
t3
t4
![Page 27: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/27.jpg)
t = 2Accessing Tracker 1 [dr1 : GPSMobileDrone] this is dr1 at (90@39)Accessing Tracker 2 [dr2 : GPSMobileDrone] No pinpoint device available.Tracker 2 updating lookup base with : PeerTrackerLookupBase
t = 3Accessing Tracker 1 [dr1 : GPSMobileDrone] this is dr1 at (89@40)Accessing Adapted tracker (dr2 requesting dr1 position: Accessing Tracker 1 )[dr2 : GPSMobileDrone] this is dr2 at (175@81)
t = 4Accessing Tracker 1 [dr1 : GPSMobileDrone] this is dr1 at (88@41)Accessing Adapted tracker (dr2 requesting dr1 position: Accessing Tracker 1 )[dr2 : GPSMobileDrone] this is dr2 at (174@84)
Simulation log after adaptation
![Page 28: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/28.jpg)
class PeerPositionTracker {
attributes { }operations {
pinPoint: drone“computations”
printTracker^’Adapted Tracker’
}}
LookupBase PeerTrackerLookupBase {
class := PeerPositionTracker.} :a
:lookupBase
A
A1
A2A2’
B
B1
B2B2’
LOOKUP
LOOKUP
START LOOKUP
LOOKUP FAILURE
START LOOKUP
LOOKUP FAILUREdoesNotUnderstand:
Operator selection
![Page 29: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/29.jpg)
:a
:lookupBase
A
A1
A2A2’
B
B1
B2B2’
LOOKUP
LOOKUP
START LOOKUP
LOOKUP FAILURE
START LOOKUP
LOOKUP FAILUREdoesNotUnderstand:
pinPoint:
Operator selection
class PeerPositionTracker {
attributes { }operations {
pinPoint: drone“computations”
printTracker^’Adapted Tracker’
}}
LookupBase PeerTrackerLookupBase {
class := PeerPositionTracker.with { pinPoint: }
}
![Page 30: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/30.jpg)
class PeerPositionTracker {
attributes { }operations {
pinPoint: drone“computations”
printTracker^’Adapted Tracker’
}}
LookupBase PeerTrackerLookupBase {
class := PeerPositionTracker.with { pinPoint: }
}:a
:lookupBase
A
A1
A2A2’
B
B1
B2B2’
LOOKUP
LOOKUP
START LOOKUP
LOOKUP FAILURE
START LOOKUP
LOOKUP FAILUREdoesNotUnderstand:
printTrackerpinPoint:
Operator selection
![Page 31: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/31.jpg)
class PeerPositionTracker {
attributes { }operations {
pinPoint: drone“computations”
printTracker^’Adapted Tracker’
}}
LookupBase PeerTrackerLookupBase {
class := PeerPositionTracker.with { pinPoint: }
}:a
:lookupBase
A
A1
A2A2’
B
B1
B2B2’
LOOKUP
LOOKUP
START LOOKUP
LOOKUP FAILURE
START LOOKUP
LOOKUP FAILUREdoesNotUnderstand:
printTrackerpinPoint:
Operator selection
![Page 32: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/32.jpg)
class PeerPositionTracker {
attributes { }operations {
pinPoint: drone“computations”
printTracker^’Adapted Tracker’
}}
LookupBase PeerTrackerLookupBase {
class := PeerPositionTracker.with { pinPoint: }
}:a
:lookupBase
A
A1
A2A2’
B
B1
B2B2’
LOOKUP
LOOKUP
START LOOKUP
LOOKUP FAILURE
START LOOKUP
LOOKUP FAILUREdoesNotUnderstand:
printTrackerpinPoint:
Operator selection
![Page 33: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/33.jpg)
t = 2Accessing Tracker 1 [dr1 : GPSMobileDrone] this is dr1 at (90@39)Accessing Tracker 2 [dr2 : GPSMobileDrone] No pinpoint device available.Tracker 2 updating lookup base with : PeerTrackerLookupBase
t = 3Accessing Tracker 1 [dr1 : GPSMobileDrone] this is dr1 at (89@40)Accessing Tracker 2 (dr2 requesting dr1 position: Accessing Tracker 1 )[dr2 : GPSMobileDrone] this is dr2 at (175@81)
t = 4Accessing Tracker 1 [dr1 : GPSMobileDrone] this is dr1 at (88@41)Accessing Tracker 2 (dr2 requesting dr1 position: Accessing Tracker 1 )[dr2 : GPSMobileDrone] this is dr2 at (174@84)
Simulation log after pinPoint: adaptation
![Page 34: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/34.jpg)
● Vérification/validation
● Validation on a physical device▪ Reproducing the GPS drone example adaptation
● Investigate the communication problem▪ How to communicate and to push new behaviors ?▪ Nickolaos Papoulias thesis (2013): “remote
debugging and reflection in resource constrained devices”
Perspectives
![Page 35: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/35.jpg)
LubA language for Dynamic Context
Oriented Programming
Steven CostiouMickaël Kerboeuf, Glenn Cavarlé, Alain Plantec
UMR CNRS 6285, Lab-STICC/MOCSUniversité de Bretagne Occidentale
![Page 36: Lub A language for Dynamic Context Oriented Programminglab-sticc.univ-brest.fr/~goulven/sharc2016/presentations-and-papers/... · A language for Dynamic Context Oriented Programming](https://reader035.vdocuments.net/reader035/viewer/2022070808/5f07524e7e708231d41c684d/html5/thumbnails/36.jpg)
Lub runtime model