lub a language for dynamic context oriented...

36
Lub A language for Dynamic Context Oriented Programming Steven Costiou Mickaël Kerboeuf, Glenn Cavarlé, Alain Plantec UMR CNRS 6285, Lab-STICC/MOCS Université de Bretagne Occidentale

Upload: others

Post on 15-Jun-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

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

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

▪ 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

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

● 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

● 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

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

● 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

● 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

● 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

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

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

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

● 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

● 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

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

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

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

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

: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

: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

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

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

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

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

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

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

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

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

: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

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

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

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

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

● 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

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

Lub runtime model