[Background from Alan] > If some other factor were to determine its behhaviour more > closely - such as determining whether the Pizza was within > the coordinate boundaries or in collision with another Pizza > then that could be implemented via a message protocol. > Thus the context object should respond to some message > from Pizza and in this case the Pizza should hold a reference > to its context manager(probably a screen or grid of some sort).
[disclaimer] This email has particularly strong personal opinions about coding practices. I do not wish to personally offend anyone, and if you feel that you have been offended as such, or that you disagree, please do not bother emailing this list to tell me, excepting that you provide an excellent case promoting your views that someone may be able to apply to make their code more intuitive/sensible. This email was provided for just such a reason. [/disclaimer] > The context manager is responsible for tracking the objects > being managed, but the objects remain responsible for > managing their own state. [rant] This phrase right here is a dead giveaway to me that Pizza should have little control over how it moves. A Pizza must be completely aware of its current position (being part of its state) and at the very *most* a set of rules governing general falling behaviour. I like the idea of a context manager that is perhaps a container for Pizzas that oversees their behavior, but I dislike the idea that a Pizza knows specifics about its rules for positioning such as collisions or etc. that it has to communicate to the context manager and/or other Pizzas. Maybe I am becoming too used to lower level languages, not fully siding with abstraction. I just see that we have suddenly introduced to new levels of redirection to achieve the same result, like a company that must use interdepartmental communication by messages through possibly more than one department instead of just simply communicating directly. Or like the elements of a list changing each other, instead of the list changing the elements. Definite benefits for messaging models, but this /feels/ akin to filling out tax forms so that the government can tell you how you filled them out incorrectly. A similar somewhat questionably connected problem involves my dealings with the Render method of the IPicture interface. Sure, you can directly apply the picture to the device context or if you like we have a Render method that will automatically change the coordinates so that you have to convert them back to display it. Abstraction isn't everything. [/rant] _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor