Abstract
Applications in an evolving computing environment should be designed to cope with varying data. Object-oriented programming, polymorphisms and parametric types often do not provide the required flexibility, which can be achieved with the use of metadata attached or extracted from objects by means of reflection. We present a general mechanism to support reflection in C++, exploiting template metaprogramming techniques. Metaclass objects are present at runtime and can be inspected to access information about objects, in particular about their fields. Metaobjects describing fields can be extended, through a mechanism similar to custom attributes in C#. The mechanism is self-reflective, allowing for metaclass objects to be described in turn. This allows storing and retrieving metaclasses from external storage and allows programs to understand and manipulate objects built by other programs. We present two case studies of the technique: building configuration objects and creating object-oriented interfaces to relational database tables.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Attardi, G., Cisternino, A.: Reflection support by means of template metaprogramming. Proceedings of Third International Conference on Generative and Component-Based Software Engineering, Lecture Notes in Computer Science, Vol. 2186. Springer-Verlag, Berlin (2001) 178–187
Attardi, G.: Metaobject Programming in CLOS. In Object-Oriented Programming-The CLOS Perspective, A. Paepke (ed.), Cambridge, MA (1993)
W3C: Web Services Description Language. http://www.w3.org/TR/wsdl.
Gabriel, R.G., Bobrow, D.G., White, J.L.: CLOS in ContextThe Shape of the Design Space. In Object Oriented Programming-The CLOS perspective. The MIT Press, Cambridge, MA (1993) 29–61
Czarnecki, K., Eisenacker, U.W.: Generative Programming-Methods, Tools, and Applications. Addison Wesley, Reading, MA (2000)
Stroustrup, B.: The Design and Evolution of C++. Addison Wesley, Reading, MA (1994)
Sleepycat Software, The Berkeley Database, http://www.sleepycat.com.
MySQL, MySQL, http://www.mysql.com.
Microsoft, ActiveX Data Objects, http://msdn.microsoft.com/library/psdk/dasdk/adot9elu.htm.
K.A. Knizhnik, The GigaBASE Object-Relational database system, http://www.ispras.ru/~knizhnik.
Sun Microsystems, Java Database Connectivity, http://java.sun.com/.
Petter Urkedal, Tools for Template Metaprogramming, http://matfys.lth.se/~petter/src/more/metad .
R. Sunderraman, Oracle8â„¢ Programming: a primer, Addison-Wesley, MA, (2000)
Plauger, P. J., Stepanov, A., Lee, M., Musser, D.: The Standard Template Library. Prentice-Hall (2000)
Malenfant, J., Jaques, M., Demers, F.N.: A tutorial on behavioral reflection and its implementation. Proceedings of the Reflection 96 Conference, Kiczales, G. (ed.), San Francisco, California, USA, April (1996) 1–20
Chuang, T.R, Kuo, Y. S., Wang, C.M.: Non-Intrusive Object Introspection in C++: Architecture and Application. Proceedings of the 20th Int. Conference on Software Engineering, IEEE Computer Society Press (1998) 312–321
Madany, P.W., Islam, N., Kougiouris, P., Campbell, R.H.: Reification and reflection in C++: An operating systems perspective. Technical Report UIUCDCS-R-92-1736, Dept. of Computer Science, University of Illinois at Urbana-Champaign, March (1992)
Ishikawa, Y., Hori, A., Sato, M., Matsuda, M., Nolte, J., Tezuka, H., Konaka, H., Maeda, M., Kubota, K.: Design and Implementation of metalevel architecture in C++-MPC++ approach. Proceedings of the Reflection 96 Conference, Kiczales, G. (ed.), San Francisco, California, USA, April (1996) 153–166
Gowing, B., Cahill, V.: Meta-Object Protocols for C++: The Iguana Approach. Proc. Reflection’ 96, San Francisco, California (1996) 137–152
Chiba, S.: A metaobject protocol for C++. Conference Proceedings of Object-Oriented Programming Systems, Languages and Applications, ACM Press (1995) 285–299
Raymond, E.S.: Why Python? Linux Journal, May (2001) http://www.linuxjournal.com/article.php?sid=3882.
Ellis, M. A., Stroustrup, B.: The Annotated C++ Reference Manual. Addison-Wesley, MA (1990)
Jones, N.D., Gomard, C.K., Sestoft. P.: Partial Evaluation and Automatic Program Generation. Prentice Hall International, International Series in Computer Science, June (1993)
Maor, R., Brand, M.: XParam-General-Purpose Object Serialization Framework for C++. http://xparam.sourceforge.net .
Grosso, W.: Java RMI Serialization. O’Reilly & Associates (2001) http://www.onjava.com/pub/a/onjava/excerpt/JavaRMI10 .
Haible, B.: VACALL Manual. http://www.mit.edu/afs/sipb/project/clisp/new/clisp-1999-01-08/ffcall/avcall/avcall.html .
Archer, T.: Inside C#. Microsoft Press, Redmond, WA (2001)
Mätzel, K.U., Bischofberger, W.: The Any Framework A Pragmatic Approach to Flexibility. Second Usenix Conference on Object-Oriented Technology and Systems, Toronto, June (1996)
Knizhnik, K.A.: The GigaBASE Object-Relational database system. http://www.ispras.ru/~knizhnik
Sleepycat Software, The Berkeley Database, http://www.sleepycat.com.
MySQL, MySQL, http://www.mysql.com.
Microsoft, ActiveX Data Objects, http://msdn.microsoft.com/library/psdk/dasdk/adot9elu.htm.
Sun Microsystems, Java Database Connectivity, http://java.sun.com.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Attardi, G., Cisternino, A. (2002). Self Reflection for Adaptive Programming. In: Batory, D., Consel, C., Taha, W. (eds) Generative Programming and Component Engineering. GPCE 2002. Lecture Notes in Computer Science, vol 2487. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45821-2_3
Download citation
DOI: https://doi.org/10.1007/3-540-45821-2_3
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-44284-4
Online ISBN: 978-3-540-45821-0
eBook Packages: Springer Book Archive