Dynamic Behaviour Adaptation
Through Run-Time Trait Recomposition
Sebastián González
Kim Mens
Marius Colacioiu
Walter Cazz...
Towards a Mindset Shift 2
programming in isolation programming with context
forward!
?
?
?
?
?
?
Towards a Mindset Shift 2
Caution
Design patterns
Plugin architectures
Conditional statements
...
programming in isolation...
m(a) {
if ( ) { IE logic }
!
else if ( ) { Opera logic }
else if ( ) { Chrome logic }
else if ( ) { Safari logic }
else if...
m(a) {
if ( ) { IE logic }
!
else if ( ) { Opera logic }
else if ( ) { Chrome logic }
else if ( ) { Safari logic }
else if...
m(a) {
if ( ) { IE logic }
!
else if ( ) { Opera logic }
else if ( ) { Chrome logic }
else if ( ) { Safari logic }
else if...
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) {
strategy.m(a)
}
m(a) { IE strategy }
m(a) { O...
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) {
strategy.m(a)
}
m(a) { IE strategy }
m(a) { O...
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) {
strategy.m(a)
}
m(a) { IE strategy }
m(a) { O...
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) {
strategy.m(a)
}
m(a) { IE strategy }
m(a) { O...
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) {
strategy.m(a)
}
m(a) { IE strategy }
m(a) { O...
Design Patterns 4
m(a) { Firefox strategy }
m(a) { default strategy }
m(a) {
strategy.m(a)
}
m(a) { IE strategy }
m(a) { O...
Layer-Based COP 5
Later on...
In The Paper
‣ Contexts
‣ Traits
‣ Context-Driven Trait Compositions
‣ Composition Policies
‣ Behaviour Extensibility
‣ Co...
‣ Contexts
‣ Traits
‣ Context-Driven Trait Compositions
‣ Composition Policies
‣ Behaviour Extensibility
‣ Context Traits ...
Contexts as Situation Reifiers 8
computationally
accessible data
Battery charge = 220 mAh
Idle cycles = 100 MHz
User agent ...
Contexts as Situation Reifiers 8
computationally
accessible data
no semantics
Battery charge = 220 mAh
Idle cycles = 100 MH...
Contexts as Situation Reifiers 8
computationally
accessible data
no semantics
Battery charge = 220 mAh
Idle cycles = 100 MH...
Contexts as Situation Reifiers 8
computationally
accessible data
no semantics
Battery charge = 220 mAh
Idle cycles = 100 MH...
Contexts as Situation Reifiers 8
computationally
accessible data
no semantics
Battery charge = 220 mAh
Idle cycles = 100 MH...
T.TagT.Tag
tagName
addAttribute
getAttribute
setAttribute
removeAttribute
forEachAttribute
T.NodeT.Node
content
parent
app...
T.TagT.Tag
tagName
addAttribute
getAttribute
setAttribute
removeAttribute
forEachAttribute
T.NodeT.Node
content
parent
app...
T.TagT.Tag
tagName
addAttribute
getAttribute
setAttribute
removeAttribute
forEachAttribute
T.NodeT.Node
content
parent
app...
T.TagT.Tag
tagName
addAttribute
getAttribute
setAttribute
removeAttribute
forEachAttribute
T.NodeT.Node
content
parent
app...
T.TagT.Tag
tagName
addAttribute
getAttribute
setAttribute
removeAttribute
forEachAttribute
T.NodeT.Node
content
parent
app...
T.TagT.Tag
tagName
addAttribute
getAttribute
setAttribute
removeAttribute
forEachAttribute
T.NodeT.Node
content
parent
app...
T.TagT.Tag
tagName
addAttribute
getAttribute
setAttribute
removeAttribute
forEachAttribute
T.NodeT.Node
content
parent
app...
T.TagT.Tag
tagName
addAttribute
getAttribute
setAttribute
removeAttribute
forEachAttribute
T.NodeT.Node
content
parent
app...
T.TagT.Tag
tagName
addAttribute
getAttribute
setAttribute
removeAttribute
forEachAttribute
T.NodeT.Node
content
parent
app...
T.TagT.Tag
tagName
addAttribute
getAttribute
setAttribute
removeAttribute
forEachAttribute
T.NodeT.Node
content
parent
app...
Traits as Basic Behavioural Units 9
+
+
tag a1=”v1” a2=”v2”
T.ElementT.Element
elementsByTagName
elementsByAttribute
getAt...
Default Behaviour & Context 10
HTML.Element
addAttribute
getAttribute
...
style
title
T.HTML.ElementT.HTML.Element
class
s...
= HTML.Element +
HTML.Anchor
addAttribute
...
href
type
target
T.HTML.AnchorT.HTML.Anchor
href
type
target
getAttribute
se...
= HTML.Element +
HTML.Anchor
addAttribute
...
href
type
target
T.HTML.AnchorT.HTML.Anchor
href
type
target
getAttribute
se...
= HTML.Element +
HTML.Anchor
addAttribute
...
href
type
target
T.HTML.AnchorT.HTML.Anchor
href
type
target
getAttribute
se...
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Context();
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Context();
a = new HTML.Anchor();let ida...
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Context();
a = new HTML.Anchor();let ida...
W3Clet W3C ∈ C W3C = new Context();
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Cont...
W3Clet W3C ∈ C W3C = new Context();
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Cont...
W3Clet W3C ∈ C W3C = new Context();
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Cont...
W3Clet W3C ∈ C W3C = new Context();
Context + Traits 11
... in JavaScriptContext Traits
let Default ∈ C Default = new Cont...
W3Clet W3C ∈ C W3C = new Context();
Context + Traits 11
... in JavaScriptContext Traits
Untrusted
let Default ∈ C Default ...
W3C
constitution
( ida, Untrusted ) =
Untrusted.adapt
(a, T.SecureAnchor);
let W3C ∈ C W3C = new Context();
Context + Trai...
Run-Time Trait Recomposition 12
overloading of constitution: L ⨉ C → Tconstitution: L ⨉ 2C
→ 2T
constitution ( ida, { Defa...
Run-Time Trait Recomposition 12
overloading of constitution: L ⨉ C → Tconstitution: L ⨉ 2C
→ 2T
defined through composition...
o
addAttribute
setAttribute
removeAttribute
href
parent
visible
type
target
HTML.Anchor
addAttribute
setAttribute
removeAt...
o
addAttribute
setAttribute
removeAttribute
href
parent
visible
type
target
HTML.Anchor
addAttribute
setAttribute
removeAt...
o
addAttribute
setAttribute
removeAttribute
href
parent
visible
type
target
Run-Time Trait Recomposition 12
overloading of...
o
addAttribute
setAttribute
removeAttribute
href
parent
visible
type
target
Run-Time Trait Recomposition 12
overloading of...
o
addAttribute
setAttribute
removeAttribute
href
parent
visible
type
target
Run-Time Trait Recomposition 12
overloading of...
o
addAttribute
setAttribute
removeAttribute
href
parent
visible
type
target
Run-Time Trait Recomposition 12
overloading of...
TD
Context-Driven Trait Composition
T1
T2
T3
T4
T5
13
TD
Context-Driven Trait Composition
T1
T2
T3
T4
T5
13
TD
Context-Driven Trait Composition
T1
T2
T3
T4
T5
13
TD
Context-Driven Trait Composition
T1
T2
T3
T4
T5
13
TD
Context-Driven Trait Composition
T1
T2
T3
T4
T5
13
addAttribute
setAttribute
removeAttribute
href
parent
visible
type
target
href
parent
visible
addAttribute
setAttribute
re...
addAttribute
setAttribute
removeAttribute
href
parent
visible
type
target
href
parent
visible
addAttribute
setAttribute
re...
addAttribute
setAttribute
removeAttribute
href
parent
visible
type
target
href
parent
visible
addAttribute
setAttribute
re...
addAttribute
setAttribute
removeAttribute
href
parent
visible
type
target
href
parent
visible
addAttribute
setAttribute
re...
Pbysec ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ HTML.Anchor, T.SecureAnchor – visible, T.ValidAnchor }
addAt...
Pbysec ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ HTML.Anchor, T.SecureAnchor – visible, T.ValidAnchor }
addAt...
Pbysec ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ HTML.Anchor, T.SecureAnchor – visible, T.ValidAnchor }
addAt...
Pbysec ( { HTML.Anchor, T.SecureAnchor, T.ValidAnchor } ) =
{ HTML.Anchor, T.SecureAnchor – visible, T.ValidAnchor }
addAt...
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
Behaviour Extensibility Challenge 15
HTML....
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
Behaviour Extensibility Challenge 15
HTML....
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
how to invoke overridden behaviour?
Behavi...
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
how to invoke overridden behaviour?
Behavi...
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
how to invoke overridden behaviour?
Behavi...
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
how to invoke overridden behaviour?
Behavi...
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
how to invoke overridden behaviour?
T.Vali...
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
how to invoke overridden behaviour?
T.Vali...
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
how to invoke overridden behaviour?
T.Vali...
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
T.ValidAnchor.setAttribute = function(name...
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
T.ValidAnchor.setAttribute = function(name...
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
removeAttribute
parent
...
T.ValidAnchor.setAttribute = function(name...
Extensibility Through proceed 16
HTML.Anchor
...
setAttribute
...
T.ValidAnchorT.ValidAnchor
addAttribute
setAttribute
rem...
T.ValidAnchor = Trait({
setAttribute: function(name, value) {
... // validity check
return self.proceed();
},
...
});
Exte...
T.ValidAnchor = Trait({
setAttribute: function(name, value) {
... // validity check
return self.proceed();
},
...
});
Exte...
T.ValidAnchor = Trait({
setAttribute: function(name, value) {
... // validity check
return self.proceed();
},
...
});
Exte...
T.ValidAnchor = Trait({
setAttribute: function(name, value) {
... // validity check
return self.proceed();
},
...
});
Exte...
T.ValidAnchor = Trait({
setAttribute: function(name, value) {
... // validity check
return self.proceed();
},
...
});
Exte...
T.ValidAnchor = Trait({
setAttribute: function(name, value) {
... // validity check
return self.proceed();
},
...
});
Exte...
T.Extensible
proceed
Dynamic
T.ValidAnchor = Trait({
setAttribute: function(name, value) {
... // validity check
return se...
‣ Contexts: frame of reference to define adaptations
‣ Traits: convenient units of adaptation
‣ Policies: flexible compositi...
‣ Contexts: frame of reference to define adaptations
‣ Traits: convenient units of adaptation
‣ Policies: flexible compositi...
In The Paper
‣ Default composition policy
‣ Resolution of proceed chains through policies
‣ Implementation technique for p...
Questions?
Context Traits
19
Additional Slides
Resolution of proceed Through Policies 21
a b
c d
T1
c g
q
T2c() { ... self.proceed() ... }
c d
e f
c h
T3
· · ·
Resolution of proceed Through Policies 21
a b
c d
T1
c g
q
T2c() { ... self.proceed() ... }
c d
e f
c h
T3
· · ·
Resolution of proceed Through Policies 21
pairwise resolution: Pg ( { T2, T3 } ) = { TR }
a b
c d
T1
c g
q
T2c() { ... sel...
Resolution of proceed Through Policies 21
pairwise resolution: Pg ( { T2, T3 } ) = { TR }
a b
c d
T1
c g
q
T2
either TR ( ...
Resolution of proceed Through Policies 21
pairwise resolution: Pg ( { T2, T3 } ) = { TR }
a b
c d
T1
c g
q
T2
either TR ( ...
Resolution of proceed Through Policies 22
Pg induces an order < < <c ccc
c() { ... self.proceed() ... }
current next
Resolution of proceed Through Policies 22
Pg induces an order < < <c ccc
c() { ... self.proceed() ... }
current next
c<
Resolution By Activation Age
Default policy Pa
23
Resolution By Activation Age
C1 < C2 < ... < Cnyounger older
Default policy Pa
23
Resolution By Activation Age
Pa ( { TC1, TC2, ... , TCn } ) = { TC1 ▹ TC2 ▹ ... ▹ TCn }
C1 < C2 < ... < Cnyounger older
De...
Resolution By Activation Age
Pa ( { TC1, TC2, ... , TCn } ) = { TC1 ▹ TC2 ▹ ... ▹ TCn }
C1 < C2 < ... < Cnyounger older
pr...
m n
c d
TD
Resolution By Activation Age
Pa ( { TC1, TC2, ... , TCn } ) = { TC1 ▹ TC2 ▹ ... ▹ TCn }
C1 < C2 < ... < Cnyoung...
Licence 24
creativecommons.org/licenses/by-nc-sa/3.0
Upcoming SlideShare
Loading in …5
×

Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition

490 views

Published on

Presentation by Sebastián González of the paper "Context Traits: Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition" at the Modularity • AOSD 2013 conference.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
490
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition

  1. 1. Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition Sebastián González Kim Mens Marius Colacioiu Walter Cazzola 29 March 2013 Modularity AOSD 2013 UCLouvain . U. Milan Context Traits
  2. 2. Towards a Mindset Shift 2 programming in isolation programming with context forward! ? ? ? ? ? ?
  3. 3. Towards a Mindset Shift 2 Caution Design patterns Plugin architectures Conditional statements ... programming in isolation programming with context forward! ? ? ? ? ? ?
  4. 4. 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 ...
  5. 5. 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
  6. 6. 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 Tangled Scattered Fixed No reuse Complex logic
  7. 7. 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 }
  8. 8. 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
  9. 9. 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
  10. 10. 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
  11. 11. 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 Modular Open
  12. 12. 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 burden Anticipated adaptation points Modular Open
  13. 13. Layer-Based COP 5 Later on...
  14. 14. 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
  15. 15. ‣ Contexts ‣ Traits ‣ Context-Driven Trait Compositions ‣ Composition Policies ‣ Behaviour Extensibility ‣ Context Traits in JavaScript In This Presentation 7
  16. 16. 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
  17. 17. 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
  18. 18. 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
  19. 19. 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 situations for which adapted application behaviour can be defined Low battery charge High CPU load Firefox Landscape orientation
  20. 20. 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 situations for 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(); else LowBattery.deactivate(); }); ... in JavaScript
  21. 21. T.TagT.Tag tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute T.NodeT.Node content parent appendChild replaceChild removeChild walkChildren Traits as Basic Behavioural Units 9 tag a1=”v1” a2=”v2” T.ElementT.Element elementsByTagName elementsByAttribute getAttribute setAttribute walkChildren
  22. 22. T.TagT.Tag tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute T.NodeT.Node content parent appendChild replaceChild removeChild walkChildren Traits as Basic Behavioural Units 9 tag a1=”v1” a2=”v2” T.ElementT.Element elementsByTagName elementsByAttribute getAttribute setAttribute walkChildren provided methods
  23. 23. T.TagT.Tag tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute T.NodeT.Node content parent appendChild replaceChild removeChild walkChildren Traits as Basic Behavioural Units 9 tag a1=”v1” a2=”v2” T.ElementT.Element elementsByTagName elementsByAttribute getAttribute setAttribute walkChildren required methods
  24. 24. T.TagT.Tag tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute T.NodeT.Node content parent appendChild replaceChild removeChild walkChildren Traits as Basic Behavioural Units 9 + + tag a1=”v1” a2=”v2” T.ElementT.Element elementsByTagName elementsByAttribute getAttribute setAttribute walkChildren sum operator
  25. 25. T.TagT.Tag tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute T.NodeT.Node content parent appendChild replaceChild removeChild walkChildren XML.ElementXML.Element tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute content parent appendChild replaceChild removeChild walkChildren id elementsByTagName elementsByAttribute Traits as Basic Behavioural Units 9 + + tag a1=”v1” a2=”v2” T.ElementT.Element elementsByTagName elementsByAttribute getAttribute setAttribute walkChildren =
  26. 26. T.TagT.Tag tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute T.NodeT.Node content parent appendChild replaceChild removeChild walkChildren XML.ElementXML.Element tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute content parent appendChild replaceChild removeChild walkChildren id elementsByTagName elementsByAttribute Traits as Basic Behavioural Units 9 + + tag a1=”v1” a2=”v2” T.ElementT.Element elementsByTagName elementsByAttribute getAttribute setAttribute walkChildren =
  27. 27. T.TagT.Tag tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute T.NodeT.Node content parent appendChild replaceChild removeChild walkChildren XML.ElementXML.Element tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute content parent appendChild replaceChild removeChild walkChildren id elementsByTagName elementsByAttribute Traits as Basic Behavioural Units 9 + + tag a1=”v1” a2=”v2” T.ElementT.Element elementsByTagName elementsByAttribute getAttribute setAttribute walkChildren T[“Element”] = Trait({ elementsByTagName: function(name) { ... }, elementsByAttribute: function(attr) { ... }, getAttribute: Trait.required, setAttribute: Trait.required, walkChildren: Trait.required }); ... in JavaScript =
  28. 28. T.TagT.Tag tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute T.NodeT.Node content parent appendChild replaceChild removeChild walkChildren XML.ElementXML.Element tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute content parent appendChild replaceChild removeChild walkChildren id elementsByTagName elementsByAttribute Traits as Basic Behavioural Units 9 + + tag a1=”v1” a2=”v2” T.ElementT.Element elementsByTagName elementsByAttribute getAttribute setAttribute walkChildren 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 ]
  29. 29. T.TagT.Tag tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute T.NodeT.Node content parent appendChild replaceChild removeChild walkChildren XML.ElementXML.Element tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute content parent appendChild replaceChild removeChild walkChildren id elementsByTagName elementsByAttribute Traits as Basic Behavioural Units 9 + + tag a1=”v1” a2=”v2” T.ElementT.Element elementsByTagName elementsByAttribute getAttribute setAttribute walkChildren T[“Element”] = Trait({ elementsByTagName: function(name) { ... }, elementsByAttribute: function(attr) { ... }, getAttribute: Trait.required, setAttribute: Trait.required, walkChildren: Trait.required }); ... in JavaScript =
  30. 30. T.TagT.Tag tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute T.NodeT.Node content parent appendChild replaceChild removeChild walkChildren XML.ElementXML.Element tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute content parent appendChild replaceChild removeChild walkChildren id elementsByTagName elementsByAttribute Traits as Basic Behavioural Units 9 + + tag a1=”v1” a2=”v2” T.ElementT.Element elementsByTagName elementsByAttribute getAttribute setAttribute walkChildren T[“Element”] = Trait({ elementsByTagName: function(name) { ... }, elementsByAttribute: function(attr) { ... }, getAttribute: Trait.required, setAttribute: Trait.required, walkChildren: Trait.required }); ... in JavaScript =
  31. 31. Traits as Basic Behavioural Units 9 + + tag a1=”v1” a2=”v2” T.ElementT.Element elementsByTagName elementsByAttribute getAttribute setAttribute walkChildren T[“Element”] = Trait({ elementsByTagName: function(name) { ... }, elementsByAttribute: function(attr) { ... }, getAttribute: Trait.required, setAttribute: Trait.required, walkChildren: Trait.required }); ... in JavaScript = T.Tag tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute T.Node content parent appendChild replaceChild removeChild walkChildren XML.Element tagName addAttribute getAttribute setAttribute removeAttribute forEachAttribute content parent appendChild replaceChild removeChild walkChildren id elementsByTagName elementsByAttribute
  32. 32. Default Behaviour & Context 10 HTML.Element addAttribute getAttribute ... style title T.HTML.ElementT.HTML.Element class style title getAttribute setAttribute = XML.Element +
  33. 33. = HTML.Element + HTML.Anchor addAttribute ... href type target T.HTML.AnchorT.HTML.Anchor href type target getAttribute setAttribute Default Behaviour & Context 10 HTML.Element addAttribute getAttribute ... style title T.HTML.ElementT.HTML.Element class style title getAttribute setAttribute = XML.Element +
  34. 34. = HTML.Element + HTML.Anchor addAttribute ... href type target T.HTML.AnchorT.HTML.Anchor href type target getAttribute setAttribute Default Behaviour & Context 10 HTML.Element addAttribute getAttribute ... style title T.HTML.ElementT.HTML.Element class style title getAttribute setAttribute = XML.Element + HTML[“Element”] = Trait.compose(XML.Element, T.HTML.Element); HTML[“Anchor”] = Trait.compose(HTML.Element, T.HTML.Anchor); ... in JavaScript
  35. 35. = HTML.Element + HTML.Anchor addAttribute ... href type target T.HTML.AnchorT.HTML.Anchor href type target getAttribute setAttribute Default Behaviour & Context 10 Default ... for prototypical situations Prototypical behaviour ... HTML.Element addAttribute getAttribute ... style title T.HTML.ElementT.HTML.Element class style title getAttribute setAttribute = XML.Element + ( unperturbed system ) HTML[“Element”] = Trait.compose(XML.Element, T.HTML.Element); HTML[“Anchor”] = Trait.compose(HTML.Element, T.HTML.Anchor); ... in JavaScript
  36. 36. Context + Traits 11 ... in JavaScriptContext Traits let Default ∈ C Default = new Context();
  37. 37. Context + Traits 11 ... in JavaScriptContext Traits let Default ∈ C Default = new Context(); a = new HTML.Anchor();let ida ∈ L
  38. 38. Context + Traits 11 ... in JavaScriptContext Traits let Default ∈ C Default = new Context(); a = new HTML.Anchor();let ida ∈ L constitution: L ⨉ C → T
  39. 39. 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
  40. 40. 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
  41. 41. 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
  42. 42. 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.ValidAnchor addAttribute setAttribute removeAttribute parent ...
  43. 43. 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.ValidAnchor addAttribute setAttribute removeAttribute parent ...
  44. 44. W3C constitution ( ida, Untrusted ) = Untrusted.adapt (a, T.SecureAnchor); let W3C ∈ C W3C = new Context(); Context + Traits 11 ... in JavaScriptContext Traits T.SecureAnchorT.SecureAnchor href parent visible 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.ValidAnchor addAttribute setAttribute removeAttribute parent ...
  45. 45. 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 }
  46. 46. 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 }
  47. 47. 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
  48. 48. 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
  49. 49. 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
  50. 50. 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
  51. 51. 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 execution object: L ⨉ 2C → O object = composition · constitution addAttribute setAttribute removeAttribute href parent visible type target href parent visible addAttribute setAttribute removeAttribute parent
  52. 52. 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 execution object: L ⨉ 2C → O object = composition · constitution addAttribute setAttribute removeAttribute href parent visible type target href parent visible addAttribute setAttribute removeAttribute parent
  53. 53. TD Context-Driven Trait Composition T1 T2 T3 T4 T5 13
  54. 54. TD Context-Driven Trait Composition T1 T2 T3 T4 T5 13
  55. 55. TD Context-Driven Trait Composition T1 T2 T3 T4 T5 13
  56. 56. TD Context-Driven Trait Composition T1 T2 T3 T4 T5 13
  57. 57. TD Context-Driven Trait Composition T1 T2 T3 T4 T5 13
  58. 58. 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▹ ▹
  59. 59. 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 parentparent addAttribute setAttribute removeAttribute What if we want to bypass security of visible?
  60. 60. 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 parentparent addAttribute setAttribute removeAttribute What if we want to bypass security of visible? ✗ Impossible with strict overriding semantics (e.g. inheritance, mixins, COP layers)
  61. 61. 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 parentparent 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 } ) = { }
  62. 62. 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 parentparent 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 } ) = { }
  63. 63. 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 parentparent 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 } ) = { }
  64. 64. 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 parentparent 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
  65. 65. 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 parentparent 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
  66. 66. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... Behaviour Extensibility Challenge 15 HTML.Anchor ... setAttribute ...
  67. 67. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... Behaviour Extensibility Challenge 15 HTML.Anchor ... setAttribute ...
  68. 68. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... how to invoke overridden behaviour? Behaviour Extensibility Challenge 15 HTML.Anchor ... setAttribute ...
  69. 69. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... how to invoke overridden behaviour? Behaviour Extensibility Challenge 15 HTML.Anchor ... setAttribute ... [ htmlSetAttribute ↦ setAttribute ] = HTML.Anchor’ ... setAttribute htmlSetAttribute ...
  70. 70. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... how to invoke overridden behaviour? Behaviour Extensibility Challenge 15 HTML.Anchor ... setAttribute ... [ htmlSetAttribute ↦ setAttribute ] = HTML.Anchor’ ... setAttribute htmlSetAttribute ... aliasing operator
  71. 71. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... how to invoke overridden behaviour? Behaviour Extensibility Challenge 15 HTML.Anchor ... setAttribute ... [ htmlSetAttribute ↦ setAttribute ] = HTML.Anchor’ ... setAttribute htmlSetAttribute ...
  72. 72. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... how to invoke overridden behaviour? T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value); } Behaviour Extensibility Challenge 15 T.ValidAnchor’T.ValidAnchor’ addAttribute setAttribute removeAttribute parent htmlSetAttribute ... HTML.Anchor ... setAttribute ... [ htmlSetAttribute ↦ setAttribute ] = HTML.Anchor’ ... setAttribute htmlSetAttribute ... → manual edition →
  73. 73. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... how to invoke overridden behaviour? T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value); } Behaviour Extensibility Challenge 15 T.ValidAnchor’T.ValidAnchor’ addAttribute setAttribute removeAttribute parent htmlSetAttribute ... HTML.Anchor ... setAttribute ... [ htmlSetAttribute ↦ setAttribute ] = HTML.Anchor’ ... setAttribute htmlSetAttribute ... → manual edition → ...becomes requirement
  74. 74. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... how to invoke overridden behaviour? T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value); } Behaviour Extensibility Challenge 15 T.ValidAnchor’T.ValidAnchor’ addAttribute setAttribute removeAttribute parent htmlSetAttribute ... HTML.Anchor ... setAttribute ... [ htmlSetAttribute ↦ setAttribute ] = HTML.Anchor’ ... setAttribute htmlSetAttribute ... → manual edition →
  75. 75. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value); } Behaviour Extensibility Challenge 15 T.ValidAnchor’T.ValidAnchor’ addAttribute setAttribute removeAttribute parent htmlSetAttribute ... HTML.Anchor ... setAttribute ... [ htmlSetAttribute ↦ setAttribute ] = HTML.Anchor’ ... setAttribute htmlSetAttribute ... → manual edition → ▹
  76. 76. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value); } Behaviour Extensibility Challenge 15 T.ValidAnchor’T.ValidAnchor’ addAttribute setAttribute removeAttribute parent htmlSetAttribute ... HTML.Anchor ... setAttribute ... [ htmlSetAttribute ↦ setAttribute ] = HTML.Anchor’ ... setAttribute htmlSetAttribute ... → manual edition → ▹ ✗ bypassed T.SecureAnchor ▹▹
  77. 77. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... T.ValidAnchor.setAttribute = function(name, value) { ... return self.htmlSetAttribute(name, value); } Behaviour Extensibility Challenge 15 T.ValidAnchor’T.ValidAnchor’ addAttribute setAttribute removeAttribute parent htmlSetAttribute ... HTML.Anchor ... setAttribute ... [ htmlSetAttribute ↦ setAttribute ] = HTML.Anchor’ ... setAttribute htmlSetAttribute ... → manual edition → ▹ ✗ bypassed T.SecureAnchor ▹▹ ✗ hard-coded choice of overridden behaviour
  78. 78. Extensibility Through proceed 16 HTML.Anchor ... setAttribute ... T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent how to invoke overridden behaviour?
  79. 79. T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ... }); Extensibility Through proceed 16 HTML.Anchor ... setAttribute ... T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent how to invoke overridden behaviour? proceed
  80. 80. T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ... }); Extensibility Through proceed 16 HTML.Anchor ... setAttribute ... T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent becomes requirement how to invoke overridden behaviour? proceed
  81. 81. T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ... }); Extensibility Through proceed 16 HTML.Anchor ... setAttribute ... T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent how to invoke overridden behaviour? proceed
  82. 82. T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ... }); Extensibility Through proceed 16 HTML.Anchor ... setAttribute ... T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ✓ open choice of overridden behaviour how to invoke overridden behaviour? proceed
  83. 83. T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ... }); Extensibility Through proceed 16 HTML.Anchor ... setAttribute ... T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent how to invoke overridden behaviour? proceed ▹ T.SecureAnchorT.SecureAnchor ... setAttribute ... parent visible manager ... ▹
  84. 84. T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ... }); Extensibility Through proceed 16 HTML.Anchor ... setAttribute ... T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent how to invoke overridden behaviour? proceed ▹ T.SecureAnchorT.SecureAnchor ... setAttribute ... parent visible manager ... ▹
  85. 85. T.Extensible proceed Dynamic T.ValidAnchor = Trait({ setAttribute: function(name, value) { ... // validity check return self.proceed(); }, ... }); Extensibility Through proceed 16 HTML.Anchor ... setAttribute ... T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent how to invoke overridden behaviour? proceed ▹ T.SecureAnchorT.SecureAnchor ... setAttribute ... parent visible manager ... ▹
  86. 86. ‣ 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
  87. 87. ‣ 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 connection composition of the computational system situation in which the system executes ⇋
  88. 88. In The Paper ‣ Default composition policy ‣ Resolution of proceed chains through policies ‣ Implementation technique for proceed ‣ Case Studies 18
  89. 89. Questions? Context Traits 19
  90. 90. Additional Slides
  91. 91. Resolution of proceed Through Policies 21 a b c d T1 c g q T2c() { ... self.proceed() ... } c d e f c h T3 · · ·
  92. 92. Resolution of proceed Through Policies 21 a b c d T1 c g q T2c() { ... self.proceed() ... } c d e f c h T3 · · ·
  93. 93. Resolution of proceed Through Policies 21 pairwise resolution: Pg ( { T2, T3 } ) = { TR } a b c d T1 c g q T2c() { ... self.proceed() ... } c d e f c h T3 · · ·
  94. 94. Resolution of proceed Through Policies 21 pairwise resolution: Pg ( { T2, T3 } ) = { TR } a b c d T1 c g q T2 either TR ( c ) = or TR ( c ) =c c ( since policies resolve through +, ▹, ↦, – exclusively ) c() { ... self.proceed() ... } c d e f c h T3 · · ·
  95. 95. Resolution of proceed Through Policies 21 pairwise resolution: Pg ( { T2, T3 } ) = { TR } a b c d T1 c g q T2 either TR ( c ) = or TR ( c ) =c c ( since policies resolve through +, ▹, ↦, – exclusively ) c() { ... self.proceed() ... } c d e f suppose TR ( c ) = ; then <c cc c h T3 · · ·
  96. 96. Resolution of proceed Through Policies 22 Pg induces an order < < <c ccc c() { ... self.proceed() ... } current next
  97. 97. Resolution of proceed Through Policies 22 Pg induces an order < < <c ccc c() { ... self.proceed() ... } current next c<
  98. 98. Resolution By Activation Age Default policy Pa 23
  99. 99. Resolution By Activation Age C1 < C2 < ... < Cnyounger older Default policy Pa 23
  100. 100. Resolution By Activation Age Pa ( { TC1, TC2, ... , TCn } ) = { TC1 ▹ TC2 ▹ ... ▹ TCn } C1 < C2 < ... < Cnyounger older Default policy Pa 23
  101. 101. Resolution By Activation Age Pa ( { TC1, TC2, ... , TCn } ) = { TC1 ▹ TC2 ▹ ... ▹ TCn } C1 < C2 < ... < Cnyounger older produces a sort of layering according to contexts a b c dc d e f TC1 TC2 e f g h TC3 Default policy Pa 23
  102. 102. m n c 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 b c dc d e f TC1 TC2 e f g h TC3 Default policy Pa 23
  103. 103. Licence 24 creativecommons.org/licenses/by-nc-sa/3.0

×