1. Context-oriented programming is a programming language technique that enables behavioral adaptations to a system's surrounding execution context.
2. It allows behaviors to be defined through traits that can be activated or deactivated at runtime depending on the current context.
3. This approach addresses issues with disconnected behavior definitions and the need to select the appropriate implementation at runtime.
13. Motivation5
Software systems are not isolated, they interact and
influence each other
2.
1. Complexity of systems is increasing (data, connections)
14. Motivation5
Software systems are not isolated, they interact and
influence each other
2.
1. Complexity of systems is increasing (data, connections)
3. Users’ expectancy for personalization and interaction increases
15. Motivation5
Software systems are not isolated, they interact and
influence each other
2.
4. Programming models for such systems are inadequate
1. Complexity of systems is increasing (data, connections)
3. Users’ expectancy for personalization and interaction increases
16. Programming models that foster
systems to interact and influence each
other, as to maximize personalization
6
17. Dynamic adaptations to the context7
Sensors
World
Management
Actuators
Application
Behavior
Discovery
(Active)
Representation
Architecture Middleware Language Formalisms
Workflows
Petri nets
Symbolic execution
Constraint programming
SMT solvers
Dependency injection
COP
Role programming
model
Event systems
Reactive
programming
Model free learning
Logic programming
Dataflow graphs
Petri nets
[Cadiz, et al. Orchestrating Context-Aware Systems. CASTA’09]
20. Context-oriented programming8
… “programming language technique to enable behavioral
adaptations to a system’s surrounding context of execution”…
What is context?
context := Semantically meaningful information gathered from monitors and sensors
21. Context-oriented programming8
… “programming language technique to enable behavioral
adaptations to a system’s surrounding context of execution”…
What is context?
Discovery
context := Semantically meaningful information gathered from monitors and sensors
.4807.038,N.
01131.000,E.
.10º.10º.11º. Interpretation & Reasoning
22. Context-oriented programming8
… “programming language technique to enable behavioral
adaptations to a system’s surrounding context of execution”…
What is context?
Discovery
context := Semantically meaningful information gathered from monitors and sensors
.4807.038,N.
01131.000,E.
.10º.10º.11º.
GPSAntenna
Interpretation & Reasoning
23. Context-oriented programming8
… “programming language technique to enable behavioral
adaptations to a system’s surrounding context of execution”…
What is context?
Discovery
context := Semantically meaningful information gathered from monitors and sensors
.4807.038,N.
01131.000,E.
.10º.10º.11º.
GPSAntenna
Interpretation & Reasoning
GPSAntenna = cop.Context({
name: “GPS”,
slice: “localization”
});
61. Coherence20
function main() {
. . . // get user info and configuration
Galileo.activate([GPSAntenna], ‘strict);
console.log(“Display position? [y/n]”);
if(readLine() == “yes”) {
var pos = this.getPosition();
this.displayPosition(pos);
}
[Cardozo et al. Runtime validation of behavioral adaptations. COP’14]
Management
62. Coherence20
(format "Display position? [y/n]")
(equal (read) "y")
(defvar pos
(get-position *user*))
(display-position pos)
!!! car called on object
(format "Display position? [y/n]")
(equal (read) "y")
(defvar pos
(get-position *user*))
(display-position pos)
function main() {
. . . // get user info and configuration
Galileo.activate([GPSAntenna], ‘strict);
console.log(“Display position? [y/n]”);
if(readLine() == “yes”) {
var pos = this.getPosition();
this.displayPosition(pos);
}
[Cardozo et al. Runtime validation of behavioral adaptations. COP’14]
Management
63. Coherence20
(format "Display position? [y/n]")
(equal (read) "y")
(defvar pos
(get-position *user*))
(display-position pos)
!!! car called on object
(format "Display position? [y/n]")
(equal (read) "y")
(defvar pos
(get-position *user*))
(display-position pos)
function main() {
. . . // get user info and configuration
Galileo.activate([GPSAntenna], ‘strict);
console.log(“Display position? [y/n]”);
if(readLine() == “yes”) {
var pos = this.getPosition();
this.displayPosition(pos);
}
(format "Display position? [y/n]")
(equal (read) "y")
(defvar pos
(get-position *user*))
(display-position pos)
!!! car called on object
(format "Display position? [y/n]")
(equal (read) "y")
(defvar pos
(get-position *user*))
(display-position pos)
[Cardozo et al. Runtime validation of behavioral adaptations. COP’14]
Management
75. Learning services26
Mordor
Available Services:
1. Walking route
2. Sight impaired navigation
Home automation servicesResource servicesUser preference servicesNavigation services
3. Step free route
4. Guider tour
76. @ncardoz
What I do…27
✓ Programming model for adaptive systems
✓ Modularity, smartness, extensibility, conciseness, …
✓ Manage the increasing complexity
✓ Open and distributed systems
✓ Responsive to the environment
✓ Interact and influence each other
✓ Adaptation to unknown situations
✓ “Safe”
77. @ncardoz
What I do…27
Questions?
✓ Programming model for adaptive systems
✓ Modularity, smartness, extensibility, conciseness, …
✓ Manage the increasing complexity
✓ Open and distributed systems
✓ Responsive to the environment
✓ Interact and influence each other
✓ Adaptation to unknown situations
✓ “Safe”