Design tips requested for OOP forum system (using pickle)
cs1spw at bath.ac.uk
Fri Nov 30 22:37:54 CET 2001
"Graham Ashton" <graz at mindless.com> wrote in message news:<56zN7.139$Jm.5630 at stones>...
> As you're doing it as a learning exercise, try playing around with
> different implementations of your Forum class - don't fix it's internal
> design this early. Decide on your initial interface for your Forum class
> and then build things that talk to it. Then play around with the inner
> workings of the Forum class to see how best to implement it.
Thanks for the tip! - I like the idea of a class with a well enough
defined interface that I can majorly alter the internals without the
outside layer (handling presentation and so forth) knowing that
anything has changed. I guess that's where encapsulation becomes
important (I'm still getting the hang of important OOP concepts).
> I'd start by storing all data about a post
> in the Post object and throw the User object concept in the bin for a bit.
> Adding it later would be a useful exercise in refactoring if you decide
> you really want it.
I've decided to store two pieces of information with each post - the
name of the user and a flag for registered / unregistered - that way
if the "registered" flag is set I know further information can be
found about the user who wrote the post by searching for a user
account with that unique username (the unregistered flag is there
because I don't want to force people to register for some forums e.g
Great link! - Thanks :)
I had a play around in the interactive prompt earlier today and was
blown away by how incredibly easy pickle is to use - I've decided to
start hacking and see what happens. I'll post again once I've got
something to demonstrate, thanks for all the advice.
More information about the Python-list