[Seaside] generating relationships

Sean Allen sean at monkeysnatchbanana.com
Thu May 14 20:33:03 UTC 2009

On May 14, 2009, at 9:58 AM, sergio_101 wrote:

>> just relate the objects in instance variables. In collections when  
>> N and one
>> when one :)
> so, in albums, i would have something like artistID?
>> In a second phase you make convenience methods so they talk each  
>> other so they
>> answer what you need.
> is there something like the rails 'find' function build in? so i  
> could do something like..
> Album.find(albumID).artist

you dont need a find.

create your domain objects so that artist is an instance variable of  

when you have the album, just send it an artist message or perhaps  
isBy or whatever

artist := album artist
artist := album isBy

in your case, you dont ever need an id.

you have Artist, Album, Songs

if you want to find all albums by an artist,
you could either have a persistent collection of artists that you go  
through, find the artist you are interested in and do something like:

albums := artist albums

or you could just maintain a persistent collection of albums and go  
through those, asking each who it was by.

the options are pretty wide open,
if you are using gemstone and have a ton of data, they provide special  
methods to make querying faster than iterating over a collection,
but in the beginning, iterating over a collection would be your first  
step. ( iterating is a bad choice of words but you get the idea ).

More information about the seaside mailing list