Hi Grant,

> If you don't mind, I am still having a bit of trouble figuring out if my E/R
> models are correct, and also if I'm creating objects in the right way. Here's
> what I have so far, I'd appreciate any comments or hints! Thank you!

> (class +User +Entity)
> (rel nr (+Need +Key +Number))
> (rel name (+Need +Idx +String))
> (rel memberships (+List +Joint) user (+Membership))

I would be careful with +Need. My rule is to use it not at all, and if then
*only* in cases where the system initializes the value upon object creation.
Then the user can only change it, but not make it empty.

You have 2 +Need's as above, a GUI which checks it will complain because you
cannot enter both values at the same time.


> (class +Group +Entity)
> (rel name (+Need +Idx +String))
> (rel memberships (+List +Joint) group (+Membership))
> 
> (class +Membership +Entity)
> (rel role (+Need +Ref +String))
> (rel user (+Joint) id (+User))

This seems an error. 'id' is not a +Joint in +User. Should be 'memberships' :)

> (rel group (+Joint) name (+Group))
> 
> (obj ((+User) nr 1) name "Grant")
> (obj ((+Group name "Go Club")))

Should be (obj ((+Group) name "Go Club"))

> (commit)
> 
> (obj ((+Membership) role "Organizer") user (db 'nr '+User 1) group (db 'name 
> '+Group "Go Club"))

This will not work, because 'obj' does not evaluate its arguments and thus the
(db ...) calls will be taken as data.

As such 'obj' calls are normally in init files, I use read
macros in such cases, e.g.

   (obj ((+Membership) role "Organizer")
      user `(db 'nr '+User 1)
      group `(db 'name '+Group "Go Club") )

So much I saw at the moment :)


I recommend to avoid very long property names like "memberships". The full name
is stored in each object so its size multiplies with the number of these objects
in the DB.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to