Design question

For some special kind of data transmission, i created a Packet class and a Packet-Generator class which creates a packet.

The packet class itselff only contains the whole data in one array and is there for simplying the sending and receiving process...

The receiver needs to unpack/interpret the individual parts of the packet. And this is where i am unsure about...

I already have another version of my packet class which is able to give you the seperate parts.
But i can alos think of some kind of interpreter for the packet which does the interpreting...


How would you do this, or what do you think would fit better/makes more sense/less work...

Thanks in advance,
Inc
If the Packet is used for a very specific kind of data, then it would be Ok to allow it to do the marshalling/unmarshalling.

But if this class is a general-purpose container then it is better to write separate classes for interpreting the various types of data.
I'd say it depends.

If the data is rather fixed and not overly complicated the packet may have very well functions to extract the needed data.

if the data is rather complicated and appears different in different situations it might be better to have another class to do that job
Topic archived. No new replies allowed.