I'm having a bit of a problem deciding which object should handle database serialization for a set of classes I've modeled.
Here's the scenario I'm dealing with:
So the question is... do I let the User object deal with the serialisation to the database (and also, I assume, decide WHEN to serialise) or do I let the factory serialise the data.
The other option is to create a completely new object (static?) to manage serialisation of my users (and later other things using the same model).
It's annoying that I can't afford to buy books on this kind of thing (application models) but I can't - if anyone can help me or maybe send me to a good site with lots of bright pictures and simple text (Spot writes code; Write code Spot; Spot writes good code; Good boy, Spot) I'd be mighty obliged !
Yet another unchecked rambling brought to you by:
Oddball
Here's the scenario I'm dealing with:
Code:
_____
??? / \
[ User Factory ] <-----> \_____/
| | |
Find(string u); | | DB |
Create(); | | |
???Update(User u);??? | \_____/
| ^
V ??? |
[ User ]<----------------
So the question is... do I let the User object deal with the serialisation to the database (and also, I assume, decide WHEN to serialise) or do I let the factory serialise the data.
The other option is to create a completely new object (static?) to manage serialisation of my users (and later other things using the same model).
It's annoying that I can't afford to buy books on this kind of thing (application models) but I can't - if anyone can help me or maybe send me to a good site with lots of bright pictures and simple text (Spot writes code; Write code Spot; Spot writes good code; Good boy, Spot) I'd be mighty obliged !
Yet another unchecked rambling brought to you by:
Oddball