Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Guess I will answer my own question. Hopefully, I get that sweet, sweet bounty.</p> <p>Think about this from the perspective of sending your consultant employee out to a customer. He knows how to do his job, but he doesn't know what to do when he's finished. You want him to be flexible about what he does next.</p> <p>Sometimes his boss sends him out. Sometimes the CEO does (he might not know where to send him after). Sometimes the client calls him in with an emergency (he definitely doesn't know where to send him after). Sometimes he just grabs a new task from the whiteboard.</p> <p>He could do one of several things:</p> <ul> <li><p>you could tell him to call the head office when he's done, and head office will figure it out for him. he doesn't need to know about any other people, just the head office phone number.</p></li> <li><p>you could tell him what to do when he's finished, before he leaves. if he's gone for a while, his next task might have changed in the meantime. </p></li> <li><p>you could tell him to post to facebook when he's done, head office will be looking for it, and will tell him what to do. head office would need to be watching for a lot of facebook posts from all their consultants.</p></li> <li><p>you could tell his supervisor to to answer his call when he's finished, but then his supervisor needs to be in the office, and maybe he'll switch supervisors. </p></li> </ul> <p>Personally, I would pass in a callback function. If that callback is null, the callee should ask the application what to do. That gives you some flexibility, while also allowing for a parent process to manage things, and not relying on one big function in the app. </p> <p>This would be equivalent to giving the consultant the number of the next customer to call, when he's done. If he doesn't get a number, he calls the head office. </p> <p>You could use an event as well, and it's not a bad idea. The only issue might be if multiple objects are listening for this event, something untoward might happen.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload