Terminology - Reflection

D

DesCF

What exactly is Reflection ? I've looked at the definition in Help but I
don't find it very helpful! I just stare at it blankly and can't quite
seem to grasp its meaning conceptually. Reflection implies something
reflected. Does anyone have a good cogent description of its meaning ?





Des
 
L

Lloyd Sheen

DesCF said:
What exactly is Reflection ? I've looked at the definition in Help but I
don't find it very helpful! I just stare at it blankly and can't quite
seem to grasp its meaning conceptually. Reflection implies something
reflected. Does anyone have a good cogent description of its meaning ?

You are on the right track. Reflection is a set of classes that allow you
to examine the details of those classes. You can obtain all the information
about properties, methods etc. There are also methods which allow you to
create an object using reflection and call the methods of the object without
having compiled code to access the object (actually there is compiled code
but that code is the reflection code not the object code).

It can be used to dynamically load assemblies for things like application
plug-ins.

To illustrate what reflection can do, I created a navigator control which
shows the contents of a SQL Server. It uses the classes from SMO and
reflection. There is only one entry which is required for SMO to work and
that is a connection. After that I use reflection to enumerate the
properties such that I can determine collections etc.

Hope this helps
Lloyd Sheen
 
T

tommaso.gastaldi

What exactly is Reflection ? I've looked at the definition in Help but I
don't find it very helpful! I just stare at it blankly and can't quite
seem to grasp its meaning conceptually. Reflection implies something
reflected. Does anyone have a good cogent description of its meaning ?

Des

I think this can be understood well, just like all the programming
concepts, only by practice,
especially on some meaningful project.

I could tell you I could not live without reflection ! :)))

Anyway, to start with here is an excercise which will make you
understand it better.


Homework :)
===========

Take o write a program where you have a serializable class with a
some
<non serialized> fields and some "reference" type fields (not only
value type fields).

Create a dialog form to allow an user editing the field and the
properties of an instance of this class
with a "CANCEL" feature. In other words, if the user "cancels" the
dialog, the object must be
"restored" completely and perfectly to its original state [careful
with non serialized reference values].

Post here your solution for discussion and grade :))

Tommaso
 
A

Armin Zingler

DesCF said:
What exactly is Reflection ? I've looked at the definition in Help
but I don't find it very helpful! I just stare at it blankly and
can't quite seem to grasp its meaning conceptually. Reflection
implies something reflected. Does anyone have a good cogent
description of its meaning ?


Reflection means that the code can reflect about itself. Code can examine
and get information about itself. This is possible by additionally having
meta data in the assemblies that describes the code
(classes/types/methods/parameters...).


Armin
 
D

DesCF

This is the conceptually most intesting reply. It suggests that the
correct understanding of the term Reflection is not 'reflection in a
mirror' but reflection upon something (ones life for example) ?
 
A

Armin Zingler

DesCF said:
This is the conceptually most intesting reply. It suggests that the
correct understanding of the term Reflection is not 'reflection in a
mirror' but reflection upon something (ones life for example) ?


Hmmm...
Isn't a mirror a mean to reflect yourself reflecting your own life. :)


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top