3 ms·
I'm no great fan of GoF, it leads off saying to use composition, then most of the patterns just go hog-wild with inheritance anyway. But I don't think anyone h
by chuckadams 2y ago
I'm no great fan of GoF, it leads off saying to use composition, then most of the patterns just go hog-wild with inheritance anyway. But I don't think anyone has a lock on the term "delegation". It means "pass off responsibility to something else", and it doesn't need to depend on any single mechanism hardwired into the language. Whether `self` stays intact across dispatches or you need to pass `this` explicitly to your delegated handler isn't the central point.
- gnoack 2y agoThe way I interpreted most of these "subclassing" cases in the GoF diagrams was actually as "subtyping", and then it makes more sense. Regarding no one having a lock on the term "delegation", I think this is spot on. Yes, someone might have used the term differently before GoF, but that does not mean that GoF was wrong. It just meant something else in their context. (Btw, congratulations, your comment is the first one so far in this comment thread that actually discusses the linked article and not just the GoF book itself.)