First-Class Compositions

Defining and Composing Object and Aspect Compositions with First-Class Operators
  • Lodewijk Bergmans
  • Wilke Havinga
  • Mehmet Aksit
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7271)


A considerable amount of research, especially within the OO and AOSD communities, has focused on understanding the potential and limitations of various composition techniques. This has led to a large number of proposals for alternative composition techniques, including many variations of message dispatch, inheritance, and aspect mechanisms. This paper makes the case that there is no single perfect composition technique that suits every situation, since different techniques incur different tradeoffs. The proper composition technique to use depends on the particular design problem and its requirements (such as the required adaptability, reusability, understandability and robustness). However, most programming languages limit the available composition techniques to a very few. To address this, we propose a novel composition model, called Co-op. The model provides dedicated abstractions that can be used to express a wide variety of object composition techniques (“composition operators”). Examples include various forms of inheritance, delegation, and aspects. The proposed model unifies objects (with encapsulated state and a message interface) and composition operators; composition operators are specified as first-class citizens. Multiple composition operators can be combined within the same application, and composition operators can even be used to compose new composition operators from existing ones. This opens new possibilities for developing domain-specific composition operators, taxonomies of composition operators, and for reuse and refinement of composition operators. To validate and experiment with the proposed model, we have designed and implemented a simple language, Co-op/I, that we also use in this paper to show concrete examples.


