Context
The context-oriented programming paradigm is designed to enable self-adaptation, or dynamic behavior modification of software systems, in response to changes in their surrounding environment. Contextoriented programming offers an adaptation model, from a programming language perspective, that maintains a clean modularisation between the application and adaptation logic, as well as between the components providing adaptations.
Objective
We use three implementation techniques for context-oriented programming languages to assess their appropriateness to foster self-adaptive systems. These approaches take advantage of the capabilities offered by the host programming language to realize self-adaptation as proposed by context-oriented languages.
Method
We evaluate each of these approaches by assessing their modularity and complexity when defining adaptations, and by comparing their run-time performance on a simple benchmark.
Results
Our results show a higher modularity than that for common architecture based self-adaptive systems, while maintaining comparable performance.
Conclusion
We conclude that context-oriented programming is an appropriate paradigm to realize self-adaptation.
Link to the paper: https://doi.org/10.1016/j.infsof.2021.106789
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
[JIST] Programming language implementations for context-oriented self-adaptive systems
1. Nicolás Cardozo1 Kim Mens2
1Systems and Computing Engineering department - Universidad de los Andes, Bogotá - Colombia
2ICTEAM - UCLouvain, Louvain-la-Neuve - Belgium
kim.mens@uclouvain.be, n.cardozo@uniandes.edu.co
@ncardoz
Programming language
implementations for context-
oriented self-adaptive systems
INTERNATIONAL CONFERENCE ON PROGRAM COMPREHENSION
2. Journal of Information and Software Technology
Volume 143, March 2022
Nicolás Cardozo1 Kim Mens2
1Systems and Computing Engineering department - Universidad de los Andes, Bogotá - Colombia
2ICTEAM - UCLouvain, Louvain-la-Neuve - Belgium
kim.mens@uclouvain.be, n.cardozo@uniandes.edu.co
@ncardoz
Programming language
implementations for context-
oriented self-adaptive systems
13. 7
Context-oriented programming
Contexts as first-class
entities of the system
Behavioral variations
as fine-grained
(partial) statements
isolated from the
system
activation and
deactivation
mechanisms to
compose and
withdraw system
behavior
@context English @contexts English
-(NSString*) name {
…
}
@activate(English)
@deactivate(English)
14. 8
Context-dependent method dispatch
(defmethod display-poi-info (poi)
(print “basic poi info”))
Use dispatch mechanisms to direct messages to the
appropriate implementation according to the context
Ambience - [Gonzalez et al. JUC 2008]
15. 8
Context-dependent method dispatch
Use dispatch mechanisms to direct messages to the
appropriate implementation according to the context
(with-context (@wifi)
)
(defmethod display-poi-info (poi)
(format t “~a n
Description: ~a ”
(name poi)
(detail-description poi))
Ambience - [Gonzalez et al. JUC 2008]
16. 8
Context-dependent method dispatch
Use dispatch mechanisms to direct messages to the
appropriate implementation according to the context
(with-context (@wifi)
)
(defgeneric display-poi-info (poi)
...)
Ambience - [Gonzalez et al. JUC 2008]
17. 8
Context-dependent method dispatch
Use dispatch mechanisms to direct messages to the
appropriate implementation according to the context
(with-context (@wifi)
)
(defmethod display-poi-info (poi)
(print “basic poi info”))
(defgeneric display-poi-info (poi)
...)
amos::send
Ambience - [Gonzalez et al. JUC 2008]
18. 8
Context-dependent method dispatch
Use dispatch mechanisms to direct messages to the
appropriate implementation according to the context
(with-context (@wifi)
)
(defmethod display-poi-info (@wifi poi)
(format t “~a n
Description: ~a”
(name poi)
(detail-description poi))
(defgeneric display-poi-info (poi)
...) amos::send
amos::prepend-slot
(activate @wifi)
Ambience - [Gonzalez et al. JUC 2008]
19. 9
Method replacement mechanisms
At the MOP level, switch method implementations between base
and adaptive behavior
void displayPOI (POI poi) {
NSString *res = @“%@ ”
NSLog(res, poi.description);
}
Subjective-C - [Gonzalez et al. SLE 2010]
20. 9
Method replacement mechanisms
At the MOP level, switch method implementations between base
and adaptive behavior
void displayPOI (POI poi) {
NSString *res = @“%@ ”
NSLog(res, poi.description);
}
displayPOI NSString *res = @“%@”
NSLog(res, poi.description);
SEL
IMP
Subjective-C - [Gonzalez et al. SLE 2010]
21. 9
Method replacement mechanisms
At the MOP level, switch method implementations between base
and adaptive behavior
void displayPOI (POI poi) {
NSString *res = @“%@ ”
NSLog(res, poi.description);
}
displayPOI
NSString *res = @“%@ n Description:
%@ ”
NSLog(res, poi.name,
poi.longDescription());
NSString *res = @“%@”
NSLog(res, poi.description);
@contexts Wifi
void displayPOI (POI poi) {
NSString *res = @“%@ n Description: %@ ”
NSLog(res, poi.name, poi.longDescription());
}
SEL
IMP
Subjective-C - [Gonzalez et al. SLE 2010]
22. 9
Method replacement mechanisms
At the MOP level, switch method implementations between base
and adaptive behavior
void displayPOI (POI poi) {
NSString *res = @“%@ ”
NSLog(res, poi.description);
}
displayPOI NSString *res = @“%@ n Description:
%@ ”
NSLog(res, poi.name,
poi.longDescription());
NSString *res = @“%@”
NSLog(res, poi.description);
@contexts Wifi
void displayPOI (POI poi) {
NSString *res = @“%@ n Description: %@ ”
NSLog(res, poi.name, poi.longDescription());
}
@activate(Wifi)
SEL
IMP
Subjective-C - [Gonzalez et al. SLE 2010]
24. 10
Fine-grained composition
Fine-grained module to be composed as appropriate for
specific situations
POI
- description
- displayPOI
- name
Wi
fi
<<trait>>
- description
- displayPOI
Wifi.activate()
Context Traits - [Gonzalez et al. AOSD 2013]
25. 10
Fine-grained composition
Fine-grained module to be composed as appropriate for
specific situations
POI
- description
- displayPOI
- name
Wi
fi
<<trait>>
- description
- displayPOI
+
POI
- description
- displayPOI
- name
=
Wifi.activate()
Context Traits - [Gonzalez et al. AOSD 2013]
32. @FLAGlab in all media channels
Journal of Information and Software Technology
Volume 143, March 2022
Programming language
implementations for context-oriented
self-adaptive systems
Nicolás Cardozo1 Kim Mens2
1Systems and Computing Engineering department - Universidad de los Andes, Bogotá - Colombia
2ICTEAM - UCLouvain, Louvain-la-Neuve - Belgium
kim.mens@uclouvain.be, n.cardozo@uniandes.edu.co @ncardoz