1

Deciding whether an object should request data (by calling a function) or receive data (by having a function called from another object) is probably dependent on the exact situation. So how do I decide how to handle this?

If a specific example could help:

I'm currently designing an app using the Kinect camera. I want to split the signal and pass it to multiple objects that process the data (there is some bookkeeping involved, because I need to dispose a frame before requesting the next one). What should I do? Get data from the Kinect and store it, so other objects can request it? Or should I pass the data to the objects that need it?

A drawing with generic names, arrows indicate how data should flow:

Kinect ---> KinectManager |---> DataProcessor
                          |---> DataHandler
                          |---> DataSomething

My suspicion is the first case, because then I could have different objects request data, without KinectManager having to know about the objects. Though in the second case I could design an Interface with, for example, an Update() method that receives Kinect Data.

1 Answers1

1

Kinect manager can store Kinect data and emit an event or signal. Every other object listening to this event or signal can act upon it and retrieve these data.
This can be particularly useful if the other objects will not duplicate Kinect data to some other storage.