Runtime support for type-safe and context-based behavior adaptation

Changpeng ZHU, Yinliang ZHAO, Bo HAN, Qinghua ZENG, Ying MA

PDF(1276 KB)
PDF(1276 KB)
Front. Comput. Sci. ›› 2014, Vol. 8 ›› Issue (1) : 17-32. DOI: 10.1007/s11704-013-2337-6
RESEARCH ARTICLE

Runtime support for type-safe and context-based behavior adaptation

Author information +
History +

Abstract

Context-awareness is becoming critical for mobile and ubiquitous computing, where the application needs dynamically adapt its behavior to its execution environment. Context-oriented programming (COP) languages support dynamic behavior adaptation, however, they do not support dynamic layer addition. As a result, they provide little support for the runtime adaptation of application behavior in case that unpredictable execution environments are encountered. Furthermore, block-structured constructs for layer activation hardly support fine-grain adaptation and separate changes of contexts and execution of context-specific methods with difficulty. In this paper, we propose a virtual machine (VM)- centric approach to address these issues. It incorporates object composition and delegation into the VM to implement layer activation, and extends existing VM services to support dynamic layer addition. To ensure that our approach preserves the type safety properties of the program, we develop a calculus built on featherweight Java (FJ) to describe the approach, focus on type-checking issues, and prove type soundness of the calculus. We also present the implementation and evaluation of our approach. The evaluation demonstrates that our approach has advantages over the compilerbased approach proposed by JCOP.

Keywords

context-oriented programming / object composition / delegation / featherweight Java / type system

Cite this article

Download citation ▾
Changpeng ZHU, Yinliang ZHAO, Bo HAN, Qinghua ZENG, Ying MA. Runtime support for type-safe and context-based behavior adaptation. Front. Comput. Sci., 2014, 8(1): 17‒32 https://doi.org/10.1007/s11704-013-2337-6

References

