Comparing Two Class Composition Approaches | SpringerLink
Skip to main content

Comparing Two Class Composition Approaches

  • Conference paper
Evaluation of Novel Approaches to Software Engineering (ENASE 2013)

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

  • 426 Accesses

Abstract

The presence of code replication can be a consequence of a lack in the composition mechanisms where classes are insufficient to reuse the code that is replicated. To extend the reuse of pieces of code some proposals have been made that try to compose classes using those pieces of code. In this paper we compare two of those approaches: Traits and Roles. We compare their compositions mechanisms and how we can use them to reduce code replication. To study the extent to which they reduce code replication we conducted a case study using the JHotDraw framework where we detect and remove code replication using each technique. Results from the case study show that roles have an advantage over traits, as they are capable of removing more code replication.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
¥17,985 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
JPY 3498
Price includes VAT (Japan)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
JPY 5719
Price includes VAT (Japan)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
JPY 7149
Price includes VAT (Japan)
  • 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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Fowler, M.: Refactoring: Improving the design of existing code. Addison-Wesley, Boston (1999)

    Google Scholar 

  2. Mayrand, J., Leblanc, C., Merlo, E.: Experiment on the Automatic Detection of Function Clones in a Software System Using Metrics. In: Proc. of the International Conference on Software Maintenance (1996)

    Google Scholar 

  3. Baxter, I., Yahin, A., Moura, L., Sant’Anna, M., Bier, L.: Clone Detection Using Abstract Syntax Trees. In: Proc. of Int. Conf. on Software Maintenance (1998)

    Google Scholar 

  4. Roy, C., Cordy, J.: A Survey on Software Clone Detection Research. Tech. Report 2007-451, School of Computing, Queen’s University at Kingston (2007)

    Google Scholar 

  5. Bracha, G., Cook, W.: Mixin-Based Inheritance. In: Proceedings of the OOPSLA/ECOOP, pp. 303–311. ACM Press, Ottawa (1990)

    Chapter  Google Scholar 

  6. Ducasse, S., Schaerli, N., Nierstrasz, O., Wuyts, R., Black, A.: Traits: A mechanism for fine-grained reuse. Trans. on Programming Languages and Systems (2004)

    Google Scholar 

  7. Scharli, N., Ducasse, S., Nierstrasz, O., Black, A.: Traits: Composable units of behavior. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 248–274. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  8. Apel, S., Kästner, C.: An Overview of Feature-Oriented Software Development. Journal of Object Technology 8(5) (July-August 2009)

    Google Scholar 

  9. Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An overview of aspectJ. In: Lindskov Knudsen, J. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 327–354. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  10. Quitslund, P., Black, A.: Java with traits - improving opportunities for reuse. In: Proceedings of the 3rd International Workshop on Mechanisms for Specialization, Generalization and Inheritance (2004)

    Google Scholar 

  11. Smith, C., Drossopoulou, S.: chai: Traits for java-like languages. In: Gao, X.-X. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 453–478. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  12. Riehle, D.: Framework Design: A Role Modeling Approach, Ph. D. Thesis, Swiss Federal Institute of technology, Zurich (2000)

    Google Scholar 

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

    Article  MATH  Google Scholar 

  14. Herrmann, S.: Programming with Roles in ObjectTeams/Java. In: AAAI Fall Symposium: “Roles, An Interdisciplinary Perspective” (2005)

    Google Scholar 

  15. Tamai, T., Ubayashi, N., Ichiyama, R.: Objects as Actors Assuming Roles in the Environment. In: Choren, R., Garcia, A., Giese, H., Leung, H.-f., Lucena, C., Romanovsky, A. (eds.) SELMAS. LNCS, vol. 4408, pp. 185–203. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  16. Barbosa, F., Aguiar, A.: Using Roles to Model Crosscutting Concerns. In: Aspect Oriented Software Devlopment (AOSD3), Fukuoka, Japan, March 24-29 (2013)

    Google Scholar 

  17. Van Cutsem, T., Bergel, A., Ducasse, S., De Meuter, W.: Adding State and Visibility Control to Traits Using Lexical Nesting. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 220–243. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  18. Ducasse, S., Wuyts, R., Bergel, A., Nierstrasz, O.: User-changeable visibility: Resolving unanticipated name clashes in traits. In: Proceedings OOPSLA, New York, NY (2007)

    Google Scholar 

  19. Fanta, R., Rajlich, V.: Removing Clones from the Code. Journal of Software Maintenance: Research and Practice 11(4), 223–243 (1999)

    Article  Google Scholar 

  20. Komondoor, R., Horwitz, S.S.: Semantics-Preserving Procedure Extraction. In: Proceedings of the 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2000), Boston, MA, USA, pp. 155–169 (2000)

    Google Scholar 

  21. Higo, Y., Kamiya, T., Kusumoto, S., Inoue, K.: Refactoring Support Based on Code Clone Analysis. In: Bomarius, F., Iida, H. (eds.) PROFES 2004. LNCS, vol. 3009, pp. 220–233. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

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

    Google Scholar 

  23. Kamiya, T., Kusumoto, S., Inoue, K.: Ccfinder: a multilinguistic tokenbased code clone detection system for large scale source code. IEEE Trans. Soft. Eng. 28(7) (2002)

    Google Scholar 

  24. Ceccato, M., Marin, M., Mens, K., Moonen, L., Tonella, P., Tourwe, T.: A qualitative comparison of three aspect mining techniques. In: Proc. of the Inter. Workshop on Program Comprehension, Washington (2005)

    Google Scholar 

  25. Barbosa, F., Aguiar, A.: Roles as Modular Units of Composition. In: 7th International Conference on Evaluation of Novel Approaches to Software Engineering, Wroclaw, Poland, pp. 29–30 (June 2012)

    Google Scholar 

  26. Baldoni, M., Boella, G., van der Torre, L.: Interaction between Objects in powerJava. Journal of Object Technologies 6, 7–12 (2007)

    Google Scholar 

  27. Batory, D., Sarvela, J.N., Rauschmayer, A.: Scaling Step-Wise Refinement. IEEE TSE 30(6) (2004)

    Google Scholar 

  28. Krogdahl, S., Møller-Pedersen, B., Sørensen, F.: Exploring the use of Package Templates for flexible reuse of Collections of related Classes. Journal of Object Technology 8(7) (2005)

    Google Scholar 

  29. Steimann, F.: The paradoxical success of aspect-oriented programming. In: Proceedings of the 21st Annual Conference OOPSLA 2006 (2006)

    Google Scholar 

  30. Przybyłek, A.: Systems Evolution and Software Reuse in Object-Oriented Programming and Aspect-Oriented Programming. In: Bishop, J., Vallecillo, A. (eds.) TOOLS 2011. LNCS, vol. 6705, pp. 163–178. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  31. Kästner, C., Apel, S., Batory, D.: A Case Study Implementing Features using AspectJ. In: 11th Inter. Conference of Software Product Line, Kyoto, Japan (2007)

    Google Scholar 

  32. Griswold, W.G., Sullivan, K., Song, Y., Shonle, M., Tewari, N., Cai, Y., Rajan, H.: Modular Software Design with Crosscutting Interfaces. IEEE Software 23(1), 51–60 (2006)

    Article  Google Scholar 

  33. Mezini, M., Ostermann, K.: Conquering Aspects with Caesar. In: Proc. of AOSD 2003, pp. 90–99 (2003)

    Google Scholar 

  34. McDirmid, S., Flatt, M., Hsieh, W.C.: Jiazzi: new-Age Components for Old-Fashioned Java. In: OOPSLA 2001 (2001)

    Google Scholar 

  35. Flatt, M., Felleisen, M.: Units: Cool modules for HOT languages. In: Proc. of PLDI (May 1998)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Barbosa, F., Aguiar, A. (2013). Comparing Two Class Composition Approaches. In: Filipe, J., Maciaszek, L.A. (eds) Evaluation of Novel Approaches to Software Engineering. ENASE 2013. Communications in Computer and Information Science, vol 417. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-54092-9_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-54092-9_7

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-54091-2

  • Online ISBN: 978-3-642-54092-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics