Image-based persistence or something else?

Diego Fernandez diegof79 at gmail.com
Fri Mar 17 05:14:38 UTC 2006


On 3/16/06, William G. Davis <william_gordon_davis at yahoo.com> wrote:

Right now I have a class that stores objects for later
> retrieval in several collections. The persistence is
> achieved by making the class a Singleton; it stores an
> instance of itself in a class variable and provides
> access to the object with a class message (#instance).


Why not using a global to save the instance, instead of a "Singleton" with
class variables?
This is unnecessary in St.
Singleton means "single-instance", but some people make a wrong use of this
pattern to make well known instances --globals. Note that except for "null
objects", is very difficult to known if class represents something unique,
so singletons are usually used only for performance reasons.


Is this a bad system? Should I be using something
> else?


Except for the singletons it's not bad :), you can design your system in
that way and then add other persistence mechanisms when necessary.

Will this cause too much of a headache when
> upgrading Squeak or transferring data from one machine
> to another?
>
>
Yes :(
Squeak image is not designed as a multi-user, transactional image so using
the image in that way can be a headache when your application grows.

Maybe you can use some OODB to solve this problem, (the most used OODB is
GemStone, that is a St prepared for persistence: an image with multi-user
and transaction support, is very powerful but is very expensive for a small
project :(, take a look at: http://www.gemstone.com/ and
http://minnow.cc.gatech.edu/squeak/1957 )

There are some free OODB frameworks for Squeak:
MinneStore: http://minnestore.sourceforge.net/index.html
Magma: http://minnow.cc.gatech.edu/squeak/2665
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20060317/9d2cda0b/attachment.htm


More information about the Squeak-dev mailing list