[Seaside] RFC: generalized persistence framework for Seaside

Derek Brans seaside@lists.squeakfoundation.org
Mon, 09 Dec 2002 12:59:42 -0800


I'm thinking of creating a simple, generalized persistence framework for 
Seaside applications.  Comments and feedback would be greatly 
appreciated.  Here's my design (call it the "DomainDB" solution):

Goals:
- abstract away the database implementation
- simple, easy to implement in a short amount of time

Goals that would be nice (but don't know how without lots of trouble):
- domain objects know when to save themselves.

DataSource represents a data source.  Subclasses of DataSource are 
TantalusDataSource or MinneStoreDataSource.  Methods provided among 
others are (save:anObject,  delete:anObject newForClass: aClass)

Another class hierarchy called DomainDB provides domain / site-specific 
database functionality and owns a DataSource through composition.

All the data objects used in the website will be decendents of an object 
called DomainObject that will implement 'save' and 'delete' among other 
methods.

DomainObject>> domainDB
	^WASession currentSession domainDB "the session has a copy of the 
domainDB"

DomainObject>> save
	self domainDB save: self

DomainObject>> delete
	self domainDB delete: self

Then, I have a set of DomainObjectEditor classes, for rendering editors 
for the domain objects (similar to the one's in the web calendar).  When 
submit is pressed, it calls 'save' on the domain object it was editing 
(must be called after all members are updated).

Comments, feedback? Are there easier ways of doing these things?  Can an 
object automatically call 'delete' on itself when it's being GC'd?

Thank you,
Derek


Nerd on a Wire: Web and Information Solutions
Website Design - Database Systems - Site Hosting
604.874.6463
mailto:info@nerdonawire.com
For more information, visit http://nerdonawire.com