Re: Packet class \todo - ‘developers/peter/calitko-dev,225′

Hi Peter,

thanks for the links! Now I see that there was a misunderstanding from my side over my “understanding” of reference objects. So, I’ve read some of the posts in the articles and I must admit that it seems to me much more complicated then I actually thought for the first time. I think I’ll need to study it more deeply.

I was actually referring to the quote from http://c2.com/cgi/wiki?ValueObjectHypotheses:

“- In C++ I use pointers for my ReferenceObjects, whereas I use values for my ValueObjects. So equality just works out the way I want. I get == by state for values and == by identity for reference objects. I don’t need to define == for reference objects. Copying also just works out the way I want. I get copying of state for values and copying of pointers for reference objects. I don’t use inheritance for value objects, so the dreaded copy by slicing “problem” doesn’t ever hit me. I don’t allow copying of reference objects (I remove access to the copy constructor and assignment operator.) — AmitPatel”

And that does make sense in my opinion. The point of not using inheritance for value objects is an interesting one but I don’t quite see how we could achieve this with out packets. The class Packet wrapping around PacketBase objects seems like an interesting solution so the question is should we treat PacketBase derived objects as (kind of) Value Object or as Reference Objects?

Yes, after I’ve made few things clear about reference objects I’d agree that it really makes sense. If I consider what I’ve read from these articles then it appears to me that we should treat packets as value objects (I’m thinking about packets in general). From my point of view they are just a “bunch of data” stored in one object. Changing packets during theire xistence doesn’t make much sense (so they would be immutable) and they can be treated as strings (just an example).

As I said at the beginning, I haven’t fully understand these concepts yet. So please, take the former opinion with a grain of salt - I see that there are many things I have to learn ;). But I know that we’ll eventually sort it out ;).

Regards, Petr

Would you like to post a relpy?


This post is a reply to:
Re: Packet class \todo - ‘developers/peter/calitko-dev,225′
Hi Petr, Thanks for your comments! - to ensure that a user will pass some object to the function and not just a NULL pointer (public interface) - to ensure that a user (more...)

Follow-ups:
Re: Packet class \todo - ‘developers/peter/calitko-dev,225′
Hi Petr, thanks for the links! Now I see that there was a misunderstanding from my side over my “understanding” of reference objects. So, I’ve read some of the posts in (more...)