ambience in a nutshell

52
June 2010 gearing up for dynamic adaptation to context Ambience programming in Dr. Sebastián González & Prof. Kim Mens École Polytechnique de Louvain Université catholique de Louvain Pôle d’ingénierie informatique ICTEAM Thursday 17 June 2010

Upload: kimmens

Post on 15-May-2015

296 views

Category:

Technology


2 download

DESCRIPTION

Programming in Ambience - gearing up for dynamic adaptation to context.

TRANSCRIPT

Page 1: Ambience In A Nutshell

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

Page 2: Ambience In A Nutshell

Programming desktops and servers

2Thursday 17 June 2010

Page 3: Ambience In A Nutshell

Programming for Ambient Intelligence

2Thursday 17 June 2010

Page 4: Ambience In A Nutshell

Programming for Ambient Intelligence

2Thursday 17 June 2010

Page 5: Ambience In A Nutshell

Programming for Ambient Intelligence

2Thursday 17 June 2010

Page 6: Ambience In A Nutshell

Programming for Ambient Intelligence

2Thursday 17 June 2010

Page 7: Ambience In A Nutshell

Programming for Ambient Intelligence

2Thursday 17 June 2010

Page 8: Ambience In A Nutshell

Programming for Ambient Intelligence

2Thursday 17 June 2010

Page 9: Ambience In A Nutshell

Programming for Ambient Intelligence

2Thursday 17 June 2010

Page 10: Ambience In A Nutshell

... is programming with context in mindProgramming for Ambient Intelligence

2Thursday 17 June 2010

Page 11: Ambience In A Nutshell

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

Page 12: Ambience In A Nutshell

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

Page 13: Ambience In A Nutshell

4

Running Examplecall reception behaviour

Thursday 17 June 2010

Page 14: Ambience In A Nutshell

4

context behaviour

Running Examplecall reception behaviour

Thursday 17 June 2010

Page 15: Ambience In A Nutshell

4

context behaviour

Running Examplecall reception behaviour

ringtonedefault

Thursday 17 June 2010

Page 16: Ambience In A Nutshell

4

context behaviour

Running Examplecall reception behaviour

vibrationquiet

Thursday 17 June 2010

Page 17: Ambience In A Nutshell

off-hook

4

call waiting signal

context behaviour

Running Examplecall reception behaviour

Thursday 17 June 2010

Page 18: Ambience In A Nutshell

unavailable

4

forward call

context behaviour

Running Examplecall reception behaviour

Thursday 17 June 2010

Page 19: Ambience In A Nutshell

4

context behaviour

Running Examplecall reception behaviour

quietoff-hook +

Thursday 17 June 2010

Page 20: Ambience In A Nutshell

4

context behaviour

Running Examplecall reception behaviour

quietoff-hook + call waiting signal

Thursday 17 June 2010

Page 21: Ambience In A Nutshell

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

Page 22: Ambience In A Nutshell

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

Page 23: Ambience In A Nutshell

class Phone{ attribute strategy; method receive ( call ) { strategy.receive( call ); } }

special software architectureContemporary Solution

6Thursday 17 June 2010

Page 24: Ambience In A Nutshell

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

Page 25: Ambience In A Nutshell

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

Page 26: Ambience In A Nutshell

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

Page 27: Ambience In A Nutshell

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

Page 28: Ambience In A Nutshell

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

Page 29: Ambience In A Nutshell

Context Reification

8

current-context

First-class context

Thursday 17 June 2010

Page 30: Ambience In A Nutshell

Context Reification

8

advertise

telephony

current-context

First-class context

Thursday 17 June 2010

Page 31: Ambience In A Nutshell

Context Reification

8

advertise

quiet

advertise

telephony

meeting

current-context

First-class context

Thursday 17 June 2010

Page 32: Ambience In A Nutshell

Context Reification

8

advertise

off-hook

advertise

quiet

advertise

telephony

meeting

current-context

First-class context

Thursday 17 June 2010

Page 33: Ambience In A Nutshell

Context Reification

8

advertise

off-hook

advertise

quiet

advertise

telephony

meeting

advertise

off-hook+quiet

current-context

First-class context

Thursday 17 June 2010

Page 34: Ambience In A Nutshell

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

Page 35: Ambience In A Nutshell

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

Page 36: Ambience In A Nutshell

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

Page 37: Ambience In A Nutshell

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

Page 38: Ambience In A Nutshell

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

Page 39: Ambience In A Nutshell

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

Page 40: Ambience In A Nutshell

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

Page 41: Ambience In A Nutshell

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

Page 42: Ambience In A Nutshell

(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

Page 43: Ambience In A Nutshell

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

Page 44: Ambience In A Nutshell

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

Page 45: Ambience In A Nutshell

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

Page 46: Ambience In A Nutshell

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

Page 47: Ambience In A Nutshell

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

Page 48: Ambience In A Nutshell

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

Page 49: Ambience In A Nutshell

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

Page 50: Ambience In A Nutshell

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

Page 51: Ambience In A Nutshell

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

Page 52: Ambience In A Nutshell

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