What is reflection, and why is it useful?
I\'m particularly interested in Java, but I assume the principles are the same in any language.
Reflection is a key mechanism to allow an application or framework to work with code that might not have even been written yet!
Take for example your typical web.xml file. This will contain a list of servlet elements, which contain nested servlet-class elements. The servlet container will process the web.xml file, and create new a new instance of each servlet class through reflection.
Another example would be the Java API for XML Parsing (JAXP). Where an XML parser provider is 'plugged-in' via well-known system properties, which are used to construct new instances through reflection.
And finally, the most comprehensive example is Spring which uses reflection to create its beans, and for its heavy use of proxies