A Calculus for Boxes and Traits in a Java-Like Setting

  • Lorenzo Bettini
  • Ferruccio Damiani
  • Marco De Luca
  • Kathrin Geilmann
  • Jan Schäfer
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6116)


The box model is a component model for the object-oriented paradigm, that defines components (the boxes) with clear encapsulation boundaries. Having well-defined boundaries is crucial in component-based software development, because it enables to argue about the interference and interaction between a component and its context. In general, boxes contain several objects and inner boxes, of which some are local to the box and cannot be accessed from other boxes and some can be accessible by other boxes. A trait is a set of methods divorced from any class hierarchy. Traits can be composed together to form classes or other traits. We present a calculus for boxes and traits. Traits are units of fine-grained reuse, whereas boxes can be seen as units of coarse-grained reuse. The calculus is equipped with an ownership type system and allows us to combine coarse- and fine-grained reuse of code by maintaining encapsulation of components.


Type System Software Product Line Domain Parameter Local Domain Trait Expression 
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.


  1. 1.
    Aldrich, J., Chambers, C.: Ownership domains: Separating aliasing policy from mechanism. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 1–25. Springer, Heidelberg (2004)Google Scholar
  2. 2.
    Bettini, L., Damiani, F., Schaefer, I.: Implementing Software Product Lines using Traits. In: SAC, pp. 2096–2102. ACM, New York (2010)CrossRefGoogle Scholar
  3. 3.
    Bono, V., Damiani, F., Giachino, E.: Separating Type, Behavior, and State to Achieve Very Fine-grained Reuse. In: FTfJP (2007),
  4. 4.
    Bono, V., Damiani, F., Giachino, E.: On Traits and Types in a Java-like setting. In: TCS (Track B). IFIP, vol. 273, pp. 367–382. Springer, Heidelberg (2008)Google Scholar
  5. 5.
    Boyapati, C.: SafeJava: A Unified Type System for Safe Programming. PhD thesis, Massachusetts Institute of Technology (February 2004)Google Scholar
  6. 6.
    Boyapati, C., Liskov, B., Shrira, L.: Ownership types for object encapsulation. In: POPL, pp. 213–223. ACM Press, New York (2003)Google Scholar
  7. 7.
    Clarke, D.: Object Ownership and Containment. PhD thesis, Univ. New South Wales (2001)Google Scholar
  8. 8.
    Clarke, D., Potter, J., Noble, J.: Ownership types for flexible alias protection. In: OOPSLA, pp. 48–64. ACM Press, New York (1998)Google Scholar
  9. 9.
    Cunningham, D., Dietl, W., Drossopoulou, S., Francalanza, A., Müller, P., Summers, A.J.: Universe types for topology and encapsulation. In: de Boer, F.S., Bonsangue, M.M., Graf, S., de Roever, W.-P. (eds.) FMCO 2007. LNCS, vol. 5382, pp. 72–112. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  10. 10.
    Dietl, W., Drossopoulou, S., Müller, P.: Generic Universe Types. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 28–53. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  11. 11.
    Ducasse, S., Nierstrasz, O., Schärli, N., Wuyts, R., Black, A.P.: Traits: A mechanism for fine-grained reuse. ACM TOPLAS 28(2), 331–388 (2006)CrossRefGoogle Scholar
  12. 12.
    Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001)CrossRefGoogle Scholar
  13. 13.
    Lagorio, G., Servetto, M., Zucca, E.: Flattening versus direct semantics for Featherweight Jigsaw. In: FOOL (2009),
  14. 14.
    Liquori, L., Spiwack, A.: FeatherTrait: A Modest Extension of Featherweight Java. ACM TOPLAS 30(2), 1–32 (2008)CrossRefGoogle Scholar
  15. 15.
    Lu, Y., Potter, J.: On ownership and accessibility. In: Thomas, D. (ed.) ECOOP 2006. LNCS, vol. 4067, pp. 99–123. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  16. 16.
    Müller, P., Poetzsch-Heffter, A.: A type system for controlling representation exposure in Java. In: FTfJP (2000),
  17. 17.
    Nierstrasz, O., Ducasse, S., Schärli, N.: Flattening traits. JOT 5(4), 129–148 (2006)Google Scholar
  18. 18.
    Poetzsch-Heffter, A., Gaillourdet, J.-M., Schäfer, J.: Towards a fully abstract semantics for object-oriented program components (July 2008),
  19. 19.
    Poetzsch-Heffter, A., Geilmann, K., Schäfer, J.: Infering ownership types for encapsulated object-oriented program components. In: Reps, T., Sagiv, M., Bauer, J. (eds.) Wilhelm Festschrift. LNCS, vol. 4444, pp. 120–144. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  20. 20.
    Poetzsch-Heffter, A., Schäfer, J.: Modular specification of encapuslated object-oriented components. In: de Boer, F.S., Bonsangue, M.M., Graf, S., de Roever, W.-P. (eds.) FMCO 2005. LNCS, vol. 4111, pp. 313–341. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  21. 21.
    Poetzsch-Heffter, A., Schäfer, J.: A representation-independent behavioral semantics for object-oriented components. In: Bonsangue, M.M., Johnsen, E.B. (eds.) FMOODS 2007. LNCS, vol. 4468, pp. 157–173. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  22. 22.
    Potanin, A., Noble, J., Clarke, D., Biddle, R.: Generic ownership for generic java. In: OOPSLA, pp. 311–324. ACM Press, New York (2006)Google Scholar
  23. 23.
    Reppy, J., Turon, A.: Metaprogramming with traits. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 373–398. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  24. 24.
    Schäfer, J., Poetzsch-Heffter, A.: A parameterized type system for simple loose ownership domains. Journal of Object Technology (JOT) 5(6), 71–100 (2007)Google Scholar
  25. 25.
    Smith, C., Drossopoulou, S.: Chai: Traits for Java-like languages. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 453–478. Springer, Heidelberg (2005)Google Scholar
  26. 26.
    Szyperski, C., Gruntz, D., Murer, S.: Component Software – Beyond Object-Oriented Programming, 2nd edn. Addison-Wesley, Reading (2002)Google Scholar
  27. 27.
    Ungar, D., Chambers, C., Chang, B.-W., Hölzle, U.: Organizing Programs Without Classes. Lisp and Symbolic Computation 4(3), 223–242 (1991)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Lorenzo Bettini
    • 1
  • Ferruccio Damiani
    • 1
  • Marco De Luca
    • 1
  • Kathrin Geilmann
    • 2
  • Jan Schäfer
    • 2
  1. 1.Dipartimento di InformaticaUniversità di Torino 
  2. 2.Department of Computer ScienceUniversity of Kaiserslautern 

Personalised recommendations