OO question

robert no-spam at no-spam-no-spam.invalid
Mon Jan 1 09:10:41 EST 2007


fejkadress at hushmail.com wrote:
> If I want to save all addresses to disk, I can have a method, say,
> save() of AddressBook. But then what? What is a good object oriented
> approach? Should each Address object take care of saving itself to the
> file, with a method like writetofile(filename), or should the class
> AddressBook take care of the saving and ask each object for its data?

The OO religion likes to provide a big ego to objects. And be aware! All these egos then want to itch the programmer with question marks for years! And there are programming languages which draw more attention to what some unsolicited objects want, than to what the programmer wants. Python is not so.

Remember, you are the boss. You say: "I want to save all addresses to disk". I'd say: Just dump them to disk unless you feel a functional need in order to make it more indirect. 


Robert



More information about the Python-list mailing list