docs: update delegation

This commit is contained in:
Ilkka Seppälä
2024-06-02 22:22:32 +03:00
parent 1c478a52a9
commit c5de9f637e
+4
View File
@@ -23,6 +23,10 @@ Real-world example
> In a restaurant, the head chef delegates tasks to sous-chefs: one manages grilling, another handles salads, and a third is in charge of desserts. Each sous-chef specializes in their area, allowing the head chef to focus on overall kitchen management. This mirrors the Delegation design pattern, where a main object delegates specific tasks to helper objects, each expert in their domain.
In plain words
> Delegation is a design pattern where an object passes on a task to a helper object.
Wikipedia says
> In object-oriented programming, delegation refers to evaluating a member (property or method) of one object (the receiver) in the context of another original object (the sender). Delegation can be done explicitly, by passing the sending object to the receiving object, which can be done in any object-oriented language; or implicitly, by the member lookup rules of the language, which requires language support for the feature.