Re: Object validation classes

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sun Sep 14 2003 - 17:30:27 EDT

  • Next message: Andrus Adamchik: "Final 1.0 planned for September 20"

    Fabricio,

    Just browsed through your code. Cool! A few notes.

    1. Using JDK 1.4 assertions is unfortunately not an option for us,
    since core framework must be JDK 1.3 compatible. There are quiet a few
    users that do not have an option of upgrading their deployment
    environment. Of course Modeler is 1.4, but core cayenne.jar is 1.3.
    Many of the assertions, e.g. argument checking is better done by
    throwing IllegalArgumentExceptions anyway. E.g.:

         http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html#usage
            

    2. I suggest package name to be "org.objectstyle.cayenne.validation",
    since the validation mechanism that you've implemented is generic
    enough and is not tied to the access layer. I hope to eventually
    switch most of the things in "project.validation" to this generic
    mechanism.

    3. One very important piece is not implemented, or at least I am not
    seeing it - CayenneDataObject.validateForSave(..) - this is where a
    DataObject should pull entity info and check things like max length
    exceeding the allowed value, nulls where nulls are not allowed and
    such...

    4.Since Cayenne imports Jakarta org.apache.commons.beanutils, there is
    no need for a custom implementation of property reading in Validator
    class. Just use BeanUtils.readSimpleProperty(..). But note that for
    DataObjects, a special handling using
    "CayenneDataObject.readNestedProperty(..)" is preferable since it is
    *much* faster than reflection.

    An alternative to 3. and 4. would be using class generation to create
    validateForSave for each class, but for now I am still unsure if this
    is the way to go. Doing too many things via class generation is a
    conceptual shift in Cayenne and requires more thought.

    Thanks

    Andrus

    On Friday, September 12, 2003, at 09:10 PM, Andrus Adamchik wrote:

    > Hi Fabricio,
    >
    > I will look at your code over the weekend.
    >
    > We have a bit of a dilemma though. 1.0 Release shouldn't really
    > include any new features to avoid destabilizing it. On the other hand
    > branching it now, so that all 1.1 stuff would go into CVS HEAD, is a
    > bit premature, given that there is some work still being done on
    > FireBird and DB2 adapters, and the documentation.
    >
    > I personally vote for branching now and releasing the FireBird adapter
    > as "experimental" with 1.0 (which it is in all respects). I know
    > Holger is on vacation. What is the feeling among other committers? Are
    > we ready to get 1.0 out of the door and open the gate for all the new
    > features?
    >
    > Andrus
    >
    >
    > On Thursday, September 11, 2003, at 04:49 PM, Fabricio Voznika wrote:
    >
    >> Hi all,
    >>
    >>
    >> I've implemented the object validation objects. I'm sending the
    >> new classes in 2 tars:
    >>
    >> src.tar.gz - new classes, all in ...cayenne.access.validation package.
    >> tests.tar.gz - just 1 class with junit tests.
    >>
    >> The file diff.txt contains the result of a diff -ru for the
    >> modified classes. I diffed it against 9/11/2003 nightly build due to
    >> the already mentioned problems with CVS.
    >> I'm haven't done any documentation yet, but I plan to do so. I
    >> would appreciate if someone could have a look and validate what I
    >> did. There are some TODO tags to move methods to an Utility class, I
    >> would appreciate if someone could tell me where to put them.
    >>
    >> Thanks,
    >> Fabricio.



    This archive was generated by hypermail 2.0.0 : Sun Sep 14 2003 - 17:26:26 EDT