[Tutor] class design
kent37 at tds.net
Sat Jun 6 13:02:05 CEST 2009
On Sat, Jun 6, 2009 at 5:04 AM, Norman Khine<norman at khine.net> wrote:
> I would like help to design the following:
Product.get_days() may have a bug, it only returns the first container it finds.
You probably don't want the view code in the same class with the data.
It's generally a good idea to separate the model - the representation
of data - from the view - the display of the data.
The get_images() methods are all very similar. If each class had a
get_children() method then you could combine the get_images(). For
children = [ self ]
images = 
for child in self.get_children():
You might be able to do something similar with get_days().
I wonder why you are not using a database to store all this? I can't
help wondering what the code would look like in Django.
More information about the Tutor