[Glass] Design API for adding/removing/editing objects in GemStone

Richard Sargent richard.sargent at gemtalksystems.com
Fri Nov 15 09:31:15 PST 2013


Hi Mariano,

>> ... hoping that the User Guide has a chapter for what I will ask in this
>> thread.

I suggest you approach this question from a different perspective. If you
were to build an application in Pharo or almost any other Smalltalk, how
would you manage the objects? I doubt that either of those choices would
appeal.

The fundamental issue in any Smalltalk is how to hold references to the
objects you want to keep in your image and how to let go those you no longer
want. You can hold the root object in one of your classes, but that isn't
necessarily an appropriate responsibility for the class. More likely, you
would have a suitably named global to hold things, and possibly more than
one. 

For example, you might have "customers", where each customer holds
references to one or more accounts, and accounts hold references to
transactions. That makes it difficult to find accounts or transactions
without traversing the owning objects. So you might have additional
collections holding references to these, as well. Of course, these
additional collections have the consequence of blocking garbage collection,
but they also create the possibility of indexed queries (in GemStone) for
even faster searching.


A single "database root" object makes sense. Multiple globals for different
collections probably doesn't. (Refer to P. J. Plauger's article from c. 1989
on 0, 1, and infinity for some great modelling advice.) Having a single
database root with a number of named collections is probably a better
design.

You can combine these approaches with some of your alternatives, such as
having the global database root hold an instance of some class which manages
the "database" aspects of your storage model (e.g., schema operations rather
than application functionality).




--
View this message in context: http://forum.world.st/Glass-Design-API-for-adding-removing-editing-objects-in-GemStone-tp4722494p4722519.html
Sent from the GLASS mailing list archive at Nabble.com.


More information about the Glass mailing list