Not all coding abstractions have a real equivalent. For example, it will be difficult for you to find a real analogy for paged memory. So instead of making a real analogy, I’ll just give you a real example of why you need them.
First of all, the actual definition of the verb for delegation (from the Oxford Dictionary):
trust (task or responsibility) another person, usually one who is less senior than himself: he delegates routine tasks | The power delegated to him should never be abused.
Delegates are objects to which responsibility has been delegated, because it makes no sense in terms of design for one class to do all the work.
Say you have a UI table class. You want to make it reusable to display many types of data: this means, for the most part, that you cannot bind it to your model. For example, if you specially set up a user interface table to display album objects (with a name, artist, etc.), then you cannot reuse it to display, say, File objects (with owner, document type, etc. ): you will need to edit the class to match. This will duplicate a lot of code, so you should find another mechanism. This leads to a problem: how can it display any data if it is not allowed to bind data classes?
The solution is to share responsibility for receiving data and displaying data. Since your table needs data to display it, but it cannot detect it itself, because it does not know anything about your model, it must delegate this responsibility to another class created specifically for this purpose, and have its information in general form, which the table will know how to use.
This means that you will have another class that will respond to a certain number of methods that will use the table object as if it were part of its main behavior (for example, a method for the delegate to get the name of the columns, another to get the specific strings, etc.). As a specific example, you can find the NSTableViewDelegate link: these are NSTableView methods can call a delegate to get information about various things or individual behavior. (The tableView: argument tableView: in principle, each method identifies the table view that invokes the method. It is often ignored because there are many classes of table view delegates to support a single table view.)
Delegates are objects that simply “know better.” Your user interface table does not have a clue how to get what it needs, but it does have a delegate who “knows better”, so it can request data from it.
You can also use this template to handle events: for example, when you click on a view, he does not know what to do, but perhaps he has a delegate who knows what to do.
In other words, delegates are one of several ways to extend the behavior of a class without modifying or subclassing it.