Please wait a minute...
Frontiers of Computer Science

ISSN 2095-2228

ISSN 2095-2236(Online)

CN 10-1014/TP

Postal Subscription Code 80-970

2018 Impact Factor: 1.129

Front. Comput. Sci.    2014, Vol. 8 Issue (1) : 17-32    https://doi.org/10.1007/s11704-013-2337-6
RESEARCH ARTICLE
Runtime support for type-safe and context-based behavior adaptation
Changpeng ZHU, Yinliang ZHAO(), Bo HAN, Qinghua ZENG, Ying MA
Department of Computer Science, Xi’an Jiaotong University, Xi’an 710049, China
 Download: PDF(1276 KB)  
 Export: BibTeX | EndNote | Reference Manager | ProCite | RefWorks
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 type system      context-oriented programming      object composition      delegation      featherweight Java     
Corresponding Author(s): ZHAO Yinliang   
Issue Date: 01 February 2014
 Cite this article:   
Changpeng ZHU,Yinliang ZHAO,Bo HAN, et al. Runtime support for type-safe and context-based behavior adaptation[J]. Front. Comput. Sci., 2014, 8(1): 17-32.
 URL:  
https://academic.hep.com.cn/fcs/EN/10.1007/s11704-013-2337-6
https://academic.hep.com.cn/fcs/EN/Y2014/V8/I1/17
1 Hirschfeld R, Costanza P, Nierstrasz O. Context-oriented programming. Journal of Object Technology, 2008, 7(3): 125-151
doi: 10.5381/jot.2008.7.3.a4
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
doi: 10.1145/2162049.2162072
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
doi: 10.1145/2384592.2384600
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
doi: 10.1145/2048066.2048129
9 Bettini L, Bono V, Venneri B. Delegation by object composition. Science Computer Programming, 2011, 76(11)
doi: 10.1016/j.scico.2010.04.006
10 Lieberman H. Using prototypical objects to implement shared behavior in object-oriented systems. ACM SIGPLAN Notices, 1986, 21(11): 214-223
doi: 10.1145/960112.28718
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
doi: 10.1145/503502.503505
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
doi: 10.1006/inco.1994.1093
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
doi: 10.1145/1297027.1297029
17 Hedin G, Magnusson E. JastAdd–an aspect-oriented compiler construction system. Science of Computer Programming, 2003, 47(1): 37-58
doi: 10.1016/S0167-6423(02)00109-0
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
doi: 10.1007/978-3-540-30196-7_7
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
doi: 10.1145/1562112.1562118
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
doi: 10.1145/1146841.1146842
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
doi: 10.1145/1960510.1960515
24 Subramanian S, Hicks M, McKinley K S. Dynamic software updates: a VM-centric approach. ACM Sigplan Notices, 2009, 44(6): 1-12
doi: 10.1145/1543135.1542478
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
doi: 10.1145/1052883.1052896
30 Zhao Y, Zhu C, Han B, Zeng Q. Calculus using fitness testing for method redirection. Journal of Software, 2013, 24(7): 1495-1511
doi: 10.3724/SP.J.1001.2013.04269
[1] Qin SHU, Zongyan QIU, Shuling WANG. Confinement framework for encapsulating objects[J]. Front Comput Sci, 2013, 7(2): 236-256.
[2] Wei KE, Zhiming LIU, Shuling WANG, Liang ZHAO. A graph-based generic type system for object-oriented programs[J]. Front Comput Sci, 2013, 7(1): 109-134.
[3] Baojian HUA. Static typing for a substructural lambda calculus[J]. Front Comput Sci Chin, 2011, 5(3): 369-380.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed