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.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
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)
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)
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)
Cazzola, W.: mcharm: Reflective middleware with a global view of communications. IEEE Distributed System On-Line 3 (2002)
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)
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)
Chiba, S.: Load-time structural reflection in Java. In: Bertino, E. (ed.) ECOOP 2000. LNCS, vol. 1850, pp. 313–336. Springer, Heidelberg (2000)
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)
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)
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)
Dahm, M.: Byte code engineering with the javaclass api. Techincal Report B-17-98, Institut für Informatik, Freie Universität Berlin (1999)
Ershov, A.: On the essence of compilation. In: Neuhold, E. (ed.) Formal Description of Programming Concepts, pp. 391–420. North-Holland, Amsterdam (1978)
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)
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)
Fowler, M.: Inversion of control containers and the dependency injection pattern (2004), http://www.martinfowler.com/articles/injection.html
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)
Goldberg, A., Robson, D.: Smalltalk-80: The Language and Its Implementation. Addison-Wesley, Reading (1983)
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)
JBoss Inc.: JBoss AOP 1.0.0 final (2004), http://www.jboss.org/
Kiczales, G., des Rivières, J., Bobrow, D.G.: The Art of the Metaobject Protocol. The MIT Press, Cambridge (1991)
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)
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)
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)
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)
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)
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)
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)
McAffer, J.: Meta-level programming with coda. In: Olthoff, W. (ed.) ECOOP 1995. LNCS, vol. 952, pp. 190–214. Springer, Heidelberg (1995)
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)
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)
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)
Sakurai, K., Masuhara, H., Ubayashi, N., Matsuura, S., Kimoya, S.: Association aspects. In: Aspect-Oriented Software Development, pp. 16–25 (2004)
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)
Smith, B.C.: Reflection and semantics in Lisp. In: Proc. of ACM Symp. on Principles of Programming Languages, pp. 23–35 (1984)
Smith, B.: Reflection and semantics in a procedural languages. Technical Report MIT-TR-272, M.I.T. Laboratory for Computer Science (1982)
Sun Microsystems: Java 2 Platform, Enterprise Edition (J2EE), http://java.sun.com/j2ee/
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)
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)
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this chapter
Cite this chapter
Chiba, S. (2006). Program Transformation with Reflection and Aspect-Oriented Programming. 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_3
Download citation
DOI: https://doi.org/10.1007/11877028_3
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)