[1]
Hirschfeld R, Costanza P, Nierstrasz O. Context-oriented programming. Journal of Object Technology, 2008, 7(3): 125-151
CrossRef Google scholar
[2]
Appeltauer M, Hirschfeld R, Masuhara H, Haupt M, Kawauchi K. Event-specific software composition in context-oriented programming. In: Software Composition. 2010, 50-65
[3]
Kamina T, Aotani T, Masuhara H. EventCJ: a context-oriented programming language with declarative event-based context transition. In: Proceedings of the 10th International Conference on Aspect-oriented Software Development. 2011, 253-264
[4]
Appeltauer M, Hirschfeld R, Haupt M, Masuhara H. ContextJ: contextoriented programming with Java. Information and Media Technologies, 2011, 6(2): 399-419
[5]
Rho T, Schmatz M, Cremers A B. Towards context-sensitive service aspects. In: Workshop on Object Technology for Ambient Intelligence and Pervasive Computing, co-located with ECOOP 06. 2006
[6]
Salvaneschi G, Ghezzi C, Pradella M. Contexterlang: introducing context-oriented programming in the actor model. In: Proceedings of the 11th Annual International Conference on Aspect-oriented Software Development. 2012, 191-202
CrossRef Google scholar
[7]
Bainomugisha E, Vallejos J, De Roover C, Carreton A L, DeMeuter W. Interruptible context-dependent executions: a fresh look at programming context-aware applications. In: Proceedings of the ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software. 2012, 67-84
CrossRef Google scholar
[8]
Würthinger T, Ansaloni D, Binder W, Wimmer C, Mössenböck H. Safe and atomic run-time code evolution for java and its application to dynamic aop. In: Proceedings of the 2011 ACM International Conference on Object Oriented Programming Systems Languages and Applications. 2011, 825-844
CrossRef Google scholar
[9]
Bettini L, Bono V, Venneri B. Delegation by object composition. Science Computer Programming, 2011, 76(11)
CrossRef Google scholar
[10]
Lieberman H. Using prototypical objects to implement shared behavior in object-oriented systems. ACM SIGPLAN Notices, 1986, 21(11): 214-223
CrossRef Google scholar
[11]
Igarashi A, Pierce B C, Wadler P. Featherweight Java: a minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems, 2001, 23(3): 396-450
CrossRef Google scholar
[12]
Lougher R. Jam V M. http://jamvm.sourceforge.net/, 2010
[13]
Apel S, Kästner C, Lengauer C. Feature featherweight Java: a calculus for feature-oriented programming and stepwise refinement. In: Proceedings of the 7th International Conference on Generative Programming and Component Engineering. 2008, 101-112
[14]
Bettini L, Bono V, Venneri B. Object incompleteness and dynamic composition in Java-like languages. Lecture Notes in Computer Science, 2008, 11: 198-217
[15]
Wright A K, Felleisen M. A syntactic approach to type soundness. Information and Computation, 1994, 115(1): 38-94
CrossRef Google scholar
[16]
Ekman T, Hedin G. The JastAdd extensible Java compiler. In: Proceedings of the 22nd annual ACM SIGPLAN Conference on Objectoriented Programming Systems and Applications. 2007, 1-18
CrossRef Google scholar
[17]
Hedin G, Magnusson E. JastAdd–an aspect-oriented compiler construction system. Science of Computer Programming, 2003, 47(1): 37-58
CrossRef Google scholar
[18]
Bull M, Smith L, Westhead M, Henty D, Davey R. Benchmarking java grande applications. In: Proceedings of the 2nd International Conference on The Pratical Application of Java. 2000
[19]
Haupt M, Mezini M. Micro-measurements for dynamic aspect-oriented systems. Lecture Notes in Computer Science, 2004, 3263: 81-96
CrossRef Google scholar
[20]
Appeltauer M, Hirschfeld R, Haupt M, Lincke J, Perscheid M. A comparison of context-oriented programming languages. In: Proceedings of International Workshop on Context-oriented Programming. 2009, 6:1-6:6
CrossRef Google scholar
[21]
Costanza P, Hirschfeld R. Language constructs for context-oriented programming: an overview of ContextL. In: Proceedings of the 2005 Symposium on Dynamic Languages. 2005, 1-10
CrossRef Google scholar
[22]
Steele G L. Common lisp the language, 2nd ed. Digital Press, 1990
[23]
Hirschfeld R, Igarashi A, Masuhara H. Contextfj: a minimal core calculus for context-oriented programming. In: Proceedings of the 10th International Workshop on Foundations of Aspect-oriented Languages. 2011, 19-23
CrossRef Google scholar
[24]
Subramanian S, Hicks M, McKinley K S. Dynamic software updates: a VM-centric approach. ACM Sigplan Notices, 2009, 44(6): 1-12
CrossRef Google scholar
[25]
Malabarba S, Pandey R, Gragg J, Barr E, Barnes J F. Runtime support for type-safe dynamic Java classes. In: Proceedings of the 14th European Conference on Object Oriented Programming. 2000, 337-361
[26]
Gamma E, Helm R, Johnson R, Vlissides J. Design patterns elements of reusable object-oriented software. Addison-Wesley Longman, 1995
[27]
Mukhija A, Glinz M. A framework for dynamically adaptive applications in a self-organized mobile network environment. In: Proceedings of the 24th International Conference on Distributed Computing Systems Workshops. 2004, 368-374
[28]
Tamai T, Ubayashi N, Ichiyama R. An adaptive object model with dynamic role binding. In: Proceedings of the 27th International Conference on Software Engineering. 2005, 166-175
[29]
Zhao Y. Granule-oriented programming. Sigplan Notices, 2004, 39(12): 107-118
CrossRef Google scholar
[30]
Zhao Y, Zhu C, Han B, Zeng Q. Calculus using fitness testing for method redirection. Journal of Software, 2013, 24(7): 1495-1511
CrossRef Google scholar

RIGHTS & PERMISSIONS

2014 Higher Education Press and Springer-Verlag Berlin Heidelberg
AI Summary AI Mindmap
PDF(1276 KB)

Accesses

Citations

Detail

Sections
Recommended

/