Why is reflection called reflection instead of introspection?
What is the origin of the term reflection? It seems more like introspection. Why isn't it called that?
Introspection: A looking inward; specifically, the act or process of self-examination.
Reflection:
- the act of reflecting or the state of being reflected.
- an image; representation; counterpart
- a fixing of the thoughts on something; careful consideration
- a thought occurring in consideration or meditation.
There is an interesting answer on the french wikipedia article for Reflection (here)
Reflection can be decomposed in two parts:
- introspection: a program can examine itself.
- intercession: a program can modify its state/meaning.
So reflection is a 'stronger' property than introspection. That's why you say type introspection for the ability to know types at runtime (and changing them is another action: conversion/casting).
EDIT: actually I just realized the first answer was saying exactly that ^^. Time to unplug myself...
Reflection comes from the idea of "self-examination, self-modification, and self-replication", reflecting on one's self for the purpose of change. In programming you use reflection to examine the structure of the program itself in the context of using it instead of just examining it. What you get back is a representation of the program that you can use to modify it, rather than the data on which it operates.
More information can be found at the wikipedia article..