OO question



I want to make an addressbook and I'm new to OO programming, so I
wonder if this sounds reasonable.

I think of making a class Address which contains all data about one
person, that class can have UserDict as baseclass so I can access data
like object['name'], etc..
Then maybe I can have a class AddressBook which has a list that
contains all those Address objects.
Does that sound reasonable?
And then the real reason that I posted here is:
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?

Thanks!

.



Relevant Pages

  • Re: OO question
    ... AddressBook take care of the saving and ask each object for its data? ... Robert ...
    (comp.lang.python)
  • Re: OO question
    ... saveof AddressBook. ... AddressBook take care of the saving and ask each object for its data? ... If you use the pickle module on the Addressbook then it will ...
    (comp.lang.python)
  • Re: HOW DO i SAVE MY RESUME IN WORD TO A DISC?
    ... What's the reason for saving to HD first and then copying? ... Your disc doesn't care what's IN the file. ...
    (microsoft.public.word.docmanagement)