Am I right ?

Topics: Writing modules
Dec 22, 2011 at 4:23 PM

I'm writing a module to store addresses for users. If I add ContainerPart to UserType and ContainablePart to AddressPart, I can manage a list of addresses for each user. Is it a good practice ? Thank you. 

Dec 22, 2011 at 11:32 PM

It's one way of doing it, and if it works at least that's fairly simple. If you wanted to build something more robust you could do what's explained in the 1-n and n-n relationship doc topic.

Dec 23, 2011 at 6:38 AM

ok thank you Bertrand, but then what is the exact purpose of ContainablePart and ContainerPart ?

Dec 23, 2011 at 6:40 AM

The right metaphor is folder-file. Does this help? Saying that an address is to a store like a file is to a folder seems a little wrong but not terribly so.

Dec 23, 2011 at 7:01 AM

Folder-file is a little bit abstract. I understand concept but have you real world sample in which you have implemented these parts ? 

Dec 23, 2011 at 8:16 AM

Well, if you have ever used a computer, then the file and folder metaphor should be very real and familiar? :) A sheet of paper in a binder?

I think you're fine with the way you're doing it.