A
Alex
Hi,
I am writing a chat server application and am currently stuck at a
general question of OO design.
I am wondering what would be the best way to manage the existing
channels. Each channel is represented by a seperate instance of a class
and I need to have a central repository to access them.
Now I could simply add a static hashtable to the channel class and have
the channels self managing them by adding each new instance from its
construnctor. The second way could be a central manager class which does
all the handling.
The latter solution looks a bit cleaner to me because the particular
jobs are separated, however at the same time it also seems a little bit
like a waste of resources, because it introduces a class (with
additional memory and CPU allocations) which basically just "extends" a
hashtable and can also be solved via the former solution.
I'd really appreciate any comments about this. Thanks
Alex
I am writing a chat server application and am currently stuck at a
general question of OO design.
I am wondering what would be the best way to manage the existing
channels. Each channel is represented by a seperate instance of a class
and I need to have a central repository to access them.
Now I could simply add a static hashtable to the channel class and have
the channels self managing them by adding each new instance from its
construnctor. The second way could be a central manager class which does
all the handling.
The latter solution looks a bit cleaner to me because the particular
jobs are separated, however at the same time it also seems a little bit
like a waste of resources, because it introduces a class (with
additional memory and CPU allocations) which basically just "extends" a
hashtable and can also be solved via the former solution.
I'd really appreciate any comments about this. Thanks
Alex