Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition
-
Upload
kimmens -
Category
Technology
-
view
406 -
download
2
description
Transcript of Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition
![Page 1: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/1.jpg)
Dynamic Behaviour AdaptationThrough Run-Time Trait Recomposition
Sebastián GonzálezKim Mens
Marius ColacioiuWalter Cazzola
29 March 2013
Modularity AOSD 2013
UCLouvain . U. Milan
Context Traits
![Page 2: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/2.jpg)
Towards a Mindset Shift 2
programming in isolation programming with context
forward!
??
??
?
?
![Page 3: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/3.jpg)
Towards a Mindset Shift 2
CautionDesign patterns
Plugin architecturesConditional statements
...
programming in isolation programming with context
forward!
??
??
?
?
![Page 4: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/4.jpg)
m(a) {
if ( ) { IE logic }! else if ( ) { Opera logic }
else if ( ) { Chrome logic }
else if ( ) { Safari logic }
else if ( ) { Firefox logic }
else { default logic }
}
Conditional Statements 3
Some variant of ...
![Page 5: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/5.jpg)
m(a) {
if ( ) { IE logic }! else if ( ) { Opera logic }
else if ( ) { Chrome logic }
else if ( ) { Safari logic }
else if ( ) { Firefox logic }
else { default logic }
}
Conditional Statements 3
Some variant of ...
Adaptable
![Page 6: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/6.jpg)
m(a) {
if ( ) { IE logic }! else if ( ) { Opera logic }
else if ( ) { Chrome logic }
else if ( ) { Safari logic }
else if ( ) { Firefox logic }
else { default logic }
}
Conditional Statements 3
Some variant of ...
Adaptable
TangledScatteredFixedNo reuseComplex logic
![Page 7: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/7.jpg)
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) { strategy.m(a)}
m(a) { IE strategy }
m(a) { Opera strategy }
m(a) { Chrome strategy }
m(a) { Safari strategy }
![Page 8: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/8.jpg)
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) { strategy.m(a)}
m(a) { IE strategy }
m(a) { Opera strategy }
m(a) { Chrome strategy }
m(a) { Safari strategy }
strategy
![Page 9: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/9.jpg)
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) { strategy.m(a)}
m(a) { IE strategy }
m(a) { Opera strategy }
m(a) { Chrome strategy }
m(a) { Safari strategy }
strategy
![Page 10: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/10.jpg)
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) { strategy.m(a)}
m(a) { IE strategy }
m(a) { Opera strategy }
m(a) { Chrome strategy }
m(a) { Safari strategy }
strategy
![Page 11: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/11.jpg)
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) { strategy.m(a)}
m(a) { IE strategy }
m(a) { Opera strategy }
m(a) { Chrome strategy }
m(a) { Safari strategy }
strategy
ModularOpen
![Page 12: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/12.jpg)
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) { strategy.m(a)}
m(a) { IE strategy }
m(a) { Opera strategy }
m(a) { Chrome strategy }
m(a) { Safari strategy }
strategy
Infrastructural burdenAnticipated adaptation points
ModularOpen
![Page 13: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/13.jpg)
Layer-Based COP 5
Later on...
![Page 14: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/14.jpg)
In The Paper‣ Contexts‣ Traits‣ Context-Driven Trait Compositions‣ Composition Policies‣ Behaviour Extensibility‣ Context Traits in JavaScript‣ Implementation Notes‣ Case Studies‣ Related Work‣ Future Work
6
![Page 15: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/15.jpg)
‣ Contexts‣ Traits‣ Context-Driven Trait Compositions‣ Composition Policies‣ Behaviour Extensibility‣ Context Traits in JavaScript
In This Presentation 7
![Page 16: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/16.jpg)
Contexts as Situation Reifiers 8
computationally accessible data
Battery charge = 220 mAh
Idle cycles = 100 MHz
User agent = “Mozilla/5.0...”
Z axis = 0.03
![Page 17: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/17.jpg)
Contexts as Situation Reifiers 8
computationally accessible data
no semantics
Battery charge = 220 mAh
Idle cycles = 100 MHz
User agent = “Mozilla/5.0...”
Z axis = 0.03
![Page 18: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/18.jpg)
Contexts as Situation Reifiers 8
computationally accessible data
no semantics
Battery charge = 220 mAh
Idle cycles = 100 MHz
User agent = “Mozilla/5.0...”
Z axis = 0.03
action can be taken
well-defined situations
Context Discovery
Low battery charge
High CPU load
Firefox
Landscape orientation
![Page 19: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/19.jpg)
Contexts as Situation Reifiers 8
computationally accessible data
no semantics
Battery charge = 220 mAh
Idle cycles = 100 MHz
User agent = “Mozilla/5.0...”
Z axis = 0.03
action can be taken
well-defined situations
Context Discovery
contexts are reified situationsfor which adapted application behaviour can be defined
Low battery charge
High CPU load
Firefox
Landscape orientation
![Page 20: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/20.jpg)
Contexts as Situation Reifiers 8
computationally accessible data
no semantics
Battery charge = 220 mAh
Idle cycles = 100 MHz
User agent = “Mozilla/5.0...”
Z axis = 0.03
action can be taken
well-defined situations
Context Discovery
contexts are reified situationsfor which adapted application behaviour can be defined
Low battery charge
High CPU load
Firefox
Landscape orientation
LowBattery = new Context();
window.addEventListener(‘batterystatus’,function (data) {
if (data.level < 30)LowBattery.activate();
elseLowBattery.deactivate(); });
... in JavaScript
![Page 21: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/21.jpg)
T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute
T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren
Traits as Basic Behavioural Units 9
tag a1=”v1” a2=”v2”
T.ElementT.ElementelementsByTagNameelementsByAttribute
getAttributesetAttributewalkChildren
![Page 22: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/22.jpg)
T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute
T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren
Traits as Basic Behavioural Units 9
tag a1=”v1” a2=”v2”
T.ElementT.ElementelementsByTagNameelementsByAttribute
getAttributesetAttributewalkChildren
providedmethods
![Page 23: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/23.jpg)
T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute
T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren
Traits as Basic Behavioural Units 9
tag a1=”v1” a2=”v2”
T.ElementT.ElementelementsByTagNameelementsByAttribute
getAttributesetAttributewalkChildren
requiredmethods
![Page 24: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/24.jpg)
T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute
T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren
Traits as Basic Behavioural Units 9
+
+
tag a1=”v1” a2=”v2”
T.ElementT.ElementelementsByTagNameelementsByAttribute
getAttributesetAttributewalkChildren
sumoperator
![Page 25: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/25.jpg)
T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute
T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren
XML.ElementXML.ElementtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttributecontentparentappendChildreplaceChildremoveChildwalkChildrenidelementsByTagNameelementsByAttribute
Traits as Basic Behavioural Units 9
+
+
tag a1=”v1” a2=”v2”
T.ElementT.ElementelementsByTagNameelementsByAttribute
getAttributesetAttributewalkChildren
=
![Page 26: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/26.jpg)
T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute
T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren
XML.ElementXML.ElementtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttributecontentparentappendChildreplaceChildremoveChildwalkChildrenidelementsByTagNameelementsByAttribute
Traits as Basic Behavioural Units 9
+
+
tag a1=”v1” a2=”v2”
T.ElementT.ElementelementsByTagNameelementsByAttribute
getAttributesetAttributewalkChildren
=
![Page 27: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/27.jpg)
T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute
T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren
XML.ElementXML.ElementtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttributecontentparentappendChildreplaceChildremoveChildwalkChildrenidelementsByTagNameelementsByAttribute
Traits as Basic Behavioural Units 9
+
+
tag a1=”v1” a2=”v2”
T.ElementT.ElementelementsByTagNameelementsByAttribute
getAttributesetAttributewalkChildren
T[“Element”] =Trait({
elementsByTagName: function(name) { ... },elementsByAttribute: function(attr) { ... },getAttribute: Trait.required,setAttribute: Trait.required,walkChildren: Trait.required });
... in JavaScript
=
![Page 28: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/28.jpg)
T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute
T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren
XML.ElementXML.ElementtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttributecontentparentappendChildreplaceChildremoveChildwalkChildrenidelementsByTagNameelementsByAttribute
Traits as Basic Behavioural Units 9
+
+
tag a1=”v1” a2=”v2”
T.ElementT.ElementelementsByTagNameelementsByAttribute
getAttributesetAttributewalkChildren
T[“Element”] =Trait({
elementsByTagName: function(name) { ... },elementsByAttribute: function(attr) { ... },getAttribute: Trait.required,setAttribute: Trait.required,walkChildren: Trait.required });
... in JavaScript
=
traits.js [ Van Cutsem & Miller 2011 ]
![Page 29: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/29.jpg)
T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute
T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren
XML.ElementXML.ElementtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttributecontentparentappendChildreplaceChildremoveChildwalkChildrenidelementsByTagNameelementsByAttribute
Traits as Basic Behavioural Units 9
+
+
tag a1=”v1” a2=”v2”
T.ElementT.ElementelementsByTagNameelementsByAttribute
getAttributesetAttributewalkChildren
T[“Element”] =Trait({
elementsByTagName: function(name) { ... },elementsByAttribute: function(attr) { ... },getAttribute: Trait.required,setAttribute: Trait.required,walkChildren: Trait.required });
... in JavaScript
=
![Page 30: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/30.jpg)
T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute
T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren
XML.ElementXML.ElementtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttributecontentparentappendChildreplaceChildremoveChildwalkChildrenidelementsByTagNameelementsByAttribute
Traits as Basic Behavioural Units 9
+
+
tag a1=”v1” a2=”v2”
T.ElementT.ElementelementsByTagNameelementsByAttribute
getAttributesetAttributewalkChildren
T[“Element”] =Trait({
elementsByTagName: function(name) { ... },elementsByAttribute: function(attr) { ... },getAttribute: Trait.required,setAttribute: Trait.required,walkChildren: Trait.required });
... in JavaScript
=
![Page 31: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/31.jpg)
Traits as Basic Behavioural Units 9
+
+
tag a1=”v1” a2=”v2”
T.ElementT.ElementelementsByTagNameelementsByAttribute
getAttributesetAttributewalkChildren
T[“Element”] =Trait({
elementsByTagName: function(name) { ... },elementsByAttribute: function(attr) { ... },getAttribute: Trait.required,setAttribute: Trait.required,walkChildren: Trait.required });
... in JavaScript
=
T.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute
T.NodecontentparentappendChildreplaceChildremoveChildwalkChildren
XML.ElementtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttributecontentparentappendChildreplaceChildremoveChildwalkChildrenidelementsByTagNameelementsByAttribute
![Page 32: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/32.jpg)
Default Behaviour & Context 10
HTML.ElementaddAttributegetAttribute...styletitle
T.HTML.ElementT.HTML.Elementclassstyletitle
getAttributesetAttribute
= XML.Element +
![Page 33: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/33.jpg)
= HTML.Element +
HTML.AnchoraddAttribute...hreftypetarget
T.HTML.AnchorT.HTML.Anchorhreftypetarget
getAttributesetAttribute
Default Behaviour & Context 10
HTML.ElementaddAttributegetAttribute...styletitle
T.HTML.ElementT.HTML.Elementclassstyletitle
getAttributesetAttribute
= XML.Element +
![Page 34: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/34.jpg)
= HTML.Element +
HTML.AnchoraddAttribute...hreftypetarget
T.HTML.AnchorT.HTML.Anchorhreftypetarget
getAttributesetAttribute
Default Behaviour & Context 10
HTML.ElementaddAttributegetAttribute...styletitle
T.HTML.ElementT.HTML.Elementclassstyletitle
getAttributesetAttribute
= XML.Element +
HTML[“Element”] =Trait.compose(XML.Element, T.HTML.Element);
HTML[“Anchor”] =Trait.compose(HTML.Element, T.HTML.Anchor);
... in JavaScript
![Page 35: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/35.jpg)
= HTML.Element +
HTML.AnchoraddAttribute...hreftypetarget
T.HTML.AnchorT.HTML.Anchorhreftypetarget
getAttributesetAttribute
Default Behaviour & Context 10
Default
... for prototypical situations
Prototypical behaviour ...
HTML.ElementaddAttributegetAttribute...styletitle
T.HTML.ElementT.HTML.Elementclassstyletitle
getAttributesetAttribute
= XML.Element +
( unperturbed system )
HTML[“Element”] =Trait.compose(XML.Element, T.HTML.Element);
HTML[“Anchor”] =Trait.compose(HTML.Element, T.HTML.Anchor);
... in JavaScript
![Page 36: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/36.jpg)
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Context();
![Page 37: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/37.jpg)
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Context();
a = new HTML.Anchor();let ida ∈ L
![Page 38: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/38.jpg)
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Context();
a = new HTML.Anchor();let ida ∈ L
constitution: L ⨉ C → T
![Page 39: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/39.jpg)
W3Clet W3C ∈ C W3C = new Context();
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Context();
a = new HTML.Anchor();let ida ∈ L
constitution: L ⨉ C → T
![Page 40: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/40.jpg)
W3Clet W3C ∈ C W3C = new Context();
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Context();
a = new HTML.Anchor();let ida ∈ L
constitution: L ⨉ C → T
![Page 41: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/41.jpg)
W3Clet W3C ∈ C W3C = new Context();
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Context();
a = new HTML.Anchor();let ida ∈ L
constitution: L ⨉ C → T
![Page 42: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/42.jpg)
W3Clet W3C ∈ C W3C = new Context();
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Context();
a = new HTML.Anchor();let ida ∈ L
constitution: L ⨉ C → T
constitution( ida, W3C ) = W3C.adapt(a, T.ValidAnchor);
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
![Page 43: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/43.jpg)
W3Clet W3C ∈ C W3C = new Context();
Context + Traits 11
... in JavaScriptContext Traits
Untrusted
let Default ∈ C Default = new Context();
a = new HTML.Anchor();let ida ∈ L
constitution: L ⨉ C → T
constitution( ida, W3C ) = W3C.adapt(a, T.ValidAnchor);
let Untrusted ∈ C Untrusted = new Context();
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
![Page 44: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/44.jpg)
W3C
constitution ( ida, Untrusted ) = Untrusted.adapt
(a, T.SecureAnchor);
let W3C ∈ C W3C = new Context();
Context + Traits 11
... in JavaScriptContext Traits
T.SecureAnchorT.SecureAnchorhrefparentvisible
manager...
Untrusted
let Default ∈ C Default = new Context();
a = new HTML.Anchor();let ida ∈ L
constitution: L ⨉ C → T
constitution( ida, W3C ) = W3C.adapt(a, T.ValidAnchor);
let Untrusted ∈ C Untrusted = new Context();
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
![Page 45: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/45.jpg)
Run-Time Trait Recomposition 12
overloading of constitution: L ⨉ C → Tconstitution: L ⨉ 2C → 2T
constitution ( ida, { Default, Untrusted, W3C } )
= { HTML.Anchor, T.SecureAnchor, T.ValidAnchor }
![Page 46: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/46.jpg)
Run-Time Trait Recomposition 12
overloading of constitution: L ⨉ C → Tconstitution: L ⨉ 2C → 2T
defined through composition policiescomposition: 2T → O
constitution ( ida, { Default, Untrusted, W3C } )
= { HTML.Anchor, T.SecureAnchor, T.ValidAnchor }
![Page 47: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/47.jpg)
o addAttribute setAttribute removeAttribute href parent visible type target
HTML.Anchor addAttribute setAttribute removeAttribute href parent visible type target
T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute
parent
...
T.SecureAnchorT.SecureAnchor
href parent visible
manager...
Run-Time Trait Recomposition 12
overloading of constitution: L ⨉ C → Tconstitution: L ⨉ 2C → 2T
defined through composition policiescomposition: 2T → O
constitution ( ida, { Default, Untrusted, W3C } )
= { HTML.Anchor, T.SecureAnchor, T.ValidAnchor }
composition ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
▹ ▹
overriding operator
![Page 48: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/48.jpg)
o addAttribute setAttribute removeAttribute href parent visible type target
HTML.Anchor addAttribute setAttribute removeAttribute href parent visible type target
T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute
parent
...
T.SecureAnchorT.SecureAnchor
href parent visible
manager...
Run-Time Trait Recomposition 12
overloading of constitution: L ⨉ C → Tconstitution: L ⨉ 2C → 2T
defined through composition policiescomposition: 2T → O
constitution ( ida, { Default, Untrusted, W3C } )
= { HTML.Anchor, T.SecureAnchor, T.ValidAnchor }
composition ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
▹ ▹ addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
![Page 49: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/49.jpg)
o addAttribute setAttribute removeAttribute href parent visible type target
Run-Time Trait Recomposition 12
overloading of constitution: L ⨉ C → Tconstitution: L ⨉ 2C → 2T
defined through composition policiescomposition: 2T → O
constitution ( ida, { Default, Untrusted, W3C } )
= { HTML.Anchor, T.SecureAnchor, T.ValidAnchor }
composition ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
![Page 50: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/50.jpg)
o addAttribute setAttribute removeAttribute href parent visible type target
Run-Time Trait Recomposition 12
overloading of constitution: L ⨉ C → Tconstitution: L ⨉ 2C → 2T
defined through composition policiescomposition: 2T → O
constitution ( ida, { Default, Untrusted, W3C } )
= { HTML.Anchor, T.SecureAnchor, T.ValidAnchor }
composition ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
object = composition · constitution
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
![Page 51: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/51.jpg)
o addAttribute setAttribute removeAttribute href parent visible type target
Run-Time Trait Recomposition 12
overloading of constitution: L ⨉ C → Tconstitution: L ⨉ 2C → 2T
defined through composition policiescomposition: 2T → O
constitution ( ida, { Default, Untrusted, W3C } )
= { HTML.Anchor, T.SecureAnchor, T.ValidAnchor }
composition ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
puts object composition in direct relationship to the context of executionobject: L ⨉ 2C → O
object = composition · constitution
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
![Page 52: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/52.jpg)
o addAttribute setAttribute removeAttribute href parent visible type target
Run-Time Trait Recomposition 12
overloading of constitution: L ⨉ C → Tconstitution: L ⨉ 2C → 2T
defined through composition policiescomposition: 2T → O
constitution ( ida, { Default, Untrusted, W3C } )
= { HTML.Anchor, T.SecureAnchor, T.ValidAnchor }
composition ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
o = TC1 · TC2 · ... · TCn
puts object composition in direct relationship to the context of executionobject: L ⨉ 2C → O
object = composition · constitution
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
![Page 53: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/53.jpg)
TD
Context-Driven Trait Composition
T1
T2
T3
T4T5
13
![Page 54: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/54.jpg)
TD
Context-Driven Trait Composition
T1
T2
T3
T4T5
13
![Page 55: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/55.jpg)
TD
Context-Driven Trait Composition
T1
T2
T3
T4
T5
13
![Page 56: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/56.jpg)
TD
Context-Driven Trait Composition
T1
T2
T3
T4
T5
13
![Page 57: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/57.jpg)
TD
Context-Driven Trait Composition
T1T2
T3
T4
T5
13
![Page 58: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/58.jpg)
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
=
Composition Policies 14
HTML.Anchor T.SecureAnchor T.ValidAnchor▹ ▹
![Page 59: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/59.jpg)
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
=
Composition Policies 14
HTML.Anchor T.SecureAnchor T.ValidAnchor▹ ▹
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent parent
addAttribute setAttribute removeAttribute
What if we want to bypass security of
visible?
![Page 60: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/60.jpg)
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
=
Composition Policies 14
HTML.Anchor T.SecureAnchor T.ValidAnchor▹ ▹
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent parent
addAttribute setAttribute removeAttribute
What if we want to bypass security of
visible?✗ Impossible with strict overriding semantics
(e.g. inheritance, mixins, COP layers)
![Page 61: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/61.jpg)
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
=
Composition Policies 14
HTML.Anchor T.SecureAnchor T.ValidAnchor▹ ▹
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent parent
addAttribute setAttribute removeAttribute
What if we want to bypass security of
visible?✗ Impossible with strict overriding semantics
(e.g. inheritance, mixins, COP layers)
Povr ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ }
![Page 62: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/62.jpg)
Pbysec ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ HTML.Anchor, T.SecureAnchor – visible, T.ValidAnchor }
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
=
Composition Policies 14
HTML.Anchor T.SecureAnchor T.ValidAnchor▹ ▹
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent parent
addAttribute setAttribute removeAttribute
What if we want to bypass security of
visible?✗ Impossible with strict overriding semantics
(e.g. inheritance, mixins, COP layers)
Povr ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ }
![Page 63: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/63.jpg)
Pbysec ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ HTML.Anchor, T.SecureAnchor – visible, T.ValidAnchor }
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
=
Composition Policies 14
HTML.Anchor T.SecureAnchor T.ValidAnchor▹ ▹
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent parent
addAttribute setAttribute removeAttribute
What if we want to bypass security of
visible?✗ Impossible with strict overriding semantics
(e.g. inheritance, mixins, COP layers)
exclusion operator
Povr ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ }
![Page 64: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/64.jpg)
Pbysec ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ HTML.Anchor, T.SecureAnchor – visible, T.ValidAnchor }
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
=
Composition Policies 14
HTML.Anchor T.SecureAnchor T.ValidAnchor▹ ▹
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent parent
addAttribute setAttribute removeAttribute
What if we want to bypass security of
visible?✗ Impossible with strict overriding semantics
(e.g. inheritance, mixins, COP layers)
Povr ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ }
P : 2T → 2T
P = Povr · Pbysec
![Page 65: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/65.jpg)
Pbysec ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ HTML.Anchor, T.SecureAnchor – visible, T.ValidAnchor }
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent visible
addAttribute setAttribute removeAttribute
parent
=
✓Arbitrary combinations
Composition Policies 14
HTML.Anchor T.SecureAnchor T.ValidAnchor▹ ▹
o addAttribute setAttribute removeAttribute href parent visible type target
addAttribute setAttribute removeAttribute href parent visible type target
href parent parent
addAttribute setAttribute removeAttribute
What if we want to bypass security of
visible?✗ Impossible with strict overriding semantics
(e.g. inheritance, mixins, COP layers)
Povr ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ }
P : 2T → 2T
P = Povr · Pbysec
![Page 66: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/66.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
Behaviour Extensibility Challenge 15
HTML.Anchor...setAttribute...
![Page 67: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/67.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
Behaviour Extensibility Challenge 15
HTML.Anchor...setAttribute...
![Page 68: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/68.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
how to invoke overridden behaviour?
Behaviour Extensibility Challenge 15
HTML.Anchor...setAttribute...
![Page 69: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/69.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
how to invoke overridden behaviour?
Behaviour Extensibility Challenge 15
HTML.Anchor...setAttribute...
[ htmlSetAttribute ↦ setAttribute ] =
HTML.Anchor’...setAttributehtmlSetAttribute...
![Page 70: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/70.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
how to invoke overridden behaviour?
Behaviour Extensibility Challenge 15
HTML.Anchor...setAttribute...
[ htmlSetAttribute ↦ setAttribute ] =
HTML.Anchor’...setAttributehtmlSetAttribute...
aliasing operator
![Page 71: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/71.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
how to invoke overridden behaviour?
Behaviour Extensibility Challenge 15
HTML.Anchor...setAttribute...
[ htmlSetAttribute ↦ setAttribute ] =
HTML.Anchor’...setAttributehtmlSetAttribute...
![Page 72: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/72.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
how to invoke overridden behaviour?
T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value);}
Behaviour Extensibility Challenge 15
T.ValidAnchor’T.ValidAnchor’addAttributesetAttributeremoveAttributeparent
htmlSetAttribute...
HTML.Anchor...setAttribute...
[ htmlSetAttribute ↦ setAttribute ] =
HTML.Anchor’...setAttributehtmlSetAttribute...
→ manual edition →
![Page 73: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/73.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
how to invoke overridden behaviour?
T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value);}
Behaviour Extensibility Challenge 15
T.ValidAnchor’T.ValidAnchor’addAttributesetAttributeremoveAttributeparent
htmlSetAttribute...
HTML.Anchor...setAttribute...
[ htmlSetAttribute ↦ setAttribute ] =
HTML.Anchor’...setAttributehtmlSetAttribute...
→ manual edition →
...becomes requirement
![Page 74: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/74.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
how to invoke overridden behaviour?
T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value);}
Behaviour Extensibility Challenge 15
T.ValidAnchor’T.ValidAnchor’addAttributesetAttributeremoveAttributeparent
htmlSetAttribute...
HTML.Anchor...setAttribute...
[ htmlSetAttribute ↦ setAttribute ] =
HTML.Anchor’...setAttributehtmlSetAttribute...
→ manual edition →
![Page 75: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/75.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value);}
Behaviour Extensibility Challenge 15
T.ValidAnchor’T.ValidAnchor’addAttributesetAttributeremoveAttributeparent
htmlSetAttribute...
HTML.Anchor...setAttribute...
[ htmlSetAttribute ↦ setAttribute ] =
HTML.Anchor’...setAttributehtmlSetAttribute...
→ manual edition →
▹
![Page 76: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/76.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value);}
Behaviour Extensibility Challenge 15
T.ValidAnchor’T.ValidAnchor’addAttributesetAttributeremoveAttributeparent
htmlSetAttribute...
HTML.Anchor...setAttribute...
[ htmlSetAttribute ↦ setAttribute ] =
HTML.Anchor’...setAttributehtmlSetAttribute...
→ manual edition →
▹✗ bypassed T.SecureAnchor▹
▹
![Page 77: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/77.jpg)
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
...
T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value);}
Behaviour Extensibility Challenge 15
T.ValidAnchor’T.ValidAnchor’addAttributesetAttributeremoveAttributeparent
htmlSetAttribute...
HTML.Anchor...setAttribute...
[ htmlSetAttribute ↦ setAttribute ] =
HTML.Anchor’...setAttributehtmlSetAttribute...
→ manual edition →
▹✗ bypassed T.SecureAnchor▹
▹
✗ hard-coded choice of overridden behaviour
![Page 78: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/78.jpg)
Extensibility Through proceed 16
HTML.Anchor...setAttribute...
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
how to invoke overridden behaviour?
![Page 79: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/79.jpg)
T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ...});
Extensibility Through proceed 16
HTML.Anchor...setAttribute...
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
how to invoke overridden behaviour?
proceed
![Page 80: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/80.jpg)
T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ...});
Extensibility Through proceed 16
HTML.Anchor...setAttribute...
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
becomes requirement
how to invoke overridden behaviour?
proceed
![Page 81: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/81.jpg)
T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ...});
Extensibility Through proceed 16
HTML.Anchor...setAttribute...
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
how to invoke overridden behaviour?
proceed
![Page 82: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/82.jpg)
T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ...});
Extensibility Through proceed 16
HTML.Anchor...setAttribute...
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
✓ open choice of overridden behaviour
how to invoke overridden behaviour?
proceed
![Page 83: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/83.jpg)
T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ...});
Extensibility Through proceed 16
HTML.Anchor...setAttribute...
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
how to invoke overridden behaviour?
proceed
▹T.SecureAnchorT.SecureAnchor
...setAttribute...parentvisible
manager...
▹
![Page 84: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/84.jpg)
T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ...});
Extensibility Through proceed 16
HTML.Anchor...setAttribute...
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
how to invoke overridden behaviour?
proceed
▹T.SecureAnchorT.SecureAnchor
...setAttribute...parentvisible
manager...
▹
![Page 85: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/85.jpg)
T.Extensibleproceed Dynamic
T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ...});
Extensibility Through proceed 16
HTML.Anchor...setAttribute...
T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent
how to invoke overridden behaviour?
proceed
▹T.SecureAnchorT.SecureAnchor
...setAttribute...parentvisible
manager...
▹
![Page 86: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/86.jpg)
‣ Contexts: frame of reference to define adaptations‣ Traits: convenient units of adaptation‣ Policies: flexible compositions (e.g. non-linear)‣ Extensibility: independent behaviour extensions‣ JavaScript: easy definition of contexts, traits, and
composition
Summary 17
![Page 87: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/87.jpg)
‣ Contexts: frame of reference to define adaptations‣ Traits: convenient units of adaptation‣ Policies: flexible compositions (e.g. non-linear)‣ Extensibility: independent behaviour extensions‣ JavaScript: easy definition of contexts, traits, and
composition
Summary 17
direct causal connectioncomposition of the computational system
situation in which the system executes⇋
![Page 88: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/88.jpg)
In The Paper
‣ Default composition policy‣ Resolution of proceed chains through policies‣ Implementation technique for proceed‣ Case Studies
18
![Page 89: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/89.jpg)
Questions?
Context Traits
19
![Page 90: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/90.jpg)
Additional Slides
![Page 91: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/91.jpg)
Resolution of proceed Through Policies 21
a bc d
T1
c gq
T2c() { ... self.proceed() ... }
c de f
c h
T3
· · ·
![Page 92: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/92.jpg)
Resolution of proceed Through Policies 21
a bc d
T1
c gq
T2c() { ... self.proceed() ... }
c de f
c h
T3
· · ·
![Page 93: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/93.jpg)
Resolution of proceed Through Policies 21
pairwise resolution: Pg ( { T2, T3 } ) = { TR }
a bc d
T1
c gq
T2c() { ... self.proceed() ... }
c de f
c h
T3
· · ·
![Page 94: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/94.jpg)
Resolution of proceed Through Policies 21
pairwise resolution: Pg ( { T2, T3 } ) = { TR }
a bc d
T1
c gq
T2
either TR ( c ) = or TR ( c ) = c c
( since policies resolve through +, ▹, ↦, – exclusively )
c() { ... self.proceed() ... }
c de f
c h
T3
· · ·
![Page 95: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/95.jpg)
Resolution of proceed Through Policies 21
pairwise resolution: Pg ( { T2, T3 } ) = { TR }
a bc d
T1
c gq
T2
either TR ( c ) = or TR ( c ) = c c
( since policies resolve through +, ▹, ↦, – exclusively )
c() { ... self.proceed() ... }
c de f
suppose TR ( c ) = ; then <c cc
c h
T3
· · ·
![Page 96: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/96.jpg)
Resolution of proceed Through Policies 22
Pg induces an order < < <c ccc
c() { ... self.proceed() ... }
current next
![Page 97: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/97.jpg)
Resolution of proceed Through Policies 22
Pg induces an order < < <c ccc
c() { ... self.proceed() ... }
current next
c<
![Page 98: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/98.jpg)
Resolution By Activation Age
Default policy Pa
23
![Page 99: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/99.jpg)
Resolution By Activation Age
C1 < C2 < ... < Cnyounger older
Default policy Pa
23
![Page 100: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/100.jpg)
Resolution By Activation Age
Pa ( { TC1, TC2, ... , TCn } ) = { TC1 ▹ TC2 ▹ ... ▹ TCn }
C1 < C2 < ... < Cnyounger older
Default policy Pa
23
![Page 101: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/101.jpg)
Resolution By Activation Age
Pa ( { TC1, TC2, ... , TCn } ) = { TC1 ▹ TC2 ▹ ... ▹ TCn }
C1 < C2 < ... < Cnyounger older
produces a sort of layering according to
contexts
a bc dc de fTC1
TC2
e fg h
TC3
Default policy Pa
23
![Page 102: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/102.jpg)
m nc d
TD
Resolution By Activation Age
Pa ( { TC1, TC2, ... , TCn } ) = { TC1 ▹ TC2 ▹ ... ▹ TCn }
C1 < C2 < ... < Cnyounger older
produces a sort of layering according to
contexts
a bc dc de fTC1
TC2
e fg h
TC3
Default policy Pa
23
![Page 103: Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition](https://reader033.fdocuments.us/reader033/viewer/2022051513/547d40a5b4af9fce158b5305/html5/thumbnails/103.jpg)
Licence 24
creativecommons.org/licenses/by-nc-sa/3.0