Re:Escape from Callback Hell: Callbacks are the modern goto
by pkaler on Friday November 02, 2012 @03:04PM
(#4734224)
"I don't know when or where I am being called from, or what the state is of the rest of the program at this time."
Gotcha.
A parent object should own a child object. The parent can directly call a method on a child. The child object shouldn't really know about the parent. Hence, it uses a callback/delegate/protocol.
Callbacks are a mess if there isn't a clear parent to child relationship.
Re:Escape from Callback Hell: Callbacks are the modern goto
by jblow on Friday November 02, 2012 @05:56PM
(#4734960)
I don't believe that parent/child relationships are a good way to structure programs. I use them sometimes, but very rarely. (Current codebase is 180k lines of C++).
Gotcha.
A parent object should own a child object. The parent can directly call a method on a child. The child object shouldn't really know about the parent. Hence, it uses a callback/delegate/protocol.
Callbacks are a mess if there isn't a clear parent to child relationship.