Abstracting Context in Event-Based Software

  • Adrian Holzer
  • Lukasz Ziarek
  • K. R. Jayaram
  • Patrick Eugster
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7271)


With the recent immersion of advanced mobile devices in the daily lives of millions, pervasive computing is becoming a reality. Developing pervasive software systems is inherently difficult though it requires to deal with heterogeneous infrastructure besides peer-to-peer communication and device mobility. Thus, programming support for such applications must provide loose coupling between different participants, as well as loose coupling between applications and communication protocols. Event-based programming provides an appealing paradigm to decouple participants, however many event-based systems and languages have hardwired communication protocols, which limits their adaptability to heterogeneous deployment environments.

In this paper we address this issue by abstracting the context in which events are created and handled, including protocols used to convey, compose, and consume these events. More precisely, we propose to extend an event-based programming model with context aspectsconspects for short. We demonstrate the elegant usage of conspects through several examples based on their implementation in EventJava and illustrate how they allow to modularize event-based pervasive software. We also provide a thorough empirical investigation of the performance overheads and benefits of conspects, including the costs of weaving them dynamically. Through empirical evaluations, we assess the benefits of conspects for switching protocols without any changes to the base applications through three case studies with EventJava. The three studies are (1) a tornado monitoring system deployed on different architectures ranging from desktop x86 to embedded LEON3, (2) a mobile social networking suite with protocols for different scenarios, and (3) the introduction of a novel adaptive communication protocol in our mobile social network suite as well as in a novel robotic swarm application.


