Re: Protection against NPEs/catching illegal arguments ASAP

From: Jonathan 'Wolf' Rentzsch (webobject..edshed.net)
Date: Wed Dec 11 2002 - 16:50:20 EST

  • Next message: Andrus: "Upcoming Alpha 5"

    Holger Hoffstätte, holge..izards.de, wrote:
    >JDK 1.4 assert() came to mind, but that's probably not good enough and
    >we'd reintroduce a 1.4 dependency.

    Agreed. I had hoped assert() would be a lot nicer than it is. Even if I
    ran JDK 1.4, I'd still stick with JAssert. But, I may be partial. (grin)

    >I also realize this is very much a matter of style & taste, which can
    >hardly be argued about..especially in light of Cayenne being so good
    >already, considering it's not even 1.0 yet. :-)

    I won't speak to this since, as Holger points out, this is a personal
    preference. Andrus doesn't like pervasive assertion testing, so JAssert
    should be added sparingly -- only where there's a clear code or
    complexity win.

    >IIRC Project WONDER has something like that for localized validation
    >messages (which is a total mess with EOF and has always been). Maybe
    >someone who is familiar with it (hint ;) could look into extending JAssert
    >with this? Even without localization just gradually starting to use
    >something like JAssert in places that we _know_ cannot be
    >null/wrong/whatever will most likely improve things. I know I'd like to
    >see something like this.

    See below.

    >Now look who's lurking! .-)

    Darn, my cover's been blown. (grin)

    >Actually yes, very much so! If we can agree that this is a good idea would
    >you be willing to donate this? How about the external message feature (see
    >other mail), could you work on that?

    Donation: sure. Use it like you use JUnit or Log4J -- drop it into the
    project, send bug reports my way and occasionally sync with the mainline.

    Concerning adding failure messages...

    I have opinions on the best way to use assertions, and when not to use
    them. Could you give me a code example from Cayenne you think is a good
    candidate for refactoring using assertions?

    That way, together, we can refactor Cayenne and JAssert so they play
    nicely together.

    .......................................................
    Jonathan 'Wolf' Rentzsch jon at redshed dot net
    Red Shed Software http://redshed.net (847) 584-7465
    PGP: B2AF 1A09 F881 EBDE C9D6 C4D2 C04F A3C0 3EC5 D5F2

                 "There are 10 types of people:
        those who count in binary, and those who don't"



    This archive was generated by hypermail 2.0.0 : Wed Dec 11 2002 - 16:50:34 EST