[4632] in java-interest
Re: Peers, Strings, Native methods
daemon@ATHENA.MIT.EDU (David Geary)
Tue Jan 9 19:22:16 1996
Date: Tue, 9 Jan 1996 15:26:56 -0700
From: David.Geary@Central.Sun.COM (David Geary)
To: java-interest@java.Eng.Sun.COM, chris@tkna.com
> > There isn't a primer on peers (as far as I know). The peers are used
> > only for implementing the AWT using native widgets, they are normally
> > of no concern to AWT programmers. So unless you are implementing the
> > AWT you can safely ignore them.
But what if you need a GUI component not supported by peers (such as
popup menus)? Since the public in general is excluded from implementing
peers, you have no choice but to implement your component with low-level
AWT primitives. Doing so presents 3 great dilemmas:
1) Implementing components with AWT graphic primitives is at
_least_ an order of magnitude more difficult than implementing
them with peers.
2) Your newly implemented component will not support native look
and feel, while all of the components supported by the AWT
will.
Users then, will be served a strange mix of native l&f components
(for those supported by the AWT) and non-native l&f components
for everything else.
3) Murphy's law states that just after you've spent untold resources
implementing your component, the keepers of the AWT will
implement it using peers, thus invalidating all of your work.
> I just read "Design Patterns" by Geary (sp?). In it he describes a pattern
> that sounds exactly like peers (but I've forgotten the name of the pattern).
> He indicates that this pattern is often used to isolated a windows class from
> the underlying implementations.
>
> Perhaps Arthur can tell us if this is the same concept.
>
> In any case I think this is a great book.
Well I'd love to take credit for the book, but it's actually by
Gamma/Helm/Johnson/Vlissides.
BTW, I believe the pattern referred to is the Abstract Factory, which
is implemented (although most likely in a modified form) in the AWT via the
Toolkit class.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David Geary "She calls me goliath and I wear the david mask"
geary@rmtc.Central.Sun.COM
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com