Advertisement

Program Transformation with Reflection and Aspect-Oriented Programming

  • Shigeru Chiba
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4143)

Abstract

A meta-programming technique known as reflection can be regarded as a sophisticated programming interface for program transformation. It allows software developers to implement various useful program transformation without serious efforts. Although the range of program transformation enabled by reflection is quite restricted, it covers a large number of interesting applications. In particular, several non-functional concerns found in web-application software, such as distribution and persistence, can be implemented with program transformation by reflection. Furthermore, a recently emerging technology known as aspect-oriented programming (AOP) provides better and easier programming interface than program transformation does. One of the roots of AOP is reflection and thus this technology can be regarded as an advanced version of reflection. In this tutorial, we will discuss basic concepts of reflection, such as compile-time reflection and runtime reflection, and its implementation techniques. The tutorial will also cover connection between reflection and aspect-oriented programming.

Keywords

Program Transformation Logging Object Application Framework Partial Evaluator Public Class 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Bobrow, D.G., DeMichiel, L.G., Gabriel, R.P., Keene, S.E., Kiczales, G., Moon, D.A.: Common lisp object system specification. Sigplan Notices (1988) (X3J13 Document 88-002R)Google Scholar
  2. 2.
    Bockisch, C., Haupt, M., Mezini, M., Ostermann, K.: Virtual machine support for dynamic join points. In: Proc. of Int’l Conf. on Aspect-Oriented Software Development (AOSD 2004), pp. 83–92 (2004)Google Scholar
  3. 3.
    Bracha, G., Ungar, D.: Mirrors: design principles for meta-level facilities of object-oriented programming languages. In: Proc. of ACM Conf. on Object-Oriented Programming Systems, Languages, and Applications, pp. 331–334. ACM, New York (2004)Google Scholar
  4. 4.
    Cazzola, W.: mcharm: Reflective middleware with a global view of communications. IEEE Distributed System On-Line 3 (2002)Google Scholar
  5. 5.
    Chiba, S.: A metaobject protocol for C++. In: Proc. of ACM Conf. on Object-Oriented Programming Systems, Languages, and Applications. SIGPLAN Notices, vol. 30(10), pp. 285–299. ACM Press, New York (1995)CrossRefGoogle Scholar
  6. 6.
    Chiba, S.: Macro processing in object-oriented languages. In: Proc. of Technology of Object-Oriented Languages and Systems (TOOLS Pacific 1998), pp. 113–126. IEEE Press, Los Alamitos (1998)Google Scholar
  7. 7.
    Chiba, S.: Load-time structural reflection in Java. In: Bertino, E. (ed.) ECOOP 2000. LNCS, vol. 1850, pp. 313–336. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  8. 8.
    Chiba, S., Ishikawa, R.: Aspect-oriented programming beyond dependency injection. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 121–143. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  9. 9.
    Chiba, S., Masuda, T.: Designing an extensible distributed language with a meta-level architecture. In: Nierstrasz, O. (ed.) ECOOP 1993. LNCS, vol. 707, pp. 482–501. Springer, Heidelberg (1993)CrossRefGoogle Scholar
  10. 10.
    Chiba, S., Nishizawa, M.: An easy-to-use toolkit for efficient Java bytecode translators. In: Pfenning, F., Smaragdakis, Y. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 364–376. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  11. 11.
    Dahm, M.: Byte code engineering with the javaclass api. Techincal Report B-17-98, Institut für Informatik, Freie Universität Berlin (1999)Google Scholar
  12. 12.
    Ershov, A.: On the essence of compilation. In: Neuhold, E. (ed.) Formal Description of Programming Concepts, pp. 391–420. North-Holland, Amsterdam (1978)Google Scholar
  13. 13.
    Ferber, J.: Computational reflection in class based object oriented languages. In: Proc. of ACM Conf. on Object-Oriented Programming Systems, Languages, and Applications, pp. 317–326 (1989)Google Scholar
  14. 14.
    Foote, B., Johnson, R.E.: Reflective facilities in Smalltalk-80. In: Proc. of ACM Conf. on Object-Oriented Programming Systems, Languages, and Applications, pp. 327–335 (1989)Google Scholar
  15. 15.
    Fowler, M.: Inversion of control containers and the dependency injection pattern (2004), http://www.martinfowler.com/articles/injection.html
  16. 16.
    Futamura, Y.: Partial computation of programs. In: Goto, E., Nakajima, R., Yonezawa, A., Nakata, I., Furukawa, K. (eds.) Proc. of RIMS Symposia on Software Science and Engineering. LNCS, vol. 147, pp. 1–35. Springer, Heidelberg (1983)Google Scholar
  17. 17.
    Goldberg, A., Robson, D.: Smalltalk-80: The Language and Its Implementation. Addison-Wesley, Reading (1983)MATHGoogle Scholar
  18. 18.
    Golm, M., Kleinöder, J.: Jumping to the meta level, behavioral reflection can be fast and flexible. In: Cointe, P. (ed.) Reflection 1999. LNCS, vol. 1616, pp. 22–39. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  19. 19.
    JBoss Inc.: JBoss AOP 1.0.0 final (2004), http://www.jboss.org/
  20. 20.
    Kiczales, G., des Rivières, J., Bobrow, D.G.: The Art of the Metaobject Protocol. The MIT Press, Cambridge (1991)Google Scholar
  21. 21.
    Kiczales, G., Lamping, J., Mendhekar, A., Maeda, C., Lopes, C., Loingtier, J., Irwin, J.: Aspect-oriented programming. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 220–242. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  22. 22.
    Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An overview of AspectJ. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 327–353. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  23. 23.
    Lopes, C.V., Ngo, T.C.: The aspect markup language and its support of aspect plugins. Isr technical report # uci-isr-04-8, University of California, Irvine (2004)Google Scholar
  24. 24.
    Maes, P.: Concepts and experiments in computational reflection. In: Proc. of ACM Conf. on Object-Oriented Programming Systems, Languages, and Applications, pp. 147–155 (1987)Google Scholar
  25. 25.
    Masuhara, H., Matsuoka, S., Asai, K., Yonezawa, A.: Compiling away the meta-level in object-oriented concurrent reflective languages using partial evaluation. In: Proc. of ACM Conf. on Object-Oriented Programming Systems, Languages, and Applications, pp. 300–315 (1995)Google Scholar
  26. 26.
    Masuhara, H., Matsuoka, S., Watanabe, T., Yonezawa, A.: Object-oriented concurrent reflective languages can be implemented efficiently. In: Proc. of ACM Conf. on Object-Oriented Programming Systems, Languages, and Applications, pp. 127–144 (1992)Google Scholar
  27. 27.
    Masuhara, H., Yonezawa, A.: Design and partial evaluation of meta-objects for a concurrent reflective languages. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 418–439. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  28. 28.
    McAffer, J.: Meta-level programming with coda. In: Olthoff, W. (ed.) ECOOP 1995. LNCS, vol. 952, pp. 190–214. Springer, Heidelberg (1995)Google Scholar
  29. 29.
    Mezini, M., Ostermann, K.: Conquering aspects with caesar. In: Proc. of Int’l Conf. on Aspect-Oriented Software Development (AOSD 2003), pp. 90–99. ACM Press, New York (2003)CrossRefGoogle Scholar
  30. 30.
    Popovici, A., Gross, T., Alonso, G.: Dynamic weaving for aspect-oriented programming. In: Proc. of Int’l Conf. on Aspect-Oriented Software Development (AOSD 2002), pp. 141–147. ACM Press, New York (2002)CrossRefGoogle Scholar
  31. 31.
    Rajan, H., Sullivan, K.J.: Classpects: Unifying aspect- and object-oriented language design. In: Proc. of the 27th International Conference on Software Engineering (ICSE 2005), pp. 59–68. ACM Press, New York (2005)CrossRefGoogle Scholar
  32. 32.
    Sakurai, K., Masuhara, H., Ubayashi, N., Matsuura, S., Kimoya, S.: Association aspects. In: Aspect-Oriented Software Development, pp. 16–25 (2004)Google Scholar
  33. 33.
    Sato, Y., Chiba, S., Tatsubori, M.: A selective, just-in-time aspect weaver. In: Pfenning, F., Smaragdakis, Y. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 189–208. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  34. 34.
    Smith, B.C.: Reflection and semantics in Lisp. In: Proc. of ACM Symp. on Principles of Programming Languages, pp. 23–35 (1984)Google Scholar
  35. 35.
    Smith, B.: Reflection and semantics in a procedural languages. Technical Report MIT-TR-272, M.I.T. Laboratory for Computer Science (1982)Google Scholar
  36. 36.
    Sun Microsystems: Java 2 Platform, Enterprise Edition (J2EE), http://java.sun.com/j2ee/
  37. 37.
    Suvée, D., Vanderperren, W., Jonckers, V.: Jasco: An aspect-oriented approach tailored for component based software development. In: Proc. of Int’l Conf. on Aspect-Oriented Software Development (AOSD 2003), pp. 21–29. ACM Press, New York (2003)CrossRefGoogle Scholar
  38. 38.
    Tatsubori, M., Chiba, S., Killijian, M.O., Itano, K.: Openjava: A class-based macro system for java. In: Cazzola, W., Stroud, R.J., Tisato, F. (eds.) Reflection and Software Engineering. LNCS, vol. 1826, pp. 117–135. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  39. 39.
    Watanabe, T., Yonezawa, A.: Reflection in an object-oriented concurrent language. In: Proc. of ACM Conf. on Object-Oriented Programming Systems, Languages, and Applications, pp. 306–315 (1988)Google Scholar
  40. 40.
    Welch, I., Stroud, R.: From dalang to kava — the evolution of a reflective java extension. In: Cointe, P. (ed.) Reflection 1999. LNCS, vol. 1616, pp. 2–21. Springer, Heidelberg (1999)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Shigeru Chiba
    • 1
  1. 1.Dept. of Mathematical and Computing SciencesTokyo Institute of TechnologyJapan

Personalised recommendations