First, I'd like to point out that I know OOP concepts and understand the differences between dictionaries and classes. My question is about what makes sense design wise in this case:
I am designing a webapp in python and I have to represent something like a book object. Books have chapters and chapters have titles and content. For simplicity, lets say that the content is plain text.
My question is, should I make the book and chapter classes or dictionaries? I know it'd look neater to use book.chapter instead of book['chapter'], and if I end up having methods in the future, it might make sense to puts them in the book class. However, I'd like to know if there is any overhead to using classes instead of storing the information in dictionaries?
If I don't want to instantiate a book object from a database everytime and store it as a pickle, I'd have to be worried about incompatibility with past book objects if I add/remove data members from a class.I feel that it'd be easier to deal with this problem in dictionaries. Any pointers on whether/when it makes sense to use dictionaries instead of classes?