The Journal of Supercomputing

, Volume 75, Issue 12, pp 7750–7764 | Cite as

Programming in a context-aware language

  • Chiara Bodei
  • Pierpaolo Degano
  • Gian-Luigi Ferrari
  • Letterio GallettaEmail author


In the times of mobility and pervasiveness of computing, contextual information plays an increasingly crucial role in applications. This kind of information becomes a first class citizen in context-oriented programming (COP) paradigm. COP languages provide primitive constructs for easily writing applications that adapt their behaviour depending on the evolution of their operational environment, namely the context. We present these new constructs, the issues and the challenges that arise, reporting on our recent work on ML\(_\text {CoDa}\). It is a declarative language specifically designed for adaptation and equipped with a clear formal semantics and analysis tools. We will discuss some experiments done with a preliminary implementation of ML\(_\text {CoDa}\). Through them we will show how applications and context interactions can be better specified, analysed and controlled.


Adaptive software Context-oriented programming Datalog 


  1. 1.
    Appeltauer M, Hirschfeld R, Haupt M, Lincke J, Perscheid M (2009) A comparison of context-oriented programming languages. In: International Workshop on Context-Oriented Programming (COP ’09). ACM, New York, pp 6:1–6:6Google Scholar
  2. 2.
    Appeltauer M, Hirschfeld R, Haupt M, Masuhara H (2011) ContextJ: context-oriented programming with Java. Comput Softw 28(1):272–292Google Scholar
  3. 3.
    Bodei C, Degano P, Ferrari GL, Galletta L (2016) Last mile’s resources. In: Semantics, Logics, and Calculi, LNCS 9560. Springer, Berlin, pp 33–53Google Scholar
  4. 4.
    Bodei C, Degano P, Ferrari GL, Galletta L (2016) A step towards checking security in IoT. In: Proceedings of ICE 2016, EPTCS, vol 223, pp 128–142CrossRefGoogle Scholar
  5. 5.
    Bodei C, Degano P, Ferrari GL, Galletta L (2016) Where do your IoT ingredients come from? In: Proceedings of the Coordination 2016, LNCS, vol 9686. Springer, Berlin, pp 35–50Google Scholar
  6. 6.
    Bodei C, Degano P, Ferrari GL, Galletta L (2017) Experimenting with a context-aware language. In: Malyshkin V (ed) Proceedings of 14th Conference on Parallel Computing Technologies, LNCS 10421. Springer, pp 3–17Google Scholar
  7. 7.
    Bodei C, Degano P, Ferrari GL, Galletta L (2017) Tracing where IoT data are collected and aggregated. Log Methods Comput Sci 13(3:5):1–38Google Scholar
  8. 8.
    Bodei C, Degano P, Galletta L, Focardi R, Tempesta M (2018) Transcompiling firewalls. In: Bauer L, Küsters R (eds) 7th International Conference on Principles of Security and Trust, POST 2018, LNCS, vol 10804. Springer, BerlinGoogle Scholar
  9. 9.
    Bodei C, Degano P, Galletta L, Focardi R, Tempesta M, Veronese L (2018) Language-independent synthesis of firewall policies. In: IEEE European Symposium on Security and Privacy, EuroS&P 2018. IEEEGoogle Scholar
  10. 10.
    Bodei C, Degano P, Galletta L, Salvatori F (2014) Linguistic mechanisms for context-aware security. In: Proceedings of the 11th International Colloquium on Theoretical Aspects of Computing, LNCS 8687. Springer, Berlin, pp 61–79CrossRefGoogle Scholar
  11. 11.
    Bodei C, Degano P, Galletta L, Salvatori F (2016) Context-aware security: linguistic mechanisms and static analysis. J Comput Secur 24(4):427–477CrossRefGoogle Scholar
  12. 12.
    Bodei C, Dinh VD, Ferrari GL (2017) Checking global usage of resources handled with local policies. Sci Comput Program 133:20–50CrossRefGoogle Scholar
  13. 13.
    Busi M, Degano P, Galletta L (2018) Handling interference in a COP language. Submitted for publicationGoogle Scholar
  14. 14.
    Busi M, Degano P, Galletta L (2016) A semantics for disciplined concurrency in COP. In: Proceedings of the ICTCS 2016, CEUR Proceedings, vol 1720, pp 177–189Google Scholar
  15. 15.
    Canciani A, Degano P, Ferrari GL, Galletta L (2015) A context-oriented extension of F#. In: FOCLASA 2015, EPTCS 201, pp 18–32MathSciNetCrossRefGoogle Scholar
  16. 16.
  17. 17.
    Costanza P (2005) Language constructs for context-oriented programming. In: Proceedings of the Dynamic Languages Symposium. ACM Press, pp 1–10Google Scholar
  18. 18.
    Degano P, Ferrari GL, Galletta L (2014) A two-component language for COP. In: Proceedings of the 6th International Workshop on Context-Oriented Programming. ACM Digital LibraryGoogle Scholar
  19. 19.
    Degano P, Ferrari GL, Galletta L (2014) A two-phase static analysis for reliable adaptation. In: Proceedings of the 12th International Conference on Software Engineering and Formal Methods, LNCS 8702. Springer, Berlin, pp 347–362CrossRefGoogle Scholar
  20. 20.
    Degano P, Ferrari GL, Galletta L (2016) Event-driven adaptation in COP. In: PLACES 2016, EPTCS 211, pp 37–45CrossRefGoogle Scholar
  21. 21.
    Degano P, Ferrari GL, Galletta L (2016) A two-component language for adaptation: design, semantics and program analysis. IEEE Trans Softw Eng. CrossRefGoogle Scholar
  22. 22.
    Galletta L (2014) Adaptivity: linguistic mechanisms and static analysis techniques. Ph.D. thesis, University of Pisa. Accessed 10 Sept 2018
  23. 23.
    Hirschfeld R, Costanza P, Nierstrasz O (2008) Context-oriented programming. J Object Technol 7(3):125–151CrossRefGoogle Scholar
  24. 24.
    Kamina T, Aotani T, Masuhara H (2011) EventCJ a context-oriented programming language with declarative event-based context transition. In: Proceedings of the 10 International Conference on Aspect-Oriented software development (AOSD ’11). ACM, pp 253–264Google Scholar
  25. 25.
    Kephart JO, Chess DM (2003) The vision of autonomic computing. IEEE Comput 36(1):41–50. CrossRefGoogle Scholar
  26. 26.
    Kiczales G, Hilsdale E, Hugunin J, Kersten M, Palm J, Griswold W (2001) An overview of aspectj. In: Knudsen J (ed) ECOOP 2001 Object-Oriented Programming, LNCS 2072. Springer, Berlin, pp 327–354CrossRefGoogle Scholar
  27. 27.
    Lämmel R, Meijer E (2007) Revealing the X/O impedance mismatch–(changing lead into gold). In: Backhouse RC, Gibbons J, Hinze R, Jeuring J (eds) Datatype-Generic Programming-International Spring School, LNCS, vol 4719. Springer, Berlin, pp 285–367CrossRefGoogle Scholar
  28. 28.
    Loke SW (2004) Representing and reasoning with situations for context-aware pervasive computing: a logic programming perspective. Knowl Eng Rev 19(3):213–233CrossRefGoogle Scholar
  29. 29.
    Magee J, Kramer J (1996) Dynamic structure in software architectures. SIGSOFT Softw Eng Notes 21(6):3–14CrossRefGoogle Scholar
  30. 30.
    Microsoft Cognitive Service. Accessed 10 Sept 2018
  31. 31.
    Microsoft .NET. Accessed 10 Sept 2018
  32. 32.
    Orsi G, Tanca L (2011) Context modelling and context-aware querying. In: Moor O, Gottlob G, Furche T, Sellers A (eds) Datalog Reloaded, LNCS 6702. Springer, Berlin, pp 225–244CrossRefGoogle Scholar
  33. 33.
    Raspberry Pi. Accessed 10 Sept 2018
  34. 34.
    Salehie M, Tahvildari L (2009) Self-adaptive software: Landscape and research challenges. ACM Trans Auton Adapt Syst 4(2):14:1–14:42CrossRefGoogle Scholar
  35. 35.
    Salvaneschi G, Ghezzi C, Pradella M (2012) Context-oriented programming: a software engineering perspective. J Syst Softw 85(8):1801–1817CrossRefGoogle Scholar
  36. 36.
    Spinczyk O, Gal A, Schröder-Preikschat W (2002) AspectC++: an aspect-oriented extension to the C++ programming language. In: CRPIT ’02. Australian Computer Society, Inc., pp 53–60Google Scholar
  37. 37.
    Telegram. Accessed 10 Sept 2018
  38. 38.
    Walker D, Zdancewic S, Ligatti J (2003) A theory of aspects. SIGPLAN Not 38(9):127–139CrossRefGoogle Scholar
  39. 39.
    Wand M, Kiczales G, Dutchyn C (2004) A semantics for advice and dynamic join points in aspect-oriented programming. ACM Trans Program Lang Syst 26(5):890–910CrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media, LLC, part of Springer Nature 2018

Authors and Affiliations

  1. 1.Dipartimento di InformaticaUniversità di PisaPisaItaly
  2. 2.IMT - School for Advanced StudiesLuccaItaly

Personalised recommendations