🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7299

Re: user-defined events

#7299
From: John McGrath TeamB
Date: Tue, 26 Jun 2001 07:06
32 lines
2059 bytes
On Mon, 25 Jun 2001 13:08:23 +0100, Steve Holt wrote:

> Check out the Observer/Observable classes.

The Observer interface and Observable class implement the Observer 
pattern, but so do the Event classes mentioned in the link that
Torsten posted.  Either will work, but I think the Event approach
is better.

One reason is that Observable is a class, not an interface.  Since
you must extend Observable, you cannot extend another class, which
can be a significant problem.

Another problem is with the granularity of the notification.  With
the Observer classes, every Observer is notified whenever there is
any kind change in the Observable.  It is not possible to register
as an Observer for only certain kinds of changes.  With the Event
classes, you can do this.

One final argument for the Event classes:  If you search the entire
source for the Java core classes, you will not find a single use of
Observer and Observable, but you will find thousands of uses of the 
Event classes.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.15a1edf02782756398a2de@forums.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3b36f246.4749430@newsgroups.borland.com> <3b3729ba$1_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,522cf07126eb8906
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-26 00:09:40 PST
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: user-defined events
Date: Tue, 26 Jun 2001 03:06:40 -0400
Message-ID: <MPG.15a1edf02782756398a2de@forums.borland.com>
References: <3b36f246.4749430@newsgroups.borland.com> <3b3729ba$1_1@dnews>
X-Newsreader: MicroPlanet Gravity v2.30
NNTP-Posting-Host: 209.92.40.60
X-Trace: dnews 993539198 209.92.40.60 (26 Jun 2001 00:06:38 -0700)
Lines: 32
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews