Abstract
Linguistic constructs such as if statements, dynamic dispatches, dynamic deployments, and layers in context-oriented programming (COP) are used to implement context-dependent behavior. Use of such constructs significantly affects the modularity of the obtained implementation. While there are a number of cases where COP improves modularity related to variations of context-dependent behavior and controls of dynamic behavior changes, it is unclear when COP should be used in general.
This paper presents a study of our software development methodology, context-oriented software engineering (COSE), which is a use-case-driven software development methodology that guides us to specification of context-dependent requirements and design. We develop a systematic method to determine an appropriate linguistic mechanism to implement context-dependent behavior and dynamic changes in behavior during modeling and design, leading to the mechanized mapping from requirements and design artifacts formed by COSE to the COP implementation, which is demonstrated in our COP language ServalCJ through three case studies. We then identify the key linguistic constructs that make COSE effective by examining existing COP languages.
This paper is an extended version of our previous papers [31, 33]. In this paper, we refine principles and provide a more detailed description of our methodology. It also contains a case study not included in previous work.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Some COP languages do not provide a linguistic construct to pack such implementations as a single unit. However, this is not a significant difference. In the remainder of this paper, we refer to a set of functions (methods) annotated with the same “conditions” for dispatch as a layer irrespective of whether they are packed into a single unit.
- 2.
This approach is based on Jacobson’s object-oriented software engineering (OOSE) [27]. We refer to our approach as “COSE” to make its connection to OOSE clear.
- 3.
- 4.
Keays also proposed COP [35], where a context is a named identifier (e.g., location) that identifies the type of open terms (holes in the code skeleton) that are filled at runtime with pieces of code corresponding to a specific context value (e.g., location in “Tokyo”). This paper is based on Hirschfeld’s COP [26] where a context is represented as a layer that dynamically takes two states, i.e., active and inactive, and thus can be represented as a Boolean variable.
- 5.
By “specialization,” we mean a specialization relationship that appears in class and use case hierarchies, i.e., a specialization consists of more details than its parent.
- 6.
- 7.
For COP languages that do not provide layer activation by conditionals, we must provide a workaround to implement such conditionals.
- 8.
- 9.
There are also before and around partial methods that execute before the original method and instead of the original method, respectively, when the respective layer is active.
- 10.
This simulator is inspired by a real maze-solving robot (Pololu 3pi Robot: http://www.pololu.com/product/975) and the behavior of the simulator is modeled by following the sample program provided by the 3pi Robot distribution.
- 11.
Only Trémaux’s algorithm can solve the maze with loops.
References
Abowd, G.D., Atkeson, C.G., Hong, J., Long, S., Kooper, R., Pinkerton, M.: Cyberguide: a mobile context-aware tour guide. Wireless Netw. 3(5), 421–433 (1997)
Ali, K., Lhoták, O.: Averroes: whole-program analysis without the whole program. In: Castagna, G. (ed.) ECOOP 2013. LNCS, vol. 7920, pp. 378–400. Springer, Heidelberg (2013). doi:10.1007/978-3-642-39038-8_16
Ali, R., Dalpiaz, F., Giorgini, P.: Goal-based self-contextualization. In: CAiSE 2009, pp. 37–43 (2009)
Apel, S., Kästner, C.: On overview of feature-oriented software development. J. Object Technol. 8(5), 49–84 (2009)
Apel, S., Leich, T., Rosenmüller, M., Saake, G.: Feature C++: on the symbiosis of feature-oriented and aspect-oriented programming. In: GPCE 2005, pp. 125–140 (2005)
Appeltauer, M., Hirschfeld, R., Haupt, M., Lincke, J., Perscheid, M.: A comparison of context-oriented programming languages. In: COP 2009, pp. 1–6 (2009)
Appeltauer, M., Hirschfeld, R., Haupt, M., Masuhara, H.: ContextJ: context-oriented programming with Java. Comput. Softw. 28(1), 272–292 (2011)
Appeltauer, M., Hirschfeld, R., Masuhara, H.: Improving the development of context-dependent Java application with ContextJ. In: COP 2009 (2009)
Appeltauer, M., Hirschfeld, R., Masuhara, H., Haupt, M., Kawauchi, K.: Event-specific software composition in context-oriented programming. In: Baudry, B., Wohlstadter, E. (eds.) SC 2010. LNCS, vol. 6144, pp. 50–65. Springer, Heidelberg (2010). doi:10.1007/978-3-642-14046-4_4
Aracic, I., Gasiunas, V., Mezini, M., Ostermann, K.: An overview of CaesarJ. In: Rashid, A., Aksit, M. (eds.) Transactions on Aspect-Oriented Software Development I. LNCS, vol. 3880, pp. 135–173. Springer, Heidelberg (2006). doi:10.1007/11687061_5
Bracha, G., Cook, W.: Mixin-based inheritance. In: OOPSLA 1990, pp. 303–311 (1990)
Cappiello, C., Comuzzi, M., Mussi, E., Pernici, B.: Context management for adaptive information systems. Electron. Notes Theoret. Comput. Sci. 146, 69–84 (2006)
Cardozo, N., González, S., Mens, K., Van Der Straeten, R., Vallejos, J., D’Hondt, T.: Semantics for consistent activation in context oriented systems. Inf. Softw. Technol. 58, 71–94 (2015)
Cardozo, N., De Meuter, W., Mens, K., González, S.: Features on demand. In: VaMoS 2014 (2014)
Ceri, S., Daniel, F., Facca, F.M., Matera, M.: Model driven engineering of active context-awareness. World Wide Web 10, 387–413 (2007)
Costanza, P., D’Hondt, T.: Feature description for context-oriented programming. In: DSPL 2008 (2008)
Costanza, P., Hirschfeld, R.: Language constructs for context-oriented programming - an overview of ContextL. In: Dynamic Language Symposium (DLS 2005), pp. 1–10 (2005)
Dardenne, A., van Lamsweerde, A., Fickas, S.: Goal-directed requirements acquisition. Sci. Comput. Program. 20, 3–50 (1993)
Desmet, B., Vallejos, J., Costanza, P., De Meuter, W., D’Hondt, T.: Context-Oriented Domain Analysis. In: Kokinov, B., Richardson, D.C., Roth-Berghofer, T.R., Vieu, L. (eds.) CONTEXT 2007. LNCS (LNAI), vol. 4635, pp. 178–191. Springer, Heidelberg (2007). doi:10.1007/978-3-540-74255-5_14
Elliott, C., Hudak, P.: Functional reactive animation. In: ICFP 1997, pp. 263–273 (1997)
González, S., Cardozo, N., Mens, K., Cádiz, A., Libbrecht, J.-C., Goffaux, J.: Subjective-C: bringing context to mobile platform programming. In: Malloy, B., Staab, S., Brand, M. (eds.) SLE 2010. LNCS, vol. 6563, pp. 246–265. Springer, Heidelberg (2011). doi:10.1007/978-3-642-19440-5_15
González, S., Mens, K., Cádiz, A.: Context-oriented programming with the ambient object systems. J. Univ. Comput. Sci. 14(20), 3307–3332 (2008)
González, S., Mens, K., Colãcious, M., Cazzola, W.: Context traits: dynamic behaviour adaptation through run-time trait recomposition. In: AOSD 2013, pp. 209–220 (2013)
Henrichsen, K., Indulska, J.: A software engineering framework for context-aware pervasive computing. In: PERCOM 2004 (2004)
Hirschfeld, R., Costanza, P., Haupt, M.: An introduction to context-oriented programming with ContextS. In: Lämmel, R., Visser, J., Saraiva, J. (eds.) GTTSE 2007. LNCS, vol. 5235, pp. 396–407. Springer, Heidelberg (2008). doi:10.1007/978-3-540-88643-3_9
Hirschfeld, R., Costanza, P., Nierstrasz, O.: Context-oriented programming. J. Object Technol. 7(3), 125–151 (2008)
Jacobson, I., Christerson, M., Jonsson, P., Övergaard, G.: Object-Oriented Software Engineering: A Use Case Driven Approach. Pearson Education, New Delhi (1992)
Jacobson, I., Ng, P.-W.: Aspect-Oriented Software Development with Use Cases. Pearson Education, New Delhi (2005)
Kamina, T., Aotani, T., Masuhara, H.: EventCJ: a context-oriented programming language with declarative event-based context transition. In: AOSD 2011, pp. 253–264 (2011)
Kamina, T., Aotani, T., Masuhara, H.: Introducing composite layers in EventCJ. IPSJ Trans. Program. 6(1), 1–8 (2013)
Kamina, T., Aotani, T., Masuhara, H.: Mapping context-dependent requirements to event-based context-oriented programs for modularity. In: Workshop on Reactivity Events and Modularity (REM 2013) (2013)
Kamina, T., Aotani, T., Masuhara, H.: Generalized layer activation mechanism through contexts and subscribers. In: MODULARITY 2015, pp. 14–28 (2015)
Kamina, T., Aotani, T., Masuhara, H., Tamai, T.: Context-oriented software engineering: a modularity vision. In MODULARITY 2014, pp. 85–98 (2014)
Kang, K.C., Cohen, S.G., Hess, J.A., Novak, W.E., Spencer Peterson, A.: Feature-oriented domain analysis (FODA) feasibility study. Technical report CMU/SEI-90-TR-21, Software Engineering Institute, Carnegie Mellon University (1990)
Keays, R., Rakotonirainy, A.: Context-oriented programming. In: MobiDE 2003, pp. 9–16 (2003)
Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An overview of AspectJ. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 327–354. Springer, Heidelberg (2001). doi:10.1007/3-540-45337-7_18
Koppen, C., Störzer, M.: PCDiff: attacking the fragile pointcut problem. In: European Interactive Workshop on Aspects in Software (2004)
Lapouchnian, A., Mylopoulos, J.: Modeling domain variability in requirements engineering with contexts. In: Laender, A.H.F., Castano, S., Dayal, U., Casati, F., Oliveira, J.P.M. (eds.) ER 2009. LNCS, vol. 5829, pp. 115–130. Springer, Heidelberg (2009). doi:10.1007/978-3-642-04840-1_11
Liaskos, S., Lapouchnian, A., Yu, Y., Yu, E., Mylopoulos, J.: On goal-based variability acquisition and analysis. In: RE 2006, pp. 79–88 (2006)
Liu, L., Yu, E.: Designing information systems in social context: a goal and scenario modelling approach. Information Systems 29(2), 187–203 (2004)
Parnas, D.L.: On the criteria to be used in decomposing systems into modules. Commun. ACM 15(12), 1053–1058 (1972)
Prehofer, C.: Feature-oriented programming: a fresh look at objects. In: Akşit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 419–443. Springer, Heidelberg (1997). doi:10.1007/BFb0053389
Rashid, A., Sawyer, P., Moreira, A., Araújo, J.: Early aspects: a model for aspect-oriented requirements engineering. In: RE 2002, pp. 199–202 (2002)
Saliber, D., Dey, A.K., Abowd, G.D.: The context toolkit: aiding the development of context-enabled applications. In: CHI 1999, pp. 434–441 (1999)
Salifu, M., Nuseibeh, B., Rapanotti, L., Tun, T.T.: Using problem descriptions to represent variability for context-aware applications. In: VaMoS 2007 (2007)
Salifu, M., Yu, Y., Nuseibeh, B.: Specifying monitoring and switching problems in context. In: RE 2007, pp. 211–220 (2007)
Salvaneschi, G., Ghezzi, C., Pradella, M.: ContextErlang: A language for distributed context-aware self-adaptive applications. Sci. Comput. Program. 102(1), 20–43 (2014)
Schärli, N., Ducasse, S., Nierstrasz, O., Black, A.P.: Traits: composable units of behaviour. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 248–274. Springer, Heidelberg (2003). doi:10.1007/978-3-540-45070-2_12
Sutcliffe, A., Fickas, S., Sohlberg, M.K.M.: PC-RE: a method for personal and contextual requirements engineering with some experience. Requirements Eng. 11(3), 157–173 (2006)
Takeyama, F., Chiba, S.: Implementing feature interactions with generic feature modules. In: Binder, W., Bodden, E., Löwe, W. (eds.) SC 2013. LNCS, vol. 8088, pp. 81–96. Springer, Heidelberg (2013). doi:10.1007/978-3-642-39614-4_6
Vallejos, J., González, S., Costanza, P., De Meuter, W., D’Hondt, T., Mens, K.: Predicated generic functions: enabling context-dependent method dispatch. In: Baudry, B., Wohlstadter, E. (eds.) SC 2010. LNCS, vol. 6144, pp. 66–81. Springer, Heidelberg (2010). doi:10.1007/978-3-642-14046-4_5
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2016 Springer International Publishing Switzerland
About this chapter
Cite this chapter
Kamina, T., Aotani, T., Masuhara, H., Tamai, T. (2016). Context-Oriented Software Development with Generalized Layer Activation Mechanism. In: Chiba, S., Südholt, M., Eugster, P., Ziarek, L., Leavens, G. (eds) Transactions on Modularity and Composition I. Lecture Notes in Computer Science(), vol 9800. Springer, Cham. https://doi.org/10.1007/978-3-319-46969-0_1
Download citation
DOI: https://doi.org/10.1007/978-3-319-46969-0_1
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-46968-3
Online ISBN: 978-3-319-46969-0
eBook Packages: Computer ScienceComputer Science (R0)