Yowser. Thanks to both of you - that's exactly what I mean. Any pointers on where I can find an example of a class that is "unaware" if it is in the db? Or is there a good example of the second solution, of "a single class that does the what and why, and an interchangeable layer/context that does load/saving"? I'm digging through dbcook.sf.net but haven't found anything just yet.
On 2007 Dec 7, at 22:07, [EMAIL PROTECTED] wrote: > Paul Johnston wrote: >>> "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." >> >> 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. -- Dr Paul-Michael Agapow: VieDigitale / Inst. for Animal Health [EMAIL PROTECTED] / [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---