Low coupling and tight cohesion
Posted
by
hidayat
on Game Development
See other posts from Game Development
or by hidayat
Published on 2011-02-22T11:25:41Z
Indexed on
2011/02/22
15:33 UTC
Read the original article
Hit count: 373
Of course it depends on the situation. But when a lower lever object or system communicate with an higher level system, should callbacks or events be preferred to keeping a pointer to higher level object?
For example, we have a world class
that has a member variable vector<monster> monsters
. When the monster class is going to communicate with the world class, should I prefer using a callback function then or should I have a pointer to the world class
inside the monster class
?
© Game Development or respective owner