Composition Operator Event Selector Abstract Syntax Composition Model Abstract Data Type 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    The Miranda Programming Language,
  2. 2.
    Java Aspect Metamodel Interpreter (2007),
  3. 3.
    Co-op Sourceforge homepage (2010),
  4. 4.
    Akşit, M., Wakita, K., Bosch, J., Bergmans, L., Yonezawa, A.: Abstracting Object Interactions Using Composition Filters. In: Guerraoui, R., Nierstrasz, O., Riveill, M. (eds.) ECOOP-WS 1993. LNCS, vol. 791, pp. 152–184. Springer, Heidelberg (1994)CrossRefGoogle Scholar
  5. 5.
    Avgustinov, P., Christensen, A.S., Hendren, L., Kuzins, S., Lhoták, J., Lhoták, O., de Moor, O., Sereni, D., Sittampalam, G., Tibble, J.: abc: An Extensible AspectJ Compiler. In: Rashid, A., Aksit, M. (eds.) Transactions on AOSD I. LNCS, vol. 3880, pp. 293–334. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  6. 6.
    Banavar, G., Lindstrom, G.: An Application Framework for Module Composition Tools. In: Cointe, P. (ed.) ECOOP 1996. LNCS, vol. 1098, pp. 91–113. Springer, Heidelberg (1996)Google Scholar
  7. 7.
    Bergmans, L., Akşit, M.: Composing crosscutting concerns using composition filters. Comm. ACM 44(10), 51–57 (2001)CrossRefGoogle Scholar
  8. 8.
    Bockisch, C.: An Efficient and Flexible Implementation of Aspect-Oriented Languages. PhD thesis, Technische Universität Darmstadt (2009)Google Scholar
  9. 9.
    Bosch, J.: Design patterns as language constructs. Journal of Object-Oriented Programming 11, 18–32 (1998)Google Scholar
  10. 10.
    Bouraqadi, N., Seriai, A., Leblanc, G.: Towards unified aspect-oriented programming. In: Proceedings of ESUG 2005 (13th International Smalltalk Conference) (2005)Google Scholar
  11. 11.
    Bracha, G., Cook, W.: Mixin-based inheritance. In: Conf. Object-Oriented Programming: Systems, Languages, and Applications; European Conf. Object-Oriented Programming, pp. 303–311. ACM (1990)Google Scholar
  12. 12.
    Bracha, G., von der Ahé, P., Bykov, V., Kashai, Y., Maddox, W., Miranda, E.: Modules as Objects in Newspeak. In: D’Hondt, T. (ed.) ECOOP 2010. LNCS, vol. 6183, pp. 405–428. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  13. 13.
    Brichau, J., Mezini, M., Noyé, J., Havinga, W., Bergmans, L., Gasiunas, V., Bockisch, C., Fabry, J., D’Hondt, T.: An Initial Metamodel for Aspect-Oriented Programming Languages. Technical Report AOSD-Europe Deliverable D39, Vrije Universiteit Brussel (February 27, 2006)Google Scholar
  14. 14.
    Brinke, S.t.: First-order function dispatch in a java-like programming language. Master’s thesis, University of Twente, Faculty of Electrical Engineering, Mathematics and Computer Science (2010)Google Scholar
  15. 15.
    Chambers, C., Ungar, D., Lee, E.: An efficient implementation of self a dynamically-typed object-oriented language based on prototypes. SIGPLAN Not. 24(10), 49–70 (1989)CrossRefGoogle Scholar
  16. 16.
    Clifton, C., Millstein, T., Leavens, G.T., Chambers, C.: MultiJava: Design rationale, compiler implementation, and applications. ACM Transactions on Programming Languages and Systems 28(3), 517–575 (2006)CrossRefGoogle Scholar
  17. 17.
    Cointe, P.: Reflective languages and metalevel architectures. ACM Comput. Surv., 151 (1996)Google Scholar
  18. 18.
    Oliveira, B.C.d.S.: Modular Visitor Components. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 269–293. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  19. 19.
    de Roo, A.J., Hendriks, M.F.H., Havinga, W.K., Durr, P.E.A., Bergmans, L.M.J.: Compose*: a language- and platform-independent aspect compiler for composition filters. In: Mens, K., van den Brand, M., Kuhn, A., Kienle, H., Wuyts, R. (eds.) First International Workshop on Academic Software Development Tools and Techniques, Cyprus (July 2008)Google Scholar
  20. 20.
    Douence, R., Fradet, P., Südholt, M.: Composition, reuse and interaction analysis of stateful aspects. In: Lieberherr, K. (ed.) Proc. 3rd Int’ Conf. on Aspect-Oriented Software Development (AOSD 2004), pp. 141–150. ACM Press, New York (2004)CrossRefGoogle Scholar
  21. 21.
    Ducasse, S., Nierstrasz, O., Schärli, N., Wuyts, R., Black, A.: Traits: A mechanism for fine-grained reuse. ACM Transactions on Programming Languages and Systems (TOPLAS) 28(2), 331–388 (2006)CrossRefGoogle Scholar
  22. 22.
    Dyer, R., Rajan, H.: Nu: a dynamic aspect-oriented intermediate language model and virtual machine for flexible runtime adaptation. In: AOSD 2008: Proceedings of the 7th International Conference on Aspect-Oriented Software Development. ACM, New York (2008)Google Scholar
  23. 23.
    van Engelen, R., Voeten, J. (eds.): Ideals: evolvability of software-intensive high-tech systems. Embedded Systems Institute, Eindhoven (2007)Google Scholar
  24. 24.
    Ernst, M., Kaplan, C., Chambers, C.: Predicate Dispatching: A Unified Theory of Dispatch. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 186–211. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  25. 25.
    Filman, R.E., Barrett, S., Lee, D.D., Linden, T.: Inserting ilities by controlling communications. Comm. ACM 45(1), 116–122 (2002)CrossRefGoogle Scholar
  26. 26.
    Findler, R.B., Flatt, M.: Modular object-oriented programming with units and mixins. In: Proceedings of the ACM SIGPLAN International Conference on Functional Programming, pp. 94–104. ACM, New York (1998)CrossRefGoogle Scholar
  27. 27.
    Finkel, R.: Advanced programming language design. Addison-Wesley (1996)Google Scholar
  28. 28.
    Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, Reading (1994)Google Scholar
  29. 29.
    Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design patterns: elements of reusable object-oriented software. Addison-Wesley, Reading (1995)Google Scholar
  30. 30.
    Goldberg, A., Robson, D.: Smalltalk-80: the language and its implementation. Addison-Wesley Longman Publishing Co., Inc., Boston (1983)zbMATHGoogle Scholar
  31. 31.
    Goldberg, D.S., Findler, R.B., Flatt, M.: Super and inner: together at last! In: OOPSLA 2004: Proceedings of the 19th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 116–129. ACM, New York (2004)CrossRefGoogle Scholar
  32. 32.
    Guy, J., Steele, L.: Growing a language. Higher Order Symbol. Comput. 12(3), 221–236 (1999)CrossRefGoogle Scholar
  33. 33.
    Hannemann, J., Kiczales, G.: Design pattern implementation in Java and AspectJ. In: Proceedings of the 17th ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 161–173. ACM Press (2002)Google Scholar
  34. 34.
    Haupt, M., Schippers, H.: A Machine Model for Aspect-Oriented Programming. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 501–524. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  35. 35.
    Havinga, W.K.: On the Design of Software Composition Mechanisms and the Analysis of Composition Conflicts. PhD thesis, University of Twente, Enschede (June 2009)Google Scholar
  36. 36.
    Havinga, W., Bergmans, L., Aksit, M.: Prototyping and Composing Aspect Languages Using an Aspect Interpreter Framework. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 180–206. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  37. 37.
    Havinga, W.K., Bergmans, L.M.J., Akşit, M.: A model for composable composition operators: Expressing object and aspect compositions with first-class operators. In: Proceedings of the 9th International Conference on Aspect-Oriented Software Development, Rennes and Saint-Malo, pp. 145–156. ACM, New York (2010)CrossRefGoogle Scholar
  38. 38.
    Havinga, W.K., Bockisch, C.M., Bergmans, L.M.J.: A case for custom, composable composition operators. In: Proceedings of the 1st International Workshop on Composition: Objects, Aspects, Components, Services and Product Lines, Rennes, France. Workshop Proceedings, vol. 564, pp. 45–50. CEUR-WS (March 2010)Google Scholar
  39. 39.
    Hirschfeld, R.: Aspect-oriented programming with AspectS. In: Akşit, M., Mezini, M. (eds.) Net.Object Days 2002 (October 2002)Google Scholar
  40. 40.
    Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems (TOPLAS) 23(3), 396–450 (2001)CrossRefGoogle Scholar
  41. 41.
    Johnson, R.: Design patterns and language design,
  42. 42.
    Kiczales, G.: It’s not metaprogramming. Software Development Magazine (10) (2004)Google Scholar
  43. 43.
    Kiczales, G., des Rivieres, J., Bobrow, D.G.: The Art of the Metaobject Protocol. MIT Press, Cambridge (1991)Google Scholar
  44. 44.
    Kiczales, G., Lamping, J., Mendhekar, A., Maeda, C., Lopes, C., Loingtier, J.-M., Irwin, J.: Aspect-oriented programming. Technical Report SPL97-008 P9710042, Xerox PARC (February 1997)Google Scholar
  45. 45.
    Kojarski, S., Lorenz, D.H.: Awesome: an aspect co-weaving system for composing multiple aspect-oriented extensions. SIGPLAN Notices 42(10), 515–534 (2007)CrossRefGoogle Scholar
  46. 46.
    Lieberman, H.: Using prototypical objects to implement shared behavior in object-oriented systems. SIGPLAN Not. 21(11), 214–223 (1986)MathSciNetCrossRefGoogle Scholar
  47. 47.
    Madsen, O.L., Mø-Pedersen, B., Nygaard, K.: Object-oriented programming in the BETA programming language. ACM Press/Addison-Wesley Publishing Co., New York, NY, USA (1993)Google Scholar
  48. 48.
    Masuhara, H., Kiczales, G.: Modeling Crosscutting in Aspect-Oriented Mechanisms. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 2–28. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  49. 49.
    Millstein, T.: Practical predicate dispatch. ACM SIGPLAN Notices 39(10), 345–364 (2004)CrossRefGoogle Scholar
  50. 50.
    Nagy, I., Bergmans, L., Havinga, W., Aksit, M.: Utilizing design information in aspect-oriented programming. In: Hirschfeld, R., Kowalczyk, R., Polze, A., Weske, M. (eds.) Proceedings of International Conference NetObjectDays, NODe 2005, Erfurt, Germany. Lecture Notes in Informatics, vol. P-69, Gesellschaft für Informatik, GI (September 2005)Google Scholar
  51. 51.
    Notkin, D., Garlan, D., Griswold, W.G., Sullivan, K.J.: Adding Implicit Invocation to Languages: Three Approaches. In: Nishio, S. (ed.) ISOTAS 1993. LNCS, vol. 742, pp. 489–510. Springer, Heidelberg (1993)CrossRefGoogle Scholar
  52. 52.
    Ostermann, K., Mezini, M.: Object-oriented composition untangled. In: Proc. OOPSLA 2001 Conf. Object Oriented Programming Systems Languages and Applications, pp. 283–299. ACM Press (2001)Google Scholar
  53. 53.
    Piumarta, I., Warth, A.: Open, extensible object models. In: Self-Sustaining Systems. Springer (2008)Google Scholar
  54. 54.
    Rajan, H., Sullivan, K.J.: Classpects: unifying aspect- and object-oriented language design. In: ICSE 2005: Proceedings of the 27th International Conference on Software Engineering, pp. 59–68. ACM Press, New York (2005)Google Scholar
  55. 55.
    Riehle, D., Gross, T.: Role model based framework design and integration. SIGPLAN Not. 33(10), 117–133 (1998)CrossRefGoogle Scholar
  56. 56.
    Taivalsaari, A.: On the notion of inheritance. ACM Comput. Surv. 28(3), 438–479 (1996)CrossRefGoogle Scholar
  57. 57.
    Tanter, É., Noyé, J.: A Versatile Kernel for Multi-language AOP. In: Glück, R., Lowry, M. (eds.) GPCE 2005. LNCS, vol. 3676, pp. 173–188. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  58. 58.
    Tarr, P., Ossher, H., Harrison, W., Sutton Jr., S.M.: N degrees of separation: Multi-dimensional separation of concerns. In: Proc. 21st Int’l Conf. Software Engineering (ICSE 1999), pp. 107–119. IEEE Computer Society Press (May 1999)Google Scholar
  59. 59.
    Thompson, S.: Programming Language Semantics using Miranda. Technical Report 9-95, University of Kent, Computing Laboratory, University of Kent, Canterbury, UK (May 1995)Google Scholar
  60. 60.
    Turner, D.: Miranda: A non-strict functional language with polymorphic types. In: Functional Programming Languages and Computer Architecture, vol. 201, pp. 1–16. Springer (1985)Google Scholar
  61. 61.
    Ungar, D., Smith, R.B.: Self: The power of simplicity. SIGPLAN Not. 22, 227–242 (1987)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Lodewijk Bergmans
    • 1
  • Wilke Havinga
    • 1
  • Mehmet Aksit
    • 1
  1. 1.University of TwenteEnschedeThe Netherlands

Personalised recommendations