What is the difference of delegator and dispatcher?
I am not quite sure of either concept.
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this communityDelegation is assigning a responsibility to some other object. For example, if I am invited to a meeting and I assign it to a junior colleague, I am delegating. The point to note here is that it is the junior colleague who will attend the meeting and there is no intermediary between him and me.
Dispatching is not delegating. Dispatcher is more like an intermediary who relays a request to someone else. For example, to attend the meeting my astute junior colleague may ask a cab company for a pick up and the guy receiving the request may dispatch it to a nearby cab driver. The point here is that dispatcher is only passing along the request.
Dispatcher
Delegate
Consider this: delegate.Invoke/BeginInvoke
and this.dispatcher.Invoke/BeginInvoke
.
BeginInvoke
means: "Do this and return before it completes. I either don't care about the return value or you can call me back at this address at some point in the future." Invoke
means: "Do this and I'll sit here and wait for it to complete."In short: The BeginInvoke is an asynchronous call. It executes a delegate asynchronously on the thread the Dispatcher is associated with.