Paul Johnston wrote: > Hi, > >> "A Sample may be created by the web application or fetched from the >> database. Later on, it may be disposed of, edited or checked back into >> the db." > >> On the other hand, the requirements and coding of both classes are >> kinda different, and I find myself changing the properties of the >> mapped class for better mapping and making the use of the class in >> non-Db contexts more awkward. > > Sounds like you want your app to be mostly unaware of whether a class is > saved in the db or not (i.e. persistent)? If so, I'd use a single class, > design the properties so they work in non-persistent mode, and then > they'll work in persistent mode as well.
or like a single class that does the what and why, and an interchangeable layer/context that does load/saving (and the relations!). in such situations declarative programming helps a lot, so u dont bind your self to (the) db (or whatever persistency). Check dbcook.sf.net. My own latest experience is about turning a project that was thought for db/using dbcook into non-db simple-file-based persistency. The change was relatively small, like 5-10 lines per class - as long as there are Collections etc similar notions so Obj side of ORM looks same. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---