[Tutor] class design

Norman Khine norman at khine.net
Sat Jun 6 14:55:15 CEST 2009


Hi

On Sat, Jun 6, 2009 at 2:38 PM, Alan Gauld<alan.gauld at btinternet.com> wrote:
>
> "Norman Khine" <norman at khine.net> wrote
>
>> In my application I have 3 folders each containing images, something like:
>>
>> $ tree -L 3 /database/companies/company/
>> |-- product
>> |   |-- itinerary
>> |   |   |-- img1.gif
>> |   |   |-- img1.gif.metadata
>> |   |   |-- day1
>> |   |   |   |-- img2.gif
>> |   |   |   `-- img2.gif.metadata
>> |   |   |-- day1.metadata
>>
>> where I have the Product, Itinerary and Day folders, each containing
>> images and other files.
>>
>> Here is what I have so far that works, but I am looking for better
>> solution.
>
> When you say it "works" I'm not sure what it is you are trying to do?
> It seems that kmostly the classes are just containers representing
> the file structure and mostly you could accomplish the same, more
> simply, with os.walk?
>
> Do the classes actually do anything? What exactly do you do with
> a Product object? What is it for? Can you fill in a (virtual) CRC card
> for each class?

I will do this and see if I can improve the design.

>
> Until we know what the cklasses are for its hard to know what you
> want improved...

Each class is an object containing elements from generated from data
based on the current .metadata file, it's contents plus any data which
is within the 'folder'

In simple terms I was trying to create a 'folder with a view' which
displays all the data it contains on one page, rather than having to
view each node individually.

Thanks
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list