Re: Thoughts on EventManager & async posting

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Nov 28 2003 - 15:26:27 EST

  • Next message: Andrus Adamchik: "Cayenne Featured in DB Magazine, Japan"

    On Nov 27, 2003, at 1:08 PM, Holger Hoffstätte wrote:
    > Andrus Adamchik wrote:
    >>> 1. Instead of postEvent(..) and postEvent(...,boolean), I suggest
    >>> self
    >>> explanatory "postNow", "postLater" methods.
    >
    > postLater..when exactly would that be? See how not having two methods
    > would help? ;-)

    No, I don't :-)

    No problem changing the naming though ("post" and "asynchronousPost" -
    for those who have auto-complete feature in the IDE), any other
    names... This doesn't change the underlying idea.

    >>> 2. Change "addListener" to throw a runtime exception instead of
    >>> NoSuchMethodException. This will make the code cleaner. Currently I
    >>> am
    >
    > Done, changed to RuntimeException(NSMEx.getMessage()). I removed the
    > rather useless NSM checks for internal events and kept them for the
    > unit
    > test.

    Cool. This makes it easier. "addListener" already has a rather long
    signature. Anything we can do to make it easier to use is a good thing
    IMO.

    >> Also I'd like to change EventListener argument in 'addListener' to be
    >> Object, since I am already running into trouble with that when using
    >> Scope framework. Their listeners do not extend EventListener.
    >
    > Done - but just how ugly is this? I originally did it to be 'Java
    > design
    > compliant'..how foolish of me! Though I agree, generic Object is more
    > practical..and just goes to show how useless that particular marker
    > interface is in reality. Well, you could use AspectJ to tack it on..
    > :-)

    While I still think that this change is the right thing, my original
    motivation for it is gone. I had to roll out my own event model for
    that Scope application. Scope doesn't make things easy - their model
    events do not extend EventObject, just like their listeners do not
    extend EventListener. Oh well, Cayenne doesn't follow JDO spec either
    :-)

    Andrus



    This archive was generated by hypermail 2.0.0 : Fri Nov 28 2003 - 15:26:33 EST