What is delegation
db at Eng.Sun.COM
Tue Oct 13 01:03:47 BST 1998
Dean Roddey wrote:
> I'm sure you'll get some definitions, but here are
> some examples that may help...
See also my response of this morning, archived at
Some technical motivations for delegating:
- Coping with situations where the interface isn't
"exactly" the same (e.g. adapters that implicitly
add another argument, extra setup needed, etc);
- Sometimes you need lots of objects to delegate to
the same object, and yet have distinct identity.
That object might be a flyweight, but to use it
in some cases you might need to restore its weight.
- Base classes differ; client A needs something to
call object B but needs its callback to derive from
some concrete class. It delegates to object C which
is so derived, and which calls B.
- As Dean noted, "composite" objects include others
with "has-a". Distributed systems often work that
way ... a user account object "has-a" home directory,
a password, a set of files. But those are objects in
their own right, so "is-a" (subtyping) is wrong.
I've not found "aggregation" to be helpful except when
talking about COM, but that may be because COM has rules
about aggregating that don't apply to more classic object
composition/delegation schemes. And of course, everyone
has their own ways to slice'n'dice design problems.
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev