Designing event-based context transition in context-oriented programming

Tetsuo Kamina, Tomoyuki Aotani, Hidehiko Masuhara
2010 Proceedings of the 2nd International Workshop on Context-Oriented Programming - COP '10  
This paper proposes a new programming language EventCJ. Its design stems from our observation that, in many contextaware applications, context changes are triggered by external events. Thus, in addition to the current COP language mechanisms, namely the one to activate/deactivate layers in accordance with a flow of control in programs, and the one to dispatch method calls to partial methods on active layers, we propose a mechanism to declaratively switch contexts of the receiver of events.
more » ... CJ can declare events that trigger context transitions, and context transition rules that define how each instance's context changes when it receives a specific event. After the transition, the instance acquires the context dependent behaviors provided by the activated context. Each event is declared in an AspectJ-like pointcut that specifies where the event is fired in the join points of the system. EventCJ separates the specification of when each context is activated and deactivated that may crosscut whole program in the existing COP languages. Furthermore, the declarative nature of the context transition rules help validation of some properties that the contexts should satisfy.
doi:10.1145/1930021.1930023 dblp:conf/ecoop/KaminaAM10 fatcat:qfnh3g2j2jbjfmfs2gsw2grjii