71:
in the delegate refer to the original (sending) object, not the delegate (receiving object). In the delegate pattern, this is instead accomplished by explicitly passing the original object to the delegate, as an argument to a method. "Delegation" is often used loosely to refer to the distinct concept
83:
This article uses "sending object/receiving object" for the two objects, rather than "receiving object/delegate", emphasizing which objects send and receive the delegation call, not the original call.
106:. This is analogous to subclasses deferring requests to parent classes. But with inheritance, an inherited operation can always refer to the receiving object through the
114:
in
Smalltalk. To achieve the same effect with delegation, the receiver passes itself to the delegate to let the delegated operation refer to the receiver.
466:
592:
43:
441:
436:
132:
73:
76:, where the sending object simply uses the corresponding member on the receiving object, evaluated in the context of the
1117:
1225:
1142:
512:
1090:
915:
714:
808:
938:
898:
585:
275:
124:
908:
903:
128:
1183:
1021:
446:
28:
798:
1006:
1001:
828:
50:
1046:
1011:
978:
628:
578:
948:
920:
858:
843:
823:
759:
601:
456:
67:
925:
853:
803:
638:
451:
1204:
1107:
953:
933:
878:
504:
497:
386:// The ClosedShape implementation of Window delegates to that of the Rectangle that is bounds
1016:
973:
968:
958:
868:
102:
objects are involved in handling a request: a receiving object delegates operations to its
20:
8:
1056:
1041:
1036:
893:
778:
724:
528:
1178:
1157:
963:
813:
706:
658:
620:
35:
848:
691:
681:
676:
648:
643:
508:
1147:
888:
833:
754:
744:
734:
729:
98:
is a way to make composition as powerful for reuse as inheritance . In delegation,
1137:
1083:
1061:
838:
793:
764:
739:
719:
666:
633:
609:
274:
Some languages have special support for delegation built in. For example, in the
65:. With language-level support for delegation, this is done implicitly by having
1122:
983:
686:
671:
461:
31:
1219:
943:
788:
749:
696:
58:
1199:
1162:
1051:
1026:
818:
570:
565:
555:
1152:
1127:
1112:
1031:
863:
39:
1132:
495:
Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John (1995).
499:
Design patterns : elements of reusable object-oriented software
91:
In the
Introduction to Gamma et al. 1994, delegation is defined as:
561:
503:(14. print. ed.). Reading, Mass.: Addison-Wesley. p.
494:
53:
handles a request by delegating to a second object (the
139:
call to its internal
Rectangle object (its delegate).
496:
282:keyword delegates to another object's interface:
1217:
586:
16:Design pattern in object-oriented programming
600:
467:Schizophrenia (object-oriented programming)
593:
579:
529:"Delegation - Kotlin Programming Language"
442:Forwarding (object-oriented programming)
437:Delegation (object-oriented programming)
1218:
574:
269:
13:
14:
1237:
549:
80:object, not the original object.
123:In the example below (using the
1091:Enterprise Integration Patterns
521:
488:
479:
1:
472:
86:
7:
1184:Portland Pattern Repository
447:Aspect-oriented programming
430:
127:programming language), the
110:member variable in C++ and
10:
1242:
118:
1192:
1171:
1100:
1075:
992:
877:
777:
705:
657:
619:
608:
278:programming language the
63:with the original context
1226:Software design patterns
809:Event-based asynchronous
602:Software design patterns
284:
141:
715:Chain of responsibility
854:Scheduled-task pattern
804:Double-checked locking
452:Delegation (computing)
116:
57:). The delegate is a
1205:Architectural pattern
1108:Christopher Alexander
93:
1017:Dependency injection
974:Inversion of control
969:Data transfer object
869:Thread-local storage
38:to achieve the same
21:software engineering
1022:Intercepting filter
1179:The Hillside Group
964:Data access object
814:Guarded suspension
799:Binding properties
556:What Is Delegation
49:In delegation, an
36:object composition
25:delegation pattern
1213:
1212:
1007:Business delegate
939:Publish–subscribe
773:
772:
485:Gamma et al. 1994
1233:
1012:Composite entity
889:Front controller
629:Abstract factory
617:
616:
595:
588:
581:
572:
571:
543:
542:
540:
539:
525:
519:
518:
502:
492:
486:
483:
426:
423:
420:
417:
414:
411:
408:
405:
402:
399:
396:
393:
390:
387:
384:
381:
378:
375:
372:
369:
366:
363:
360:
357:
354:
351:
348:
345:
342:
339:
336:
333:
330:
327:
324:
321:
318:
315:
312:
309:
306:
303:
300:
297:
294:
291:
288:
281:
270:Language support
265:
262:
259:
256:
253:
250:
247:
244:
241:
238:
235:
232:
229:
226:
223:
220:
217:
214:
211:
208:
205:
202:
199:
196:
193:
190:
187:
184:
181:
178:
175:
172:
169:
166:
163:
160:
157:
154:
151:
148:
145:
138:
113:
109:
70:
1241:
1240:
1236:
1235:
1234:
1232:
1231:
1230:
1216:
1215:
1214:
1209:
1188:
1167:
1158:Douglas Schmidt
1138:Ward Cunningham
1096:
1084:Design Patterns
1071:
1062:Method chaining
994:
988:
949:Service locator
880:
873:
844:Read–write lock
780:
769:
760:Template method
701:
653:
611:
604:
599:
552:
547:
546:
537:
535:
527:
526:
522:
515:
493:
489:
484:
480:
475:
433:
428:
427:
424:
421:
418:
415:
412:
409:
406:
403:
400:
397:
394:
391:
388:
385:
382:
379:
376:
373:
370:
367:
364:
361:
358:
355:
352:
349:
346:
343:
340:
337:
334:
331:
328:
325:
322:
319:
316:
313:
310:
307:
304:
301:
298:
295:
292:
289:
286:
279:
272:
267:
266:
263:
260:
257:
254:
251:
248:
245:
242:
239:
236:
233:
230:
227:
224:
221:
218:
215:
212:
209:
206:
203:
200:
197:
194:
191:
188:
185:
182:
179:
176:
173:
170:
167:
164:
161:
158:
155:
152:
149:
146:
143:
136:
121:
111:
107:
89:
66:
29:object-oriented
17:
12:
11:
5:
1239:
1229:
1228:
1211:
1210:
1208:
1207:
1202:
1196:
1194:
1190:
1189:
1187:
1186:
1181:
1175:
1173:
1169:
1168:
1166:
1165:
1160:
1155:
1150:
1145:
1140:
1135:
1130:
1125:
1123:John Vlissides
1120:
1115:
1110:
1104:
1102:
1098:
1097:
1095:
1094:
1087:
1079:
1077:
1073:
1072:
1070:
1069:
1064:
1059:
1054:
1049:
1044:
1039:
1034:
1029:
1024:
1019:
1014:
1009:
1004:
998:
996:
990:
989:
987:
986:
981:
976:
971:
966:
961:
956:
951:
946:
941:
936:
931:
923:
918:
913:
912:
911:
906:
896:
891:
885:
883:
875:
874:
872:
871:
866:
861:
856:
851:
846:
841:
836:
831:
826:
821:
816:
811:
806:
801:
796:
791:
785:
783:
775:
774:
771:
770:
768:
767:
762:
757:
752:
747:
742:
737:
732:
727:
722:
717:
711:
709:
703:
702:
700:
699:
694:
689:
684:
679:
674:
669:
663:
661:
655:
654:
652:
651:
646:
641:
639:Factory method
636:
631:
625:
623:
614:
606:
605:
598:
597:
590:
583:
575:
569:
568:
559:
551:
550:External links
548:
545:
544:
520:
513:
487:
477:
476:
474:
471:
470:
469:
464:
462:Facade pattern
459:
457:Design pattern
454:
449:
444:
439:
432:
429:
285:
271:
268:
142:
120:
117:
88:
85:
32:design pattern
15:
9:
6:
4:
3:
2:
1238:
1227:
1224:
1223:
1221:
1206:
1203:
1201:
1198:
1197:
1195:
1191:
1185:
1182:
1180:
1177:
1176:
1174:
1170:
1164:
1161:
1159:
1156:
1154:
1151:
1149:
1148:Robert Martin
1146:
1144:
1143:Martin Fowler
1141:
1139:
1136:
1134:
1131:
1129:
1126:
1124:
1121:
1119:
1118:Ralph Johnson
1116:
1114:
1111:
1109:
1106:
1105:
1103:
1099:
1093:
1092:
1088:
1086:
1085:
1081:
1080:
1078:
1074:
1068:
1065:
1063:
1060:
1058:
1055:
1053:
1050:
1048:
1045:
1043:
1040:
1038:
1035:
1033:
1030:
1028:
1025:
1023:
1020:
1018:
1015:
1013:
1010:
1008:
1005:
1003:
1000:
999:
997:
991:
985:
982:
980:
977:
975:
972:
970:
967:
965:
962:
960:
957:
955:
954:Active record
952:
950:
947:
945:
944:Naked objects
942:
940:
937:
935:
934:Specification
932:
930:
928:
924:
922:
919:
917:
914:
910:
907:
905:
902:
901:
900:
897:
895:
892:
890:
887:
886:
884:
882:
879:Architectural
876:
870:
867:
865:
862:
860:
857:
855:
852:
850:
847:
845:
842:
840:
837:
835:
832:
830:
827:
825:
822:
820:
817:
815:
812:
810:
807:
805:
802:
800:
797:
795:
792:
790:
789:Active object
787:
786:
784:
782:
776:
766:
763:
761:
758:
756:
753:
751:
748:
746:
743:
741:
738:
736:
733:
731:
728:
726:
723:
721:
718:
716:
713:
712:
710:
708:
704:
698:
695:
693:
690:
688:
685:
683:
680:
678:
675:
673:
670:
668:
665:
664:
662:
660:
656:
650:
647:
645:
642:
640:
637:
635:
632:
630:
627:
626:
624:
622:
618:
615:
613:
607:
603:
596:
591:
589:
584:
582:
577:
576:
573:
567:
563:
560:
558:, WikiWikiWeb
557:
554:
553:
534:
530:
524:
516:
514:0-201-63361-2
510:
506:
501:
500:
491:
482:
478:
468:
465:
463:
460:
458:
455:
453:
450:
448:
445:
443:
440:
438:
435:
434:
283:
277:
237:// Delegation
140:
134:
130:
126:
115:
105:
101:
97:
92:
84:
81:
79:
75:
69:
64:
60:
59:helper object
56:
52:
47:
45:
41:
37:
33:
30:
26:
22:
1200:Anti-pattern
1163:Linda Rising
1089:
1082:
1066:
1027:Lazy loading
959:Identity map
926:
610:Gang of Four
566:Rosetta Code
536:. Retrieved
532:
523:
498:
490:
481:
273:
122:
103:
99:
95:
94:
90:
82:
77:
62:
54:
48:
34:that allows
24:
18:
1172:Communities
1153:Jim Coplien
1128:Grady Booch
1113:Erich Gamma
1057:Type tunnel
1042:Object pool
1037:Null object
1032:Mock object
894:Interceptor
864:Thread pool
779:Concurrency
725:Interpreter
419:ClosedShape
353:ClosedShape
290:ClosedShape
44:inheritance
1067:Delegation
1002:Blackboard
707:Behavioral
659:Structural
621:Creational
562:Delegation
538:2019-03-23
473:References
96:Delegation
87:Definition
74:forwarding
40:code reuse
1133:Kent Beck
859:Semaphore
849:Scheduler
692:Flyweight
682:Decorator
677:Composite
649:Singleton
644:Prototype
410:Rectangle
314:Rectangle
287:interface
228:Rectangle
147:Rectangle
133:delegates
78:receiving
1220:Category
1193:See also
995:patterns
881:patterns
834:Proactor
781:patterns
755:Strategy
745:Observer
735:Mediator
730:Iterator
612:patterns
431:See also
359:override
104:delegate
55:delegate
1047:Servant
979:Model 2
839:Reactor
829:Monitor
794:Balking
765:Visitor
740:Memento
720:Command
667:Adapter
634:Builder
398:private
131:Window
119:Example
1101:People
984:Broker
687:Facade
672:Bridge
533:Kotlin
511:
425:bounds
404:bounds
392:Window
380:height
338:height
276:Kotlin
252:bounds
222:bounds
213:Window
204:height
171:height
137:area()
125:Kotlin
61:, but
51:object
27:is an
23:, the
1076:Books
993:Other
929:-tier
750:State
697:Proxy
389:class
374:width
323:width
311:class
210:class
198:width
156:width
144:class
129:class
1052:Twin
909:MVVM
824:Lock
819:Join
509:ISBN
365:area
299:area
258:area
243:area
189:area
135:the
112:self
108:this
68:self
921:ECS
916:ADR
904:MVP
899:MVC
564:on
401:val
362:fun
344:Int
335:val
329:Int
320:val
305:Int
302:():
296:fun
240:fun
219:val
186:fun
177:Int
168:val
162:Int
153:val
100:two
72:of
42:as
19:In
1222::
531:.
507:.
505:20
422:by
368:()
280:by
261:()
246:()
192:()
46:.
927:n
594:e
587:t
580:v
541:.
517:.
416::
413:)
407::
395:(
383:}
377:*
371:=
356:{
350::
347:)
341::
332:,
326::
317:(
308:}
293:{
264:}
255:.
249:=
234:{
231:)
225::
216:(
207:}
201:*
195:=
183:{
180:)
174::
165:,
159::
150:(
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.