ambience in a nutshell
DESCRIPTION
Programming in Ambience - gearing up for dynamic adaptation to context.TRANSCRIPT
June 2010
gearing up for dynamic adaptation to contextAmbience
programming in
Dr. Sebastián González & Prof. Kim Mens
École Polytechnique de LouvainUniversité catholique de Louvain
Pôle d’ingénierie informatiqueICTEAM
Thursday 17 June 2010
Programming desktops and servers
2Thursday 17 June 2010
Programming for Ambient Intelligence
2Thursday 17 June 2010
Programming for Ambient Intelligence
2Thursday 17 June 2010
Programming for Ambient Intelligence
2Thursday 17 June 2010
Programming for Ambient Intelligence
2Thursday 17 June 2010
Programming for Ambient Intelligence
2Thursday 17 June 2010
Programming for Ambient Intelligence
2Thursday 17 June 2010
Programming for Ambient Intelligence
2Thursday 17 June 2010
... is programming with context in mindProgramming for Ambient Intelligence
2Thursday 17 June 2010
... is programming with context in mindProgramming for Ambient IntelligenceNew hardware phenomena unveil new opportunities for delivering
specific services according to the physical and logical environment of use
2Thursday 17 June 2010
Examples
take advantage of room projector for presentation
user task
disable phone ringtone in quiet placeslocation semantics
decrease playback quality when battery power is lowinternal state
peer service
environmental conditionsgive more detailed indications when visibility is low
show parking spots and gas stations while driving
3Thursday 17 June 2010
4
Running Examplecall reception behaviour
Thursday 17 June 2010
4
context behaviour
Running Examplecall reception behaviour
Thursday 17 June 2010
4
context behaviour
Running Examplecall reception behaviour
ringtonedefault
Thursday 17 June 2010
4
context behaviour
Running Examplecall reception behaviour
vibrationquiet
Thursday 17 June 2010
off-hook
4
call waiting signal
context behaviour
Running Examplecall reception behaviour
Thursday 17 June 2010
unavailable
4
forward call
context behaviour
Running Examplecall reception behaviour
Thursday 17 June 2010
4
context behaviour
Running Examplecall reception behaviour
quietoff-hook +
Thursday 17 June 2010
4
context behaviour
Running Examplecall reception behaviour
quietoff-hook + call waiting signal
Thursday 17 June 2010
class phone {
method receive ( call ) {
if ( phone.isOffHook( ) )play( phone.callWaitingSignal( ), 2 );
else if ( phone.environment( ).acoustics( ).isQuiet( ) )phone.vibrate( 5 );
else if ( phone.user( ).isUnavailable( ) )forwardCall( call, phone.forwardNumber( ) );
elseplay( phone.ringTone( ), 10 );
}
conditional statementsContemporary Solution
5Thursday 17 June 2010
class phone {
method receive ( call ) {
if ( phone.isOffHook( ) )play( phone.callWaitingSignal( ), 2 );
else if ( phone.environment( ).acoustics( ).isQuiet( ) )phone.vibrate( 5 );
else if ( phone.user( ).isUnavailable( ) )forwardCall( call, phone.forwardNumber( ) );
elseplay( phone.ringTone( ), 10 );
}
conditional statements
Tangled
Fixed
Contemporary Solution
5
Scattered
Thursday 17 June 2010
class Phone{ attribute strategy; method receive ( call ) { strategy.receive( call ); } }
special software architectureContemporary Solution
6Thursday 17 June 2010
class UnavailableStrategy{ method receive ( call ) { ... } }
class QuietStrategy{ method receive ( call ) { ... } }
class OffHookStrategy{ method receive ( call ) { ... } }
class DefaultStrategy{ method receive ( call ) { ... } }
class Phone{ attribute strategy; method receive ( call ) { strategy.receive( call ); } }
UnavailableStrategy
OffHookStrategy
special software architectureContemporary Solution
6
QuietStrategyPhone
DefaultStrategy
Thursday 17 June 2010
class UnavailableStrategy{ method receive ( call ) { ... } }
class QuietStrategy{ method receive ( call ) { ... } }
class OffHookStrategy{ method receive ( call ) { ... } }
class DefaultStrategy{ method receive ( call ) { ... } }
class Phone{ attribute strategy; method receive ( call ) { strategy.receive( call ); } }
UnavailableStrategy
OffHookStrategy
special software architectureContemporary Solution
6
QuietStrategyPhone
DefaultStrategy
Thursday 17 June 2010
class UnavailableStrategy{ method receive ( call ) { ... } }
class QuietStrategy{ method receive ( call ) { ... } }
class OffHookStrategy{ method receive ( call ) { ... } }
class DefaultStrategy{ method receive ( call ) { ... } }
class Phone{ attribute strategy; method receive ( call ) { strategy.receive( call ); } }
UnavailableStrategy
OffHookStrategy
special software architectureContemporary Solution
6
QuietStrategyPhone
DefaultStrategy
Infrastructural burdenAnticipated adaptation points
Thursday 17 June 2010
class UnavailableStrategy{ method receive ( call ) { ... } }
class QuietStrategy{ method receive ( call ) { ... } }
class OffHookStrategy{ method receive ( call ) { ... } }
class DefaultStrategy{ method receive ( call ) { ... } }
class Phone{ attribute strategy; method receive ( call ) { strategy.receive( call ); } }
UnavailableStrategy
OffHookStrategy
special software architectureContemporary Solution
6
QuietStrategyPhone
DefaultStrategy
Infrastructural burdenAnticipated adaptation points
in Ambient Intelligencedynamic adaptation is commonplace
rather than an occasional need
Thursday 17 June 2010
From programming in isolation...
Programming languages do not feature dedicated abstractions to deal
with contexts and corresponding behavioural adaptations at run time
... to programmingin Ambience
Develop programming abstractions to permit the natural expression of adaptable behaviour according
to changing contexts7
Thursday 17 June 2010
Context Reification
8
current-context
First-class context
Thursday 17 June 2010
Context Reification
8
advertise
telephony
current-context
First-class context
Thursday 17 June 2010
Context Reification
8
advertise
quiet
advertise
telephony
meeting
current-context
First-class context
Thursday 17 June 2010
Context Reification
8
advertise
off-hook
advertise
quiet
advertise
telephony
meeting
current-context
First-class context
Thursday 17 June 2010
Context Reification
8
advertise
off-hook
advertise
quiet
advertise
telephony
meeting
advertise
off-hook+quiet
current-context
First-class context
Thursday 17 June 2010
Context Reification
8
advertise
off-hook
advertise
quiet
advertise
telephony
meeting
advertise
off-hook+quiet
current-context
• partly managed by user• partly managed by system
First-class context
Thursday 17 June 2010
receive: alices-call on: bobs-phone
9
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ]
Call Reception Behaviour
1
Running Example in Ambience
Thursday 17 June 2010
receive: alices-call on: bobs-phone
9
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ]
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ]
Call Reception Behaviour
1
Running Example in Ambience
Thursday 17 June 2010
receive: alices-call on: bobs-phone
9
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ]
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ]
application logic
Call Reception Behaviour
1
Running Example in Ambience
Thursday 17 June 2010
receive: alices-call on: bobs-phone
9
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ]
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ]
application logic
how do we express adaptations of base application logic to context?
Call Reception Behaviour
1
Running Example in Ambience
Thursday 17 June 2010
4
10
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ].
advertise: call (phone-call) on: phone (mobile-phone)[ if: phone is-off-hook then: [ play: phone call-waiting-signal during: 3 seconds ] else: [ play: phone ringtone during: 20 seconds ] ].
application logic
1 2
Basic Telephony Behaviour
Thursday 17 June 2010
4
10
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ].
advertise: call (phone-call) on: phone (mobile-phone)[ if: phone is-off-hook then: [ play: phone call-waiting-signal during: 3 seconds ] else: [ play: phone ringtone during: 20 seconds ] ].
application logic
1 2
Basic Telephony Behaviour
Fixed
Thursday 17 June 2010
receive: alices-call on: bobs-phone
advertise: call (phone-call) on: phone (mobile-phone)[ activate: phone vibrator during: 10 seconds ]
Implicit Context Specialisation
11
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ]
Thursday 17 June 2010
(current-context)
current-activation
in-context: quiet do:[
]
receive: alices-call on: bobs-phone
advertise: call (phone-call) on: phone (mobile-phone)[ activate: phone vibrator during: 10 seconds ]
Implicit Context Specialisation
11
implicit explicit
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ]
Thursday 17 June 2010
current-context
current-activation
in-context: quiet do:[
]
receive: alices-call on: bobs-phone
advertise: call (phone-call) on: phone (mobile-phone)[ activate: phone vibrator during: 10 seconds ]
Implicit Context Specialisation
11
phone-call mobile-phone
bobs-phone
implicit explicit
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ]
alices-callcurrent-activation
Thursday 17 June 2010
in-context: quiet do:[
]
receive: alices-call on: bobs-phone
advertise: call (phone-call) on: phone (mobile-phone)[ activate: phone vibrator during: 10 seconds ]
Implicit Context Specialisation
11
phone-call mobile-phone
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ]
quiet
Thursday 17 June 2010
in-context: quiet do:[ advertise: call (phone-call) on: phone (mobile-phone) [ activate: phone vibrator during: 10 seconds ] ]
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ].
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ].
12
application logic
adaptation logic
Context-Specific Behaviour
Thursday 17 June 2010
in-context: quiet do:[ advertise: call (phone-call) on: phone (mobile-phone) [ activate: phone vibrator during: 10 seconds ] ]
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ].
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ].
12
straightforward application logic
adaptation logic
Context-Specific Behaviour
Thursday 17 June 2010
in-context: quiet do:[ advertise: call (phone-call) on: phone (mobile-phone) [ activate: phone vibrator during: 10 seconds ] ]
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ].
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ].
12
straightforward
non-intrusive
application logic
adaptation logic
Context-Specific Behaviour
Thursday 17 June 2010
in-context: quiet do:[ advertise: call (phone-call) on: phone (mobile-phone) [ activate: phone vibrator during: 10 seconds ] ]
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ].
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ].
12
application logic
adaptation logic
Context-Specific Behaviour
Thursday 17 June 2010
in-context: off-hook do:[ advertise: call (phone-call) on: phone (mobile-phone) [ play: phone call-waiting-signal during: 3 seconds ] ]
13
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ].
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ].
application logic
application logic
Adapted Telephony Behaviour
Thursday 17 June 2010
in-context: off-hook do:[ advertise: call (phone-call) on: phone (mobile-phone) [ play: phone call-waiting-signal during: 3 seconds ] ]
13
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ].
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ].
straightforward application logic
application logic
Adapted Telephony Behaviour
Thursday 17 June 2010
in-context: off-hook do:[ advertise: call (phone-call) on: phone (mobile-phone) [ play: phone call-waiting-signal during: 3 seconds ] ]
13
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ].
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ].
straightforward application logic
simplified application logic
Adapted Telephony Behaviour
Thursday 17 June 2010
in-context: off-hook do:[ advertise: call (phone-call) on: phone (mobile-phone) [ play: phone call-waiting-signal during: 3 seconds ] ]
13
advertise: call (phone-call) on: phone (mobile-phone)[ play: phone ringtone during: 20 seconds ].
receive: call (phone-call) on: phone (mobile-phone)[ advertise: call on: phone. enqueue: call in: phone incoming-calls ].
application logic
application logic
Adapted Telephony Behaviour
Thursday 17 June 2010