I find myself needing to have a View expose its Model and Controller references. Is this the smell of bad design? Or is this considered "safe" practice?
For example: I have a list (composed of a ListView
, ListController
, and ListModel
) and many list items (composed of a ItemView
, ItemController
, and ItemModel
).
When I create the ItemModel
, ItemView
, and ItemController
for each list item, I pass the ItemView
instance off to the ListView
. But, at some later point, my ListController
needs a reference to the corresponding ItemController
instance.
So, would it be more proper to pass both the ItemView
and the ItemController
in to ListView::addItem()
, or just pass in ItemView
and expose an instance method such as ItemView::getController()
?
Or doesn't it matter? Is each approach equally viable? If followed to their logical conclusion, does either tactic result in an anti-pattern?