skip to main content
article

An approach to implementing dynamic adaptation in C++

Published:21 May 2005Publication History
Skip Abstract Section

Abstract

This paper describes TRAP/C++, a software tool that enables new adaptable behavior to be added to existing C++ programs in a transparent fashion. In previous investigations, we used an aspect-oriented approach to manually define aspects for adaptation infrastructure, which were woven into the original application code at compile time. In follow-on work, we developed TRAP, a transparent shaping technique for automatically generating adaptation aspects, where TRAP/J is a specific instantiation of TRAP. This paper presents our work into building TRAP/C++, which was intended to be a port of TRAP/J into C++. Designing TRAP/C++ required us to overcome two major hurdles: lack of reflection in C++ and the incompatibility between the management of objects in C++ and the aspect weaving technique used in TRAP/J. We used generative programming methods to produce two tools, TrapGen and TrapCC, that work together to produce the desired TRAP/C++ functionality. Details of the TRAP/C++ architecture and operation are presented, which we illustrate with a description of a case study that adds dynamic auditing capabilities to an existing distributed C++ application.

References

  1. V. Adve, V. V. Lam, and B. Ensink. Language and compiler support for adaptive distributed applications. In Proc. ACM SIGPLAN workshop on Languages, compilers and tools for embedded systems, pages 238--246. ACM Press, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. M. Aksit, L. Bergmans, and S. Vural. An object-oriented language-database integration model: The composition-filters approach. In Proc. European Conference on Object-Oriented Programming (ECOOP), pages 372--395. Springer-Verlag, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. G. Blair, G. Coulson, and N. Davies. Adaptive middleware for mobile multimedia applications. In Proc. 7th International Workshop on Network and Operating System Support for Digital Audio and Video (NOSSDAY 97), pages 259--273, 1997.]]Google ScholarGoogle ScholarCross RefCross Ref
  4. S. Chiba. A metaobject protocol for C++. In Proc. Conference on Object-oriented programming systems, languages, and applications (OOPSLA), pages 285--299. ACM Press, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. Chiba and T. Masuda. Designing an extensible distributed language with a meta-level architecture. In ECOOP, pages 482--501. Springer-Verlag, 1993.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. K. Czarnecki and U. W. Eisenecker. Generative Programming: Methods, Tools, and Applications. ACM Press/Addison-Wesley Publishing Co., 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. P. C. David, T. Ledoux, and N. M. N. Bouraqadi-Saadani. Two-step weaving with reflection using AspectJ. In OOPSLA Workshop on Advanced Separation of Concerns in Object-Oriented Systems, 2001.]]Google ScholarGoogle Scholar
  8. J. de Oliveira Guimarães. Reflection for statically typed languages. In ECOOP, pages 440--461. Springer-Verlag, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. E. B. Duffy, J. P. Gibson, and B. A. Malloy. Applying the decorator pattern for profiling object-oriented software. In IWPC, pages 84--93, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. Ferber. Computational reflection in class based object-oriented languages. In OOPSLA, pages 317--326. ACM Press, 1989.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. E. Gamma, R. Helm, R. Johnson, and J. Vlisside. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading, Massachusetts, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. M. Golm and J. Kleinoder. metaXa and the future of reflection. In OOPSLA Workshop on Reflective Programming in C++ and Java, pages 1--5, 1998.]]Google ScholarGoogle Scholar
  13. G. Hjalmtysson and R. Gray. Dynamic C++ classes---A lightweight mechanism to update code in a running program. In USENIX Annual Technical Conf., pages 65--76, June 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. E. P. Kasten, P. K. McKinley, S. M. Sadjadi, and R. E. K. Stirewalt. Separating introspection and intercession in metamorphic distributed systems. In Proc. IEEE Workshop on Aspect-Oriented Programming for Distributed Computing (with ICDCS'02), Vienna, Austia, July 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. G. Kiczales, E. Hilsdale, J. Hugunin, M. Kersten, J. Palm, and W. G. Griswold. An overview of aspectj. In ECOOP, pages 327--353. Springer-Verlag, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. G. Kiczales, J. Lamping, A. Mendhekar, C. Maeda, C. V. Lopes, J.-M. Loingtier, and J. Irwin. Aspect-oriented programming. In ECOOP, June 1997.]]Google ScholarGoogle ScholarCross RefCross Ref
  17. P. Maes. Concepts and experiments in computational reflection. In OOPSLA, pages 147--155. ACM Press, 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. P.K. McKinley, S. M. Sadjadi, E. P. Kasten, and B. H. C. Cheng. Composing adaptive software. IEEE Computer, 37(7):56--64, July 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. A. Oliva and L. E. Buzato. The implementation of Guaraná on Java. Technical Report IC-98-32, Universidade Estadual de Campinas, September 1998.]]Google ScholarGoogle Scholar
  20. A. Popovici, T. Gross, and G. Alonso. Dynamic homogeneous AOP with PROSE. Technical report, Department of Computer Science, Federal Institute of Technology, Zurich, Switzerland, March 2001.]]Google ScholarGoogle Scholar
  21. B. Redmond and V. Cahill. Supporting unanticipated dynamic adaptation of application behaviour. In ECOOP, pages 205--230. Springer-Verlag, 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. S. M. Sadjadi, P. K. McKinley, B. H. C. Cheng, and R. E. K. Stirewalt. TRAP/J: Transparent generation of adaptable java programs. In Proc. 2004 International Symposium on Distributed Objects and Applications, Agia Napa, Cyprus, October 2004.]]Google ScholarGoogle ScholarCross RefCross Ref
  23. S. M. Sadjadi, P. K. McKinley, R. E. K. Stirewalt, and B. H. C. Cheng. Generation of self-optimizing wireless network applications. In Proc. International Conference on Autonomic Computing (ICAC-04), New York, NY, May 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. É. Tanter, J. Noyé, D. Caromel, and P. Cointe. Partial behavioral reflection: spatial and temporal selection of reification. In OOPSLA, pages 27--46. ACM Press, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. M. Tatsubori, S. Chiba, K. Itano, and M.-O. Killijian. Openjava: A class-based macro system for java. In Proc. 1st OOPSLA Workshop on Reflection and Software Engineering, pages 117--133. Springer-Verlag, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Z. Yang, B. H. C. Cheng, R. E. K. Stirewalt, J. Sowell, S. M. Sadjadi, and P. K. McKinley. An aspect-oriented approach to dynamic adaptation. In Proc. ACM SIGSOFT Workshop on Self-Healing Systems (WOSS02), Charleston, South Carolina, November 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. An approach to implementing dynamic adaptation in C++

    Recommendations

    Reviews

    Andrea F Paramithiotti

    The authors describe a software tool they developed to include adaptive behavior in C++ programs, namely, to make a C++ program capable of modifying its behavior at runtime in response to changes in the environment. The authors build on a similar tool they already developed for the Java language; this work describes the similarities and differences between the two tools, as well as the process that led from the Java tool to the C++ one. They begin by framing the problem of adding adaptive behavior in software applications and discuss its present relevance, due, for example, to the rise of mobile applications; they explain that the main problem consists of introducing adaptive behavior in languages with little or no support for dynamic adaptation. They then describe the adaptive message-handling protocol they developed in the Java version of their tool. They go on to explain how they extended dynamic adaptation to C++, and how structural differences between the two languages gave rise to two radically different tools. This is the core of the paper, with each feature described in detail, supported by diagrams and excerpts of code. In the last section of the paper, the authors apply their tool to a browser system that streams text over a transmission control protocol (TCP) socket. In this way, they are able to monitor socket activity. This is a technical paper; it is very detailed, and covers all major aspects and issues of dynamic adaptation. The authors are clearly leaders in this field; their writing is authoritative yet clear, and key concepts are marked by references to previous research conducted by them, as well as by other groups. All references are then grouped together at the end of the paper in a very detailed bibliography. Figures and excerpts of code also help explain core concepts. The main audience for this paper is professional software developers; a strong competence not only in programming, but also in this particular field is recommended to gain full advantage from this paper. Online Computing Reviews Service

    Access critical reviews of Computing literature here

    Become a reviewer for Computing Reviews.

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGSOFT Software Engineering Notes
      ACM SIGSOFT Software Engineering Notes  Volume 30, Issue 4
      July 2005
      1514 pages
      ISSN:0163-5948
      DOI:10.1145/1082983
      Issue’s Table of Contents
      • cover image ACM Other conferences
        DEAS '05: Proceedings of the 2005 workshop on Design and evolution of autonomic application software
        May 2005
        105 pages
        ISBN:1595930396
        DOI:10.1145/1083063

      Copyright © 2005 Copyright is held by the owner/author(s)

      Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 21 May 2005

      Check for updates

      Qualifiers

      • article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader