deriving a model from a class

From: Magic Hat (magic_ha..ac.com)
Date: Wed Sep 04 2002 - 10:02:54 EDT

  • Next message: Andrus Adamchik: "Re: Modelization: the missing the piece?"

    Hello,

    Here is the layout of an alternative approach to modelization: have the
    model (and therefore the database) derived from a class structure.

    Lets take an example:

    (1) public interface Group
            {

    (2) public String name();

    (3) public Map userInfo();

    (4) public Person manager();

    (5) public Collection members();

                    public void addToMembers(Person aValue);

                    public void removeFromMembers(Person aValue);

            }

    This interface describes a trivial Group object. From its structure, a
    model could be easily derived:

    (1) There is an entity name: "Group"

    (2) Some primitive attribute: "name".

    (3) Some unknown attribute. More on that latter.

    (4) If the "Person" class is another persistent object, this is a to-one
    relationship.

    (5) Again, assuming that "Person" is another persistent object, this is
    a to-many relationship. Checking the Person class would tell if its a
    one-to-many or a many-to-many.

    The only "ambiguity" is with any attributes that is neither a persistent
    object nor a primitive type. In such a case, a reasonable (?) way of
    handling it could be to... ignore it and treat such an attribute as a
    "blob": something that's better be Serialization if it wants to end up
    in a persistent storage.

    Comments welcome!-)

    PA.



    This archive was generated by hypermail 2.0.0 : Wed Sep 04 2002 - 10:02:53 EDT