Skip to main content

A Feature Composition Problem and a Solution Based on C++ Template Metaprogramming

  • Chapter
Generative and Transformational Techniques in Software Engineering (GTTSE 2005)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 4143))

  • 810 Accesses

Abstract

Separation of concerns and collaboration based design is usually a suitable concept for library implementation: it results in easily scalable and maintainable code. After specifying and implementing orthogonal features, we aim to easily assemble library components. In real life, components can be used only after appropriate refinement steps, progressively adding features in each step. Therefore the specific solution for a particular task can be produced by composing a set of refined components. Unfortunately, a subtype anomaly occurs in object-oriented languages between such composite components that have different numbers of features from different refinement stages. In this article we analyse this anomaly that we named chevron-shape inheritance and present a framework based on standard C++ template metaprogramming.

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

Access this chapter

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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Zólyomi, I., Porkoláb, Z., Kozsik, T.: An extension to the subtype relationship in C++. In: Pfenning, F., Smaragdakis, Y. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 209–227. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  2. Alexandrescu, A.: Modern C++ Design: Generic Programming and Design Patterns Applied. Addison-Wesley, Reading (2001)

    Google Scholar 

  3. Vandevoorde, D., Josuttis, N.M.: C++ Templates: The Complete Guide. Addison-Wesley, Reading (2003)

    MATH  Google Scholar 

  4. Baumgartner, G., Russo, V.F.: Implementing Signatures for C++. ACM Transactions on Programming Languages and Systems (TOPLAS) 19(1), 153–187 (1997)

    Article  Google Scholar 

  5. Veldhuizen, T.: Using C++ Template Metaprograms. C++ Report 7(4), 36–43 (1995)

    Google Scholar 

  6. Veldhuizen, T.: Expression Templates. C++ Report 7(5), 26–31 (1995)

    Google Scholar 

  7. Garcia, R., Järvi, J., Lumsdaine, A., Siek, J., Willcock, J.: A Comparative Study of Language Support for Generic Programming. In: Proceedings of the 18th ACM SIGPLAN OOPSLA 2003, pp. 115–134 (2003)

    Google Scholar 

  8. Leroy, X., et al.: The Objective Caml system, release 3.0.8, documentation and user’s manual (July 2004), http://caml.inria.fr/ocaml/htmlman/index.html

  9. Jeremy Siek, J.: A Language for Generic Programming. PhD thesis, Indiana University (August 2005)

    Google Scholar 

  10. Don Batory, A.: Tutorial on Feature Oriented Programming and the AHEAD Tool Suite. Technical Report, TR-CCTC/DI-35, GTTSE, pp. 153–186 (2005)

    Google Scholar 

  11. Batory, D., Sarvela, J.N., Rauschmayer, A.: Scaling Step-Wise Refinement. IEEE Transactions on Software Engineering 30(6), 355–371

    Google Scholar 

  12. Batory, D., Liu, J., Sarvela, J.N.: Refinements and multi-dimensional separation of concerns. In: Proceedings of the 9th European Software Engineering Conference (2003)

    Google Scholar 

  13. Smaragdakis, Y., Batory, D.: Mixin-Based Programming in C++. In: Proceedings of Net.Object Days 2000, pp. 464–478 (2000)

    Google Scholar 

  14. Smaragdakis, Y., Batory, D.: Mixin Layers: An Object-Oriented Implementation Technique for Refinements and Collaboration-Based Designs. ACM Transactions of Software Engineering and Methodology 11(2), 215–255 (2002)

    Article  Google Scholar 

  15. Czarnecki, K., Eisenecker, U.W.: Generative Programming: Methods, Tools and Applications. Addison-Wesley, Reading (2000)

    Google Scholar 

  16. Stroustrup, B.: The C++ Programming Language Special Edition. Addison-Wesley, Reading (2000)

    Google Scholar 

  17. Stroustrup, B.: The Design and Evolution of C++. Addison-Wesley, Reading (1994)

    Google Scholar 

  18. Bertrand Meyer: Eiffel: The Language. Prentice Hall, Englewood Cliffs (1991)

    Google Scholar 

  19. Bergmans, L., Aksit, M.: Composing Crosscutting Concerns Using Composition Filters. Communications of the ACM 44(10), 51–57 (2001)

    Article  Google Scholar 

  20. Cardelli, L.: Structural Subtyping and the Notion of Power Type. In: Conference Record of the Fifteenth Annual ACM Symposium on Principles of Programming Languages, San Diego, California, January 1988, pp. 70–79 (1988)

    Google Scholar 

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

  22. Kiczales, G., et al.: An overview of AspectJ. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 327–355. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  23. Baumgartner, G., Jansche, M., Läufer, K.: Half & Half: Multiply Dispatch and Retroactive Abstraction for Java. Technical Report OSU-CISRC-5/01-TR08. Ohio State University (2002)

    Google Scholar 

  24. Eisenecker, U.W., Blinn, F., Czarnecki, K.: A Solution to the Constructor-Problem of Mixin-Based Programming in C++. In: The GCSE, Workshop on C++ Template Programming (2000)

    Google Scholar 

  25. Ossher, H., Tarr, P.: Multi-Dimensional Separation of Concerns and The Hyperspace Approach. IBM Research Report 21452, IBM T.J. Watson Research Center (April 1999), http://www.research.ibm.com/hyperspace/Papers/tr21452.ps

  26. Ossher, H., Tarr, P.: Hiper/J. Multidemensional Separation of Concerns for Java. In: International Conference on Software Engineering 2001, pp. 734–737. ACM, New York (2001)

    Google Scholar 

  27. Harrison, W., Ossher, H.: Subject-oriented programming: a critique of pure objects. In: Proceedings of 8th OOPSLA 1993, Washington D.C., USA, pp. 411–428 (1993)

    Google Scholar 

  28. Subject Oriented Programming, http://www.research.ibm.com/sop

  29. Shopiro, J.E.: An Example of Multiple Inheritance in C++: a Model of the Iostream Library. ACM SIGPLAN Notices (December 1989)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2006 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Porkoláb, Z., Zólyomi, I. (2006). A Feature Composition Problem and a Solution Based on C++ Template Metaprogramming. In: Lämmel, R., Saraiva, J., Visser, J. (eds) Generative and Transformational Techniques in Software Engineering. GTTSE 2005. Lecture Notes in Computer Science, vol 4143. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11877028_21

Download citation

  • DOI: https://doi.org/10.1007/11877028_21

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-45778-7

  • Online ISBN: 978-3-540-46235-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics