Say we have a user interface with Forms, Buttons and such. Each item has some properties (such as Visible
, Enabled
, etc.). Who should check on these properties and decide whenever to render the item or not?
Parent item:
for I := 0 to Count - 1 do if Child[I].Visible then Child[I].Paint
Or each item itself:
if not Self.Visible then Exit else <<PaintSelf>>
Here, Visibility is just an example - same choice arises with many other properties (GUI, application logic, etc.) when some parent needs to do something with its childs.
The answer is obvious in event-driven model, where event issuer could not possibly know about handlers properties. But what about non event-driven model, where there's a Parent and a list of Childs it manages?
I'm looking for a general guidelines/solution to this case.