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

Mariano Martinez Peck marianopeck at gmail.com
Fri Nov 15 07:41:04 PST 2013


Hi guys,

First, let me say that I was really hoping that the User Guide has a
chapter for what I will ask in this thread.

Ok, I understood basic concepts of GemStone. I understood it's basic
classes and libraries. I understood the basic transactions concepts. I
could even run my webapp from inside GemStone. Cool. But now... how do I
persist for real in GemStone? How do I design my app API for storing,
retrieving, editing, removing objects?

As far as I understand (please correct me if I am wrong), the first thing
to know is that we should put our persistent objects somehow reachable from
the user smalltalk dictionaries. Ok, as most OO DBs, GemStone works by
reachability.

Second. Since the classes of my app are in those smalltalk dictionaries,
and class variables are reachable from my classes, then whatever I store in
class variables are persistent, right? (of course, unless I store there
some objects that cannot be persisted).

Third...I would try not to enter too much in the transactions problem right
now. I would like to keep using the GLASS as it comes for the moment...

So...Ideas:

1) I keep a collection in a class side for each of my classes whose
instances I want to persist. And I implement a protocol add:  remove:  etc
that I put in Behavior. Them from my code I do: "Client addObject:
anInstance"

2) I have one "MyAppRepository" class which is a singleton. The unique
instance has a dictionary. From my code I do "MyAppRepository current
addObject: anInstance".
And MyAppRepository instance has a dict and operates for that dict (asking
#class to the receiver and put that as keys...).

3) others...

So, what do you do? My idea was to use 2) but reuse the repository class of
Voyage and reuse also its protocol.


Thanks!

-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20131115/49c778d3/attachment.html>


More information about the Glass mailing list