Computational Reflection

Why Trust Techopedia

What Does Computational Reflection Mean?

Computational reflection is the ability of a program to modify itself while running. The source code of the program is treated as data by itself os that appropriate modifications can be made by the program during runtime. Programs capable of modifying their own source code, or the source code of some other program, during runtime are called metaprograms. Computational reflection allows the programmer to save time implementing some parts of the program, which are generated by the program itself at runtime.

Advertisements

Techopedia Explains Computational Reflection

Metaprogramming can be achieved by three methods:

  1. The executing program exposes its own source code to the runtime environment and appropriate changes are introduced in the program. The exposure can be through a direct link to the interpreter in the program or through well-defined external interfaces.
  2. String expressions within the source code trigger certain metaprogramming procedures during runtime.
  3. A general programming transform system applies commands specific to the programming language of the source code on invocation.

One advantage of computationally reflective systems is that the program is adaptable at run time. Any program statement can be changed at run time by means of the reflect statement. This system is far superior to method overriding, where the behavior is determined by the method being called at run time.

Advertisements

Related Terms

Margaret Rouse
Technology expert
Margaret Rouse
Technology expert

Margaret is an award-winning writer and educator known for her ability to explain complex technical topics to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles in the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret’s idea of ​​a fun day is to help IT and business professionals to learn to speak each other’s highly specialized languages.