Declarative Layer Composition with The JCop Programming Language

Malte Appeltauer, Robert Hirschfeld, Jens Lincke
2013 Journal of Object Technology  
Program behavior that relies on contextual information, such as physical location or network accessibility, is common in today's applications, yet its representation at the source code level is not sufficiently supported by programming languages. With context-oriented programming (COP), context-dependent behavior can be explicitly modularized and dynamically activated. The available COP implementations offer language constructs that allow to describe context-dependent functionality and to
more » ... y for which control flows this functionality should be executed. Since these language constructs require modifications to the source code, the contemporary approaches limit the use of COP to program parts whose source code is accessible to the developer (the user code). The dynamic control over context-dependent behavior in frameworks cannot be directly addressed by COP as this would imply changes to the source code. Instead, context-dependent behavior is addressed whenever a control flow from the framework code enters the user code. Context composition must be addressed at any of these control flow entry points, which may lead to a redundant specification of this functionality. As a result, dynamic control over layers emerges as a crosscutting concern that obstructs the separation of concerns. In this article, we discuss crosscutting layer composition in frameworkbased applications in detail. Moreover, we discuss limitations for the expression of semantic relationships of layers that might lead to code duplication. We present a framework-based application, a simple action adventure game that we implemented using a conventional COP language. Along this example, we show how our JCop language supports the declaration of layer composition and expression of layer relationships.
doi:10.5381/jot.2013.12.2.a4 fatcat:4azd7ptwfngfposwxogdmixo7e