Skip to main content

Scala Roles: Reusable Object Collaborations in a Library

  • Conference paper

Part of the book series: Communications in Computer and Information Science ((CCIS,volume 47))

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

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Reenskaug, T., Wold, P., Lehne, O.A.: Working with Objects, The OOram Software Engineering Method. Manning (1996)

    Google Scholar 

  2. Riehle, D.: Framework Design: A Role Modeling Approach. PhD thesis, ETH Zürich (2000)

    Google Scholar 

  3. Steimann, F.: On the representation of roles in object-oriented and conceptual modelling. Data & Knowledge Engineering 35(1), 83–106 (2000)

    Article  MATH  Google Scholar 

  4. Object Management Group OMG: OMG Unified Modeling Language (OMG UML), Superstructure, v2.1.2 (November 2007)

    Google Scholar 

  5. 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)

    Google Scholar 

  6. Herrmann, S.: A precise model for contextual roles: The programming language ObjectTeams/Java. Applied Ontology 2(2), 181–207 (2007)

    Google Scholar 

  7. 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)

    Article  Google Scholar 

  8. Odersky, M.: Scala Language Specification, Version 2.7 (May 2008)

    Google Scholar 

  9. Guarino, N.: Concepts, attributes and arbitrary relations: Some linguistic and ontological criteria for structuring knowledge bases. Data & Knowledge Engineering 8(3), 249–261 (1992)

    Article  Google Scholar 

  10. Kristensen, B.B., Østerbye, K.: Roles: Conceptual abstraction theory and practical language issues. Theory and Practice of Object Systems 2(3), 143–160 (1996)

    Article  Google Scholar 

  11. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1995)

    Google Scholar 

  12. Harrison, W.: Homepage on subject-oriented programming and design patterns (1997), http://www.research.ibm.com/sop/sopcpats.htm

  13. Odersky, M., Spoon, L., Venners, B.: Programming in Scala, A comprehensive step-by-step guide. Artima (2008)

    Google Scholar 

  14. Riehle, D.: Composite design patterns. In: Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 1997), pp. 218–228. ACM, New York (1997)

    Google Scholar 

  15. Herrmann, S., Hundt, C., Mehner, K.: Translation polymorphism in Object Teams. Technical Report 2004/05, TU Berlin (2004)

    Google Scholar 

  16. 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)

    Chapter  Google Scholar 

  17. Kendall, E.A.: Role model designs and implementations with aspect-oriented programming. SIGPLAN Notices 34(10), 353–369 (1999)

    Article  MathSciNet  Google Scholar 

  18. Hannemann, J., Kiczales, G.: Design pattern implementation in Java and AspectJ. SIGPLAN Notices 37(11), 161–173 (2002)

    Article  Google Scholar 

  19. 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)

    Google Scholar 

  20. 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)

    Google Scholar 

  21. 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)

    Chapter  Google Scholar 

  22. Pradel, M.: Explicit relations with roles - a library approach. In: Workshop on Relationships and Associations in Object-Oriented Languages (RAOOL) at OOPSLA 2008 (2008)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics