Your SlideShare is downloading. ×
Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Context Traits Dynamic Behaviour Adaptation Through Run-Time Trait Recomposition

216
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.

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
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
216
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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. Towards a Mindset Shift 2 programming in isolation programming with context forward! ? ? ? ? ? ?
  • 3. Towards a Mindset Shift 2 Caution Design patterns Plugin architectures Conditional statements ... programming in isolation programming with context forward! ? ? ? ? ? ?
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. Layer-Based COP 5 Later on...
  • 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. ‣ Contexts ‣ Traits ‣ Context-Driven Trait Compositions ‣ Composition Policies ‣ Behaviour Extensibility ‣ Context Traits in JavaScript In This Presentation 7
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. Default Behaviour & Context 10 HTML.Element addAttribute getAttribute ... style title T.HTML.ElementT.HTML.Element class style title getAttribute setAttribute = XML.Element +
  • 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. = 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. = 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. Context + Traits 11 ... in JavaScriptContext Traits let Default ∈ C Default = new Context();
  • 37. Context + Traits 11 ... in JavaScriptContext Traits let Default ∈ C Default = new Context(); a = new HTML.Anchor();let ida ∈ L
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. TD Context-Driven Trait Composition T1 T2 T3 T4 T5 13
  • 54. TD Context-Driven Trait Composition T1 T2 T3 T4 T5 13
  • 55. TD Context-Driven Trait Composition T1 T2 T3 T4 T5 13
  • 56. TD Context-Driven Trait Composition T1 T2 T3 T4 T5 13
  • 57. TD Context-Driven Trait Composition T1 T2 T3 T4 T5 13
  • 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. 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. 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. 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. 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. 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. 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. 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. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... Behaviour Extensibility Challenge 15 HTML.Anchor ... setAttribute ...
  • 67. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... Behaviour Extensibility Challenge 15 HTML.Anchor ... setAttribute ...
  • 68. T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent ... how to invoke overridden behaviour? Behaviour Extensibility Challenge 15 HTML.Anchor ... setAttribute ...
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. Extensibility Through proceed 16 HTML.Anchor ... setAttribute ... T.ValidAnchorT.ValidAnchor addAttribute setAttribute removeAttribute parent how to invoke overridden behaviour?
  • 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. 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. 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. 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. 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. 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. 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. ‣ 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. ‣ 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. In The Paper ‣ Default composition policy ‣ Resolution of proceed chains through policies ‣ Implementation technique for proceed ‣ Case Studies 18
  • 89. Questions? Context Traits 19
  • 90. Additional Slides
  • 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. 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. 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. 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. 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. Resolution of proceed Through Policies 22 Pg induces an order < < <c ccc c() { ... self.proceed() ... } current next
  • 97. Resolution of proceed Through Policies 22 Pg induces an order < < <c ccc c() { ... self.proceed() ... } current next c<
  • 98. Resolution By Activation Age Default policy Pa 23
  • 99. Resolution By Activation Age C1 < C2 < ... < Cnyounger older Default policy Pa 23
  • 100. Resolution By Activation Age Pa ( { TC1, TC2, ... , TCn } ) = { TC1 ▹ TC2 ▹ ... ▹ TCn } C1 < C2 < ... < Cnyounger older Default policy Pa 23
  • 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. 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. Licence 24 creativecommons.org/licenses/by-nc-sa/3.0