[Q] ImageSegments as a persistence mechanism (was Re: Proposal to
get to the triad)
Hannes Hirzel
hannes.hirzel.squeaklist at bluewin.ch
Tue Mar 11 07:33:03 UTC 2003
Hi Goran
goran.hultgren at bluefish.se wrote:
>
> True but ImageSegments are damn nice. They are very fast, very reliable
> and well, simply great. I use them as a trememendously simple way of
> persisting an object. In my app the HomepageBuilder the code for
> persistence is like 20 lines. Period. Its "poor man's" OODB.
>
>
Would it be possible to post this code?
What is the difference to just using a reference stream like the
following
example shows (method of a SUnit test case)
testReferenceStream
| dict rr |
dict _ Dictionary new.
dict at: 'gruen' put: 'green'.
dict at: 'rot' put: 'red'.
dict at: 'blau' put: 'blue'.
fname _ 'TestDict.obj'.
rr _ ReferenceStream fileNamed: fname.
rr nextPut: dict.
rr close.
dict _ nil.
rr _ ReferenceStream fileNamed: fname.
dict _ rr next.
rr close.
self assert: (dict at: 'gruen') = 'green'.
FileDirectory default deleteFileNamed: fname.
Regards
Hannes
More information about the Squeak-dev
mailing list
|