Object Ref vs Delegate

I

Inictus

Greetings all,

Obviously I have a question. I have a set of classes in an N-tiered
environment (based on an older version of Rockford Lhotka's CSLA
architecture) and have a situation where I need to notify a parent
object that something has happened in a child object, similar to an
event.

After the parent has deserialized back to the client, I have 2 choices
(unless there is something completely different that Im not
considering), send the children objects a reference to the parent
object, or send a delegate such that these children can invoke it when
need be.

The question is - which would be better in this situation? In terms of
memory footprint, my gut tells me the footprint would be about the
same for either. Is there any other reason to choose one over the
other?

Thanks
 
M

Michael C

Inictus said:
Greetings all,

Obviously I have a question.

Who would have thought? :)
I have a set of classes in an N-tiered
environment (based on an older version of Rockford Lhotka's CSLA
architecture) and have a situation where I need to notify a parent
object that something has happened in a child object, similar to an
event.

After the parent has deserialized back to the client, I have 2 choices
(unless there is something completely different that Im not
considering), send the children objects a reference to the parent
object, or send a delegate such that these children can invoke it when
need be.

The question is - which would be better in this situation? In terms of
memory footprint, my gut tells me the footprint would be about the
same for either. Is there any other reason to choose one over the
other?

The reference to the parent has other uses, if the child needs to find other
properties of it's parent then it can.
 
M

Mr. Arnold

Inictus said:
Greetings all,

Obviously I have a question. I have a set of classes in an N-tiered
environment (based on an older version of Rockford Lhotka's CSLA
architecture) and have a situation where I need to notify a parent
object that something has happened in a child object, similar to an
event.

After the parent has deserialized back to the client, I have 2 choices
(unless there is something completely different that Im not
considering), send the children objects a reference to the parent
object, or send a delegate such that these children can invoke it when
need be.

The question is - which would be better in this situation? In terms of
memory footprint, my gut tells me the footprint would be about the
same for either. Is there any other reason to choose one over the
other?

I couldn't tell you one way or the other. I do know that you can email
Rockford, which is at his Web site, he will reply to you. There is also a
CSLA forum.
 
I

Inictus

Thanks for the responses.

As for Michael's point, there is value in having a parent reference
for other things, but I don't think I need it beyond notification that
something has happend.

I've looked in the CSLA forum, and since im using a really old (yet
heavily modified) version of the framework (the thought of upgrading
to the latest scares the heck out of me), its hard to find posts
regarding older versions.

I do have a question should I go the delegate route:

If I statically declare delegates in the classes, do I have to worry
about disposing them come garbage collection time? Or will I get a
memory leak if I do nothing.
 
M

Mr. Arnold

Inictus said:
Thanks for the responses.

As for Michael's point, there is value in having a parent reference
for other things, but I don't think I need it beyond notification that
something has happend.

I've looked in the CSLA forum, and since im using a really old (yet
heavily modified) version of the framework (the thought of upgrading
to the latest scares the heck out of me), its hard to find posts
regarding older versions.

I do have a question should I go the delegate route:

If I statically declare delegates in the classes, do I have to worry
about disposing them come garbage collection time? Or will I get a
memory leak if I do nothing.

I can't tell you myself. You're going to have to play. I suggest you make
contact with Rocky. I have emailed him a couple for times. He does get back
to you quickly.
 

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