context traits dynamic behaviour adaptation through run-time trait recomposition

Post on 28-Nov-2014

411 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

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.

TRANSCRIPT

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

Towards a Mindset Shift 2

programming in isolation programming with context

forward!

??

??

?

?

Towards a Mindset Shift 2

CautionDesign patterns

Plugin architecturesConditional statements

...

programming in isolation programming with context

forward!

??

??

?

?

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

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

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

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 }

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

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

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

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

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

Layer-Based COP 5

Later on...

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

‣ Contexts‣ Traits‣ Context-Driven Trait Compositions‣ Composition Policies‣ Behaviour Extensibility‣ Context Traits in JavaScript

In This Presentation 7

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

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

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

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

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

T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute

T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren

Traits as Basic Behavioural Units 9

tag a1=”v1” a2=”v2”

T.ElementT.ElementelementsByTagNameelementsByAttribute

getAttributesetAttributewalkChildren

T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute

T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren

Traits as Basic Behavioural Units 9

tag a1=”v1” a2=”v2”

T.ElementT.ElementelementsByTagNameelementsByAttribute

getAttributesetAttributewalkChildren

providedmethods

T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute

T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren

Traits as Basic Behavioural Units 9

tag a1=”v1” a2=”v2”

T.ElementT.ElementelementsByTagNameelementsByAttribute

getAttributesetAttributewalkChildren

requiredmethods

T.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute

T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren

Traits as Basic Behavioural Units 9

+

+

tag a1=”v1” a2=”v2”

T.ElementT.ElementelementsByTagNameelementsByAttribute

getAttributesetAttributewalkChildren

sumoperator

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.TagT.TagtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttribute

T.NodeT.NodecontentparentappendChildreplaceChildremoveChildwalkChildren

XML.ElementXML.ElementtagNameaddAttributegetAttributesetAttributeremoveAttributeforEachAttributecontentparentappendChildreplaceChildremoveChildwalkChildrenidelementsByTagNameelementsByAttribute

Traits as Basic Behavioural Units 9

+

+

tag a1=”v1” a2=”v2”

T.ElementT.ElementelementsByTagNameelementsByAttribute

getAttributesetAttributewalkChildren

=

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

=

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 ]

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

=

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

Default Behaviour & Context 10

HTML.ElementaddAttributegetAttribute...styletitle

T.HTML.ElementT.HTML.Elementclassstyletitle

getAttributesetAttribute

= XML.Element +

= 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 +

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

= 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

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 ∈ L

Context + Traits 11

... in JavaScriptContext Traits

let Default ∈ C Default = new Context();

a = new HTML.Anchor();let ida ∈ L

constitution: L ⨉ C → T

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

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

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

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

...

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

...

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

...

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 }

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 }

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

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

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

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

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

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

TD

Context-Driven Trait Composition

T1

T2

T3

T4T5

13

TD

Context-Driven Trait Composition

T1

T2

T3

T4T5

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

T1T2

T3

T4

T5

13

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▹ ▹

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?

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)

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 } ) =

{ }

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 } ) =

{ }

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 } ) =

{ }

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

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

T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent

...

Behaviour Extensibility Challenge 15

HTML.Anchor...setAttribute...

T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent

...

Behaviour Extensibility Challenge 15

HTML.Anchor...setAttribute...

T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent

...

how to invoke overridden behaviour?

Behaviour Extensibility Challenge 15

HTML.Anchor...setAttribute...

T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent

...

how to invoke overridden behaviour?

Behaviour Extensibility Challenge 15

HTML.Anchor...setAttribute...

[ htmlSetAttribute ↦ setAttribute ] =

HTML.Anchor’...setAttributehtmlSetAttribute...

T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent

...

how to invoke overridden behaviour?

Behaviour Extensibility Challenge 15

HTML.Anchor...setAttribute...

[ htmlSetAttribute ↦ setAttribute ] =

HTML.Anchor’...setAttributehtmlSetAttribute...

aliasing operator

T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent

...

how to invoke overridden behaviour?

Behaviour Extensibility Challenge 15

HTML.Anchor...setAttribute...

[ htmlSetAttribute ↦ setAttribute ] =

HTML.Anchor’...setAttributehtmlSetAttribute...

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 →

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

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 →

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 →

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▹

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

Extensibility Through proceed 16

HTML.Anchor...setAttribute...

T.ValidAnchorT.ValidAnchoraddAttributesetAttributeremoveAttributeparent

how to invoke overridden behaviour?

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

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

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

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

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

‣ 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

‣ 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⇋

In The Paper

‣ Default composition policy‣ Resolution of proceed chains through policies‣ Implementation technique for proceed‣ Case Studies

18

Questions?

Context Traits

19

Additional Slides

Resolution of proceed Through Policies 21

a bc d

T1

c gq

T2c() { ... self.proceed() ... }

c de f

c h

T3

· · ·

Resolution of proceed Through Policies 21

a bc d

T1

c gq

T2c() { ... self.proceed() ... }

c de f

c h

T3

· · ·

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

· · ·

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

· · ·

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

· · ·

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

Default policy Pa

23

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

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

top related