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.

Self Reflection for Adaptive Programming

ATTARDI, GIUSEPPE;CISTERNINO, ANTONIO
2002-01-01

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.
2002
3540442847
File in questo prodotto:
Non ci sono file associati a questo prodotto.

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/11568/71939
 Attenzione

Attenzione! I dati visualizzati non sono stati sottoposti a validazione da parte dell'ateneo

Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 1
  • ???jsp.display-item.citation.isi??? 0
social impact