Are there OO design guidelines to consider when deciding which of the two interacting and related objects should be included as a component in the other (or referenced from it)?
For example, I try to realize the search algorithm of the shortest path A * with classes and objects. In addition to a given chart, I plan to have a
Data flow object and a
Controller object. I plan the
Data flow object to be responsible for maintaining the state of knowledge on the shortest paths found so far and for the propagation of improvements from the nodes to their neighbors. I plan the
Controller object to be responsible for the strategy of graphs exploration and make it configurable with several strategies (A *, Dijkstra, greedy, etc.).
After reflection, I decided that the
Data flow object will receive and store the
Controller object during initialization, but I can not explain clearly why it would be better than the opposite.