by
JADE Kid - Ray Hidayat >> Thu, 13 Apr 2000 4:09:04 GMT
Well, first thing: Why is Player the parent and not channel?
Well I want the player to keep existing, and keep all his scores and things. But the channel is only a chatroom and you can have lots of those, so that the players can have private chatting sessions and clans and all that. But when there aren't any players in a channel, I want it deleted. I could have made this transient, right? I have actually already done that, but I was looking for an easier way.
If it was the channel that was the parent, it would never get deleted, even when no one is chatting and it is not in use. That would be a bit stupid.
Second thing: The notification system:
I feel that this is the first system which I have taken advantage with the object oriented things. Usually I will just use classes to put data in, just like a boring old access table. But objects (AJ told me at the training course) have 3 things. Identity, Behavior and State. Now I give every class each of those things, and because the methods are lying everywhere, I am using heaps of notifications.
I don't need to include a player leave notification, because it is set to a mapping method of the player's my channel to know if it should delete the channel or not. That is pretty simple. The chat window has about 7 notifications on it. When you are casting a kick vote it will have two more, and you can kick more than one person at a time in a channel.
Is 7 notifications a lot, or is it a reasonable size? Does anyone have huge amounts of notifications?
Third section: A few questions...
Gosh, I never knew that there was a method called .isEmpty! That would be useful because I am currently using .size = 0!
Do you think that to have a parent collection option to delete the child when all parents disappear is a good idea? Because I am using the same principle in my Game class. Just substitute channel for 'Game'.
I can't actually see many examples of this happening; this is very unusual.
--
Ray Hidayat
JADE Kid - 2000
www.jadekids.com