Hacker News new | past | comments | ask | show | jobs | submit login

"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.




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++).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: