Abstract
Purely class-based implementations of object-oriented software are often inappropriate for reuse. In contrast, the notion of objects playing roles in a collaboration has been proven to be a valuable reuse abstraction. However, existing solutions to enable role-based programming tend to require vast extensions of the underlying programming language, and thus, are difficult to use in every day work. We present a programming technique, based on dynamic proxies, that allows to augment an object’s type at runtime while preserving strong static type safety. It enables role-based implementations that lead to more reuse and better separation of concerns.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Reenskaug, T., Wold, P., Lehne, O.A.: Working with Objects, The OOram Software Engineering Method. Manning (1996)
Riehle, D.: Framework Design: A Role Modeling Approach. PhD thesis, ETH Zürich (2000)
Steimann, F.: On the representation of roles in object-oriented and conceptual modelling. Data & Knowledge Engineering 35(1), 83–106 (2000)
Object Management Group OMG: OMG Unified Modeling Language (OMG UML), Superstructure, v2.1.2 (November 2007)
Bäumer, D., Riehle, D., Siberski, W., Wulf, M.: Role Object. In: Pattern Languages of Program Design 4, pp. 15–32. Addison-Wesley, Reading (2000)
Herrmann, S.: A precise model for contextual roles: The programming language ObjectTeams/Java. Applied Ontology 2(2), 181–207 (2007)
Smaragdakis, Y., Batory, D.: Mixin layers: An object-oriented implementation technique for refinements and collaboration-based designs. ACM Transactions on Software Engineering and Methodology (TOSEM) 11(2), 215–255 (2002)
Odersky, M.: Scala Language Specification, Version 2.7 (May 2008)
Guarino, N.: Concepts, attributes and arbitrary relations: Some linguistic and ontological criteria for structuring knowledge bases. Data & Knowledge Engineering 8(3), 249–261 (1992)
Kristensen, B.B., Østerbye, K.: Roles: Conceptual abstraction theory and practical language issues. Theory and Practice of Object Systems 2(3), 143–160 (1996)
Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)
Harrison, W.: Homepage on subject-oriented programming and design patterns (1997), http://www.research.ibm.com/sop/sopcpats.htm
Odersky, M., Spoon, L., Venners, B.: Programming in Scala, A comprehensive step-by-step guide. Artima (2008)
Riehle, D.: Composite design patterns. In: Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 1997), pp. 218–228. ACM, New York (1997)
Herrmann, S., Hundt, C., Mehner, K.: Translation polymorphism in Object Teams. Technical Report 2004/05, TU Berlin (2004)
Kiczales, G., Lamping, J., Mendhekar, A., Maeda, C., Lopes, C.V., 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)
Kendall, E.A.: Role model designs and implementations with aspect-oriented programming. SIGPLAN Notices 34(10), 353–369 (1999)
Hannemann, J., Kiczales, G.: Design pattern implementation in Java and AspectJ. SIGPLAN Notices 37(11), 161–173 (2002)
Rumbaugh, J.E.: Relations as semantic constructs in an object-oriented language. In: Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 1987), pp. 466–481 (1987)
Bierman, G.M., Wren, A.: First-class relationships in an object-oriented language. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 262–286. Springer, Heidelberg (2005)
Balzer, S., Gross, T.R., Eugster, P.: A relational model of object collaborations and its use in reasoning about relationships. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 323–346. Springer, Heidelberg (2007)
Pradel, M.: Explicit relations with roles - a library approach. In: Workshop on Relationships and Associations in Object-Oriented Languages (RAOOL) at OOPSLA 2008 (2008)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Pradel, M., Odersky, M. (2009). Scala Roles: Reusable Object Collaborations in a Library. In: Cordeiro, J., Shishkov, B., Ranchordas, A., Helfert, M. (eds) Software and Data Technologies. ICSOFT 2008. Communications in Computer and Information Science, vol 47. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-05201-9_3
Download citation
DOI: https://doi.org/10.1007/978-3-642-05201-9_3
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-05200-2
Online ISBN: 978-3-642-05201-9
eBook Packages: Computer ScienceComputer Science (R0)