Re: ExtendedEnumeration comments

From: Michael Gentry (blacknex..mail.com)
Date: Sun Mar 02 2008 - 13:02:19 EST

  • Next message: Marcin Skladaniec: "Re: Extended Enumerations"

    Comments inline.

    Thanks,

    /dev/mrg

    On Sun, Mar 2, 2008 at 12:18 PM, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >
    > Hi Michael,
    >
    > I have a few suggestions/comments/nitpicks.
    >
    > * Placing ExtendedEnumeration class in
    > "org.apache.cayenne.access.types" will make it inaccessible on the ROP
    > client (access.* packages are excluded from the client). So maybe put
    > it under 'org.apache.cayenne'?

    Like I told Ari, I never use ROP and was concerned of issues. Now I
    know of at least one. I'll move it.

    > * Since ExtendedEnumeration is a distinct case from just an Enum from
    > the POV of ExtendedType, maybe instead of handling both via EnumType
    > (and complicating the algorithm), create a separate ExtendedEnumType,
    > and place the "instanceof" check in EnumTypeFactory to create an
    > appropriate *Type.

    I can look at that. Seems logical and I know I wanted to do more work
    on it. That won't change the client-usage, though, which is all I was
    trying to nail down. Obviously, moving the interface will, but no one
    is using this yet.

    > * ExtendedEnumeration is missing Apache license header.

    Oops.

    > * From the docs: "The preferred method is to implement the Cayenne
    > ExtendedEnumeration interface and provide the database value for each
    > enumeration." IMO it is not universally *preferred*, it depends on the
    > situation at hand and user preferences. Both methods work equally fine
    > from Cayenne POV. I think we should just describe how both methods
    > work and what is the difference. It seems logical to start with
    > vanilla Enums and go to ExtendedEnumeration next.
    >
    > [Hmm... the more I think of it, enums mapping doesn't even belong in
    > the chapter on ExtendedTypes customization anymore, as this is all
    > built in Cayenne and transparent. Maybe extract it to the "Modeling
    > Object Layer" chapter in the modeler guide?]
    >
    > Andrus
    >

    The main reason I say preferred is because vanilla enums can have
    unplanned gotchas with the numeric version. I think it is best to
    steer them to the extended version, but point out the vanilla version,
    too. That will allow them to make a better choice (hopefully)

    I was thinking the same thing about the location of the enum docs
    being under extended types when I was typing this stuff up, but I just
    wanted to get something documented for now. It seems a good idea to
    move it, but I didn't want to think too much about where right now
    (and it seems there should be something in the Modeler Guide and the
    Cayenne Guide, but I wasn't sure where in CG).



    This archive was generated by hypermail 2.0.0 : Sun Mar 02 2008 - 13:02:50 EST