Toby Dickenson wrote:
> On Fri, 20 Oct 2000 12:54:19 +0100, Chris Withers <[EMAIL PROTECTED]>
> >>Consider the following passage in the documentation:
> Noooooo - Context-based instance-space applications are a major source
> of pain, bugs and security holes. They might be the one thing that
> Zope does different (and therefore they need to be explained) but that
> doesnt make them right.
I'm not sure I grok what rightness has to do about it. I think this is
right, to me wrong == broken. This is not broken.
> Thats fine until:
> * someone adds an property named feed to an object at an intermediate
> location in the containment heirarchy. This breaks the cron job that
> calls self.Zoo.Diet.LargeAnimals.hippo.feed(), and all the hippos
This is the classic anti-acquisition argument, but it's a red herring.
The same argument applies to inheritance; introducing an attribute
between two classes in a generalized relationship and your app breaks
and all the hippos starve anyway. Zope cannot be robust against
programmer error. Nothing can.
> * someone uses self.Zoo.Diet.buildings.visitor_reception.feed(), and
> ends up filling the reception with hippo food. (This might even be
> possible for someone who has no permissions on the reception object)
This is once again programmer error.
> * someone wants to have a dinner party; feeding more than one animal
> at once. But then he finds he has to switch to a different technique
> because he cant call his dinner_party() method with more than one
> context at the same time.
Can you explain this some more? I'm a bit lost on how this invalidates
context vs. containment when binding methods. You're right, you can't
have more than one context at a time, but neiter can you be bound to
more than one container. If you want to feed more than one animal, use
a loop and iterate over them.
> * someone uses
> and ends up feeding paper to the hippo. (that could even be someone
> who has no other permisions on that hippo object)
This is the same as your first two arguments: programmer error.
> Ive now nearly finished converting all my newbie zope projects back to
> a conventional O-O design. I have been bitten by all the problems
> listed above. The feed method *should* *be* implemented in a ZooAnimal
> base class.
Ok, that's a valid approach.
Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -