On Wikipedia, I found this code in a long article concerning a type of programming called reflective programming:
All I grasped is that apparently reflective programming is another paradigm. How does the added complexity make the second tidbit of code "reflective" instead of just a more tedious way of invoking a method?
Code:
// Without reflection
Foo foo = new Foo();
foo.PrintHello();
// With reflection
Object foo = Activator.CreateInstance("complete.classpath.and.Foo");
MethodInfo method = foo.GetType().GetMethod("PrintHello");
method.Invoke(foo, null);