How to properly apply OOP in the bouncing ball code

zipher dreamingforward at gmail.com
Mon May 11 11:33:56 EDT 2015


On Friday, May 8, 2015 at 10:40:46 AM UTC-5, Tommy C wrote:
> I'm trying to apply OOP in this bouncing ball code in order to have multiple balls bouncing around the screen. The objective of this code is to create a method called settings, which controls all the settings for the screen and the bouncing behaviour of multiple balls, under the class Ball. However, I keep on getting errors related to attributes (e.g., speed). I'm new to OOP in Python so your help will be much appreciated. Thanks in advance.

You are making a error that few in the programming community have caught up to.  OOP design for *data abstraction* is a completely different beast that OOP for *simulation*.  The confusion is around the use of the word "object" which both denotes a physical world item and a virtual one detached from reality.

I would say that Python might not be the right fit, but instead a language dedicated to simulation.

Mark



More information about the Python-list mailing list