Event aspect context distribution protocol 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Carzaniga, A., Rosenblum, D.S., Wolf, A.L.: Design and evaluation of a wide-area event notification service. TOCS 19 (2001)Google Scholar
  2. 2.
    Appeltauer, M., Hirschfeld, R., Haupt, M., Lincke, J., Perscheid, M.: A comparison of context-oriented programming languages. In: COP 2009: International Workshop on Context-Oriented Programming, New York, NY, USA, pp. 1–6 (2009)Google Scholar
  3. 3.
    Appeltauer, M., Hirschfeld, R., Masuhara, H.: Improving the development of context-dependent Java applications with Contextj. In: COP 2009: International Workshop on Context-Oriented Programming, New York, NY, USA, pp. 1–5 (2009)Google Scholar
  4. 4.
    BBN Technologies. Quality Objects,
  5. 5.
    Benton, N., Cardelli, L., Fournet, C.: Modern concurrency abstractions for C#. TOPLAS 26(5), 769–804 (2004)CrossRefGoogle Scholar
  6. 6.
    Cachin, C., Guerraoui, R., Rodrigues, L.: Reliable and secure distributed programming (2011)Google Scholar
  7. 7.
    Capra, L., Emmerich, W., Mascolo, C.: Carisma: context-aware reflective middleware system for mobile applications. TSE 29(10), 929–945 (2003)Google Scholar
  8. 8.
    Cheng, J., Cheng, W., Nagpal, R.: Robust and self-repairing formation control for swarms of mobile agents. In: AAAI 2005, pp. 59–64 (2005)Google Scholar
  9. 9.
    Cugola, G., Di Nitto, E., Fuggetta, A.: The JEDI event-based infrastructure and its application to the development of the OPSS WFMS. TSE 27(9), 827–850 (2001)Google Scholar
  10. 10.
    Dedecker, J., Van Cutsem, T., Mostinckx, S., D’Hondt, T., De Meuter, W.: Ambient-Oriented Programming in AmbientTalk. In: Thomas, D. (ed.) ECOOP 2006. LNCS, vol. 4067, pp. 230–254. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  11. 11.
    Douence, R., Fradet, P., Südholt, M.: Composition, reuse and interaction analysis of stateful aspects. In: AOSD 2004, pp. 141–150 (2004)Google Scholar
  12. 12.
    Drossopoulou, S., Petrounias, A., Buckley, A., Eisenbach, S.: SCHOOL: a small chorded object-oriented language. Electr. Notes Theor. Comput. Sci. 135(3), 37–47 (2006)CrossRefGoogle Scholar
  13. 13.
    Eclipse Foundation. The AspectJ programming language (2009),
  14. 14.
    Ericsson Computer Science Laboratory. The Erlang pogramming language,
  15. 15.
    Eugster, P.: Type-based publish/subscribe: concepts and experiences. TOPLAS 29(1) (2007)Google Scholar
  16. 16.
    Eugster, P., Garbinato, B., Holzer, A.: Location-based publish/subscribe. In: NCA 2005, pp. 279–282 (2005)Google Scholar
  17. 17.
    Eugster, P., Jayaram, K.R.: EventJava: An Extension of Java for Event Correlation. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 570–594. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  18. 18.
    Fiege, L., Mezini, M., Mühl, G., Buchmann, A.P.: Engineering Event-Based Systems with Scopes. In: Magnusso, B. (ed.) ECOOP 2002. LNCS, vol. 2374, pp. 309–333. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  19. 19.
    Fournet, C., Gonthier, C.: The reflexive chemical abstract machine and the join calculus. In: POPL 1996, pp. 372–385 (1996)Google Scholar
  20. 20.
    Frey, D., Roman, G.-C.: Context-Aware Publish Subscribe in Mobile Ad Hoc Networks. In: Murphy, A.L., Dell’Acqua, P. (eds.) COORDINATION 2007. LNCS, vol. 4467, pp. 37–55. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  21. 21.
    Friedman-Hill, E.: Jess (2008),
  22. 22.
    Fritsch, D., Wegener, K., Schraft, R.D.: Control of a robotic swarm for the elimination of marine oil pollutions. In: SIS 2007, pp. 29–36 (2007)Google Scholar
  23. 23.
    Haahr, M., Meier, R., Nixon, P., Cahill, V., Jul, E.: Filtering and scalability in the ECO distributed event model. In: PDSE 2000, pp. 83–92 (2000)Google Scholar
  24. 24.
    Haller, P., Van Cutsem, T.: Implementing Joins Using Extensible Pattern Matching. In: Lea, D., Zavattaro, G. (eds.) COORDINATION 2008. LNCS, vol. 5052, pp. 135–152. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  25. 25.
    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)CrossRefGoogle Scholar
  26. 26.
    Hirschfeld, R., Costanza, P., Nierstrasz, O.: Context-oriented programming. Journal of Object Technology 7(3), 125–151 (2008)CrossRefGoogle Scholar
  27. 27.
    Holzer, A., Ziarek, L., Jayaram, K.R., Eugster, P.: Putting events in context. In: AOSD 2011, pp. 241–252 (2011)Google Scholar
  28. 28.
    Huang, Y., Garcia-Molina, H.: Parameterized subscriptions in publish/subscribe systems. Data Knowl. Eng. 60(3), 435–450 (2007)CrossRefGoogle Scholar
  29. 29.
    Oracle Inc. Java reflection API (2011),
  30. 30.
    Sun Microsystems Inc. Java message service - specification, version 1.1. Technical report, Sun Microsystems Inc. (2005),
  31. 31.
    Von Itzstein, S.G., Kearney, D.A.: The expression of common concurrency patterns in Join Java. In: PDPTA 2004, pp. 1021–1025 (2004)Google Scholar
  32. 32.
    Jayaram, K.R., Eugster, P.: Context-oriented programming with EventJava. In: COP 2009, pp. 570–594 (2009)Google Scholar
  33. 33.
    JGuru. Performance costs involved in Java reflection,
  34. 34.
    Kakalis, N.M.P., Ventikos, Y.: Robotic swarm concept for efficient oil spill confrontation. Journal of Hazardous Materials 154(1-3), 880–887 (2008)CrossRefGoogle Scholar
  35. 35.
    Kiczales, G., Lamping, J., Menhdhekar, A., Maeda, C., Lopes, C., Loingtier, J.-M., Irwin, J.: Aspect-Oriented Programming. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 220–242. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  36. 36.
    Lamport, L.: Time, clocks, and the ordering of events in a distributed system. CACM 21(7), 558–565 (1978)zbMATHGoogle Scholar
  37. 37.
    Mattern, F.: Virtual time and global states of distributed systems. In: PDDA 1989, pp. 215–226 (1989)Google Scholar
  38. 38.
    Meier, R., Cahill, V.: Steam: event-based middleware for wireless ad hoc networks. In: DEBS 2002, pp. 639–644 (2002)Google Scholar
  39. 39.
    Mills, D.L.: Internet time synchronization: the network time protocol. In: TSE, pp. 1482–1493 (1991)Google Scholar
  40. 40.
    Navarro, L.D.B., Südholt, M., Vanderperren, W., De Fraine, B., Suvée, D.: Explicitly distributed AOP using AWED. In: AOSD 2006, pp. 51–62 (2006)Google Scholar
  41. 41.
    Nystrom, N., Clarkson, M.R., Myers, A.C.: Polyglot: An Extensible Compiler Framework for Java. In: Hedin, G. (ed.) CC 2003. LNCS, vol. 2622, pp. 138–152. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  42. 42.
    Oki, B., Pfluegl, M., Siegel, A., Skeen, D.: The information bus - an architecture for extensible distributed systems. In: SOSP 1993, pp. 58–68 (1993)Google Scholar
  43. 43.
    Paula, I.S., Eisenbach, S.: JCThorn: extending thorn with joins and chords. Technical report, Imperial College London (June 2010),
  44. 44.
    Pizlo, F., Ziarek, L., Blanton, E., Maj, P., Vitek, J.: High-level programming of embedded hard real-time devices. In: EuroSys 2010, pp. 69–82 (2010)Google Scholar
  45. 45.
    Plociniczak, H., Eisenbach, S.: JErlang: Erlang with Joins. In: Clarke, D., Agha, G. (eds.) COORDINATION 2010. LNCS, vol. 6116, pp. 61–75. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  46. 46.
    Rajan, H., Leavens, G.T.: Ptolemy: A Language with Quantified, Typed Events. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 155–179. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  47. 47.
    Rasmussen, E.N.: Refined supercell and tornado forecast parameters. Weather and Forecasting 18, 530–535 (2003)CrossRefGoogle Scholar
  48. 48.
    Reppy, J.H., Xiao, Y.: Specialization of CML message-passing primitives. In: POPL 2007, pp. 315–326 (2007)Google Scholar
  49. 49.
    Russo, C.V.: Join patterns for visual basic. In: OOPSLA 2008, pp. 53–72 (2008)Google Scholar
  50. 50.
    Schneider, F.B.: Implementing fault-tolerant services using the state machine approach: a tutorial. ACM Computing Surveys 22(4), 299–319 (1990)CrossRefGoogle Scholar
  51. 51.
    Soulé, R., Hirzel, M., Grimm, R., Gedik, B., Andrade, H., Kumar, V., Wu, K.-L.: A Universal Calculus for Stream Processing Languages. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 507–528. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  52. 52.
    Sulzmann, M., Lam, E.S.L., Van Weert, P.: Actors with Multi-headed Message Receive Patterns. In: Lea, D., Zavattaro, G. (eds.) COORDINATION 2008. LNCS, vol. 5052, pp. 315–330. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  53. 53.
    Tanter, É.: Contextual values. In: DLS 2008, pp. 1–10 (2008)Google Scholar
  54. 54.
    Tatlock, Z., Tucker, C., Shuffelton, D., Jhala, R., Lerner, S.: Deep typechecking and refactoring, pp. 37–52 (2008)Google Scholar
  55. 55.
    von Löwis, M., Denker, M., Nierstrasz, O.: Context-oriented programming: beyond layers. In: ICDL 2007, pp. 143–156 (2007)Google Scholar
  56. 56.
    Wohlstadter, E., Jackson, S., Devanbu, P.: DADO: enhancing middleware to support crosscutting features in distributed, heterogeneous systems. In: ICSE 2003, pp. 174–186 (2003)Google Scholar
  57. 57.
    Yoon, J., Liu, M., Noble, B.: Random waypoint considered harmful. In: INFOCOM 2003, pp. 1312–1321 (2003)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Adrian Holzer
    • 1
  • Lukasz Ziarek
    • 2
    • 3
  • K. R. Jayaram
    • 3
  • Patrick Eugster
    • 3
  1. 1.Polytechnique MontréalMontréalCanada
  2. 2.Fiji Systems IncIndianapolisUSA
  3. 3.Purdue UniversityWest LafayetteUSA

Personalised recommendations