Re: Duplication in events mechanisms in java?
From: Tomer Ben-David (tomerbd_at_barak-online.net)
Date: 12/22/03
- Next message: Piotr Wypych: "J2ME: Sorting"
- Previous message: ohho243_at_yahoo.com: "Java code for Item-based CF algorithm?"
- In reply to: Harald Hein: "Re: Duplication in events mechanisms in java?"
- Next in thread: Harald Hein: "Re: Duplication in events mechanisms in java?"
- Reply: Harald Hein: "Re: Duplication in events mechanisms in java?"
- Reply: Dale King: "Re: Duplication in events mechanisms in java?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 21 Dec 2003 23:10:39 -0800
> > java.util.Observable
> > java.util.Observer
> >
> > They seem OK to me...
>
> No, they are not ok for non trivial event systems, because:
I'm not plaining on using them directly I'm planning on building an
architecture that is going to be based on them (or on the other kind
of event architecture : java.util.EventListener)) that means that I
can use them for non trivial systems, since I'm only building my
infrastructure upon them in a way where i wont see their
disadvantages.
So that means that regarding the main reason : Main reason: Observable
is a class and the minor reason I was going to overcome them (easily)
by building my own infrastracture upon the observer/observabale ...
So I still have my question, I'm looking for the base, the common
ground of events system to build my architecture upon, I see two such
systems in java
the observer/observabale & EventListener , both these infrastructures
are solving a case where one part of the system needs to notify/send
events to other parts of the system, why dont they have a common
ground? (perhaps in a way of common ancestor interfaces) When
building an events sytem ARCHITECTURE what should it be BASED upon?
the observer/observabale or EventListener?
Thanks
Tomer
Harald Hein <speechless@gmx.de> wrote in message news:<Xns9458C36B1F29Fhhtoken@194.97.5.9>...
> "Tomer Ben-David" wrote:
>
> > Section 1 :
> >
> > java.util.Observable
> > java.util.Observer
> >
> > They seem OK to me...
>
> No, they are not ok for non trivial event systems, because:
>
> Main reason: Observable is a class. So you have to derive all event
> sources from Observable. This is to much of a restriction for a lot
> of real world systems.
>
> Minor reason: Only one type of event (the update() event) is possible.
> You have to discriminate between different events and event reasons by
> looking on the second generic argument to update(), which can become
> tedious.
>
> > My question is :
> > Why isnt there any connection between the classes/interfaces in
> > section2 to section1 isnt there actually a code duplication?!
>
> See above.
>
> > What should I use in case I want to have a generic events
> > framework in my system?
>
> You check your requirements. Depending on your requirements you use one
> of the existing mechanisms, write your own, or e.g. pay some $$$ for a
> message bus library.
>
> The better you can define your requirements, the less generic will be
> the systems that you need, and the simpler it can be.
- Next message: Piotr Wypych: "J2ME: Sorting"
- Previous message: ohho243_at_yahoo.com: "Java code for Item-based CF algorithm?"
- In reply to: Harald Hein: "Re: Duplication in events mechanisms in java?"
- Next in thread: Harald Hein: "Re: Duplication in events mechanisms in java?"
- Reply: Harald Hein: "Re: Duplication in events mechanisms in java?"
- Reply: Dale King: "Re: Duplication in events mechanisms in java?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|