[Zope-dev] Questions about implementing object models with ZPatterns
Itai Tavor
itai@optusnet.com.au
Wed, 1 Nov 2000 12:35:44 +1100
Hi,
How do I implement gen-spec classes using ZPatterns and ZClasses?
For example, I want to implement Person and Customer. Writing it in
Python, it would be easy to subclass Person to get Customer, and
Customer would inherit Person's properties and methods. If I instead
create a specialist and ZClass for each class, do I use a SkinScript
to remap Person's properties into Customer? And what about the
methods - Customer can't inherit Person's methods, so I have to write
methods in Customer which call the same methods in Person. This seems
terribly complicated... am I missing something?
Another question: In Coad's examples, if a class has an 'n' order
relationship to another class - say Order and OrderItems, Order would
contain a list of OrderItems. Each OrderItem would contain the id of
the Order it belongs to. It seems to me that it would be easier for
Order to call OrderItems.getItemsForOrder(self.id), then I don't have
to maintain a list in Orders, and if I add an OrderItem the Order
will immediately know about it without me having to call it and tell
it the OrderItem was added. Is there anything wrong with this
approach?
TIA,
Itai
--
Itai Tavor "Je sautille, donc je suis."
C3Works itai@c3works.com - Kermit the Frog
"If you haven't got your health, you haven't got anything"