[Seaside] Meta models

Derek Brans brans at nerdonawire.com
Sun Apr 13 10:30:18 CEST 2003


I think I do want something lightweight.  Here is what I have so far.  It is
implemented and somewhat tested.  What I need are suggestions to solve
garbage collection and persistence.  Actually persistence is the kicker (as
always).  Would this work in a SmartFileDictionary?  If so, where what
object would be the "root" to start serializing with?  Any ideas would be
appreciated.

A DomainObject contains a collection of attributes.

Each attribute is a sub-class of Attribute.  Example subclasses are
BooleanAttribute, StringAttribute, and "interpreted" types like
CurrencyAttribute, DistanceAttribute, DateAttribute, EmailAttribute

I borrowed the Attribute rendering idea from Cees, where you can pass the
Attribute a selector to call on its renderer.  There is a default rendering
method also.

In DomainObject DNU I route getter - setter calls to attributes>>value(:).
You can override a getter or setter of an attribute (say, if you need to
drill down) by defining it as a method on the DomainObject's class.

Oh, that's another thing.  At Avi's suggestion, I define a class for every
type of object in the domain.  That makes is easy to define class-related
functionality.

Now, there's more....

A DomainObject also contains a collection of relations

Each relation (eg children of parent) has a reverseRelation (eg parents of
child).  When you add or remove a member to one (eg, remove a child from a
parent), the opposite relation gets updated (the parent is removed from the
child).

A relation and its reverseRelation is called a Relationship.

In DomainObject DNU I route method calls (eg. roger children add: mary)
properly.  Looking at (mary parents) will show that roger is included.

Instances of relationship are registered with Relationship class, which
keeps a registry.

A relation can also be used on its own:
(parentsRelation of: mary) add: mark
(childrenRelation of: mark)  shows that mary is included.

parentsRelation is a dictionary mapping parents to a set of children.  When
that set is changed, parentsRelation notifies childrenRelation (the
reverseRelation of parentsRelation) of the specific change (roger removed
mary from his children, so mary should remove roger from her parents).

Subclasses of relationship can be defined to implement different policies
(like one-to-many, or whether an object should be kept in memory if it is
pointed to by a given relation).

Derek Brans
Nerd on a Wire
Web design that's anything but square
http://www.nerdonawire.com
phone: 604.874.6463
mailto: brans at nerdonawire.com

----- Original Message -----
From: "Cees de Groot" <cg at cdegroot.com>
To: "The Squeak Enterprise Aubergines Server - general discussion."
<seaside at lists.squeakfoundation.org>
Sent: Sunday, April 13, 2003 3:18 AM
Subject: Re: [Seaside] Meta models


> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside
>




More information about the Seaside mailing list