<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Simple Image Based Persistence in Squeak</title>
	<atom:link href="http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/feed/" rel="self" type="application/rss+xml" />
	<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/</link>
	<description>thoughts on Smalltalk and programming in general...</description>
	<pubDate>Wed, 23 Jul 2008 20:20:21 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-11368</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Tue, 26 Feb 2008 03:21:45 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-11368</guid>
		<description>I'm sure one could come up with something that worked, but it'd be an approach I wouldn't like because it's not simple and obvious.  I used to think that auto tracking changes with some kind of write barrier or change observer and automatically commiting was simple too, but every such system I've worked with I find I'm always doing battles with *auto* thing trying to make it behave how I want.  

The conclusion I've come to, especially after seeing the success of ActiveRecord (a pattern I used to think sucked) in the Ruby community, is that nothing beats an explicit call to save by the programmer because it allows things to work outside of some special context where the auto-magic is available, and it's easy for the programmer to see exactly what's going on.  Explaining how ActiveRecord's work to another programmer and getting him productive fast is trivial, explaining how Glorp works and getting him *productive fast* is near impossible, too much magic for many programmers to keep in mind.

I'm becoming less and less a fan of magic and more and more a fan of simple straight forward solutions that just work (like saving objects to a file).</description>
		<content:encoded><![CDATA[<p>I&#8217;m sure one could come up with something that worked, but it&#8217;d be an approach I wouldn&#8217;t like because it&#8217;s not simple and obvious.  I used to think that auto tracking changes with some kind of write barrier or change observer and automatically commiting was simple too, but every such system I&#8217;ve worked with I find I&#8217;m always doing battles with *auto* thing trying to make it behave how I want.  </p>
<p>The conclusion I&#8217;ve come to, especially after seeing the success of ActiveRecord (a pattern I used to think sucked) in the Ruby community, is that nothing beats an explicit call to save by the programmer because it allows things to work outside of some special context where the auto-magic is available, and it&#8217;s easy for the programmer to see exactly what&#8217;s going on.  Explaining how ActiveRecord&#8217;s work to another programmer and getting him productive fast is trivial, explaining how Glorp works and getting him *productive fast* is near impossible, too much magic for many programmers to keep in mind.</p>
<p>I&#8217;m becoming less and less a fan of magic and more and more a fan of simple straight forward solutions that just work (like saving objects to a file).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-11364</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Tue, 26 Feb 2008 02:13:26 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-11364</guid>
		<description>A question about the Prevayler approach:

For those cases where the UI framework knows which action will be invoked on which object (e.g. the #on:of: style callbacks, or through some other means like the #actions in your SSForm), would it be possible for the logging to be done by the framework itself, rather than any explicit Command-pattern objects by the programmer? There seem to be multiple ways to do the wrapping, from method-wrappers to ByteSurgeon to ...

- Bill</description>
		<content:encoded><![CDATA[<p>A question about the Prevayler approach:</p>
<p>For those cases where the UI framework knows which action will be invoked on which object (e.g. the #on:of: style callbacks, or through some other means like the #actions in your SSForm), would it be possible for the logging to be done by the framework itself, rather than any explicit Command-pattern objects by the programmer? There seem to be multiple ways to do the wrapping, from method-wrappers to ByteSurgeon to &#8230;</p>
<p>- Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Davis</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-10026</link>
		<dc:creator>Aaron Davis</dc:creator>
		<pubDate>Sun, 03 Feb 2008 00:11:58 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-10026</guid>
		<description>It works now.  Thank you.

I was literally copying the code from FileStream to make it run, rather than modifying it.  There are two differences between your code and what I had.

#readOnlyFileNamed:do: was using #detectFile:do:, which encapsulates the #ifNil:ifNotNil: call on file.  And, my #readOnlyFileNamed looked like this:
&lt;code&gt;
readOnlyFileNamed: fileName 
	^ self concreteStream readOnlyFileNamed: (self fullName: fileName)&lt;/code&gt;

Which is where I got the #concreateStream and #fullName: methods.

I still don't really get why it wouldn't work before.  Why would calling concreteStream from within ReferenceStream be any different than delegating it to FileStream?

Anyway, thank you for your help.</description>
		<content:encoded><![CDATA[<p>It works now.  Thank you.</p>
<p>I was literally copying the code from FileStream to make it run, rather than modifying it.  There are two differences between your code and what I had.</p>
<p>#readOnlyFileNamed:do: was using #detectFile:do:, which encapsulates the #ifNil:ifNotNil: call on file.  And, my #readOnlyFileNamed looked like this:<br />
<code><br />
readOnlyFileNamed: fileName<br />
	^ self concreteStream readOnlyFileNamed: (self fullName: fileName)</code></p>
<p>Which is where I got the #concreateStream and #fullName: methods.</p>
<p>I still don&#8217;t really get why it wouldn&#8217;t work before.  Why would calling concreteStream from within ReferenceStream be any different than delegating it to FileStream?</p>
<p>Anyway, thank you for your help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-10020</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Sat, 02 Feb 2008 22:12:09 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-10020</guid>
		<description>You're stealing too much from FileStream, you really just need to encapsulate the #close, here are my extentions to DataStream...

&lt;pre&gt;
fileNamed: aName do: aBlock 
	&#124; file &#124;
	file := self fileNamed: aName.
	^ file 
		ifNil: [ nil ]
		ifNotNil: [ [ aBlock value: file ] ensure: [ file close ] ]

newFileNamed: aName do: aBlock 
	&#124; file &#124;
	file := self newFileNamed: aName.
	^ file 
		ifNil: [ nil ]
		ifNotNil: [ [ aBlock value: file ] ensure: [ file close ] ]

oldFileNamed: aName do: aBlock 
	&#124; file &#124;
	file := self oldFileNamed: aName.
	^ file 
		ifNil: [ nil ]
		ifNotNil: [ [ aBlock value: file ] ensure: [ file close ] ]

readOnlyFileNamed: aString
	&#124; strm &#124;
	strm := self on: (FileStream readOnlyFileNamed: aString).
	strm byteStream setFileTypeToObject.
	^ strm

readOnlyFileNamed: aName do: aBlock 
	&#124; file &#124;
	file := self readOnlyFileNamed: aName.
	^ file 
		ifNil: [ nil ]
		ifNotNil: [ [ aBlock value: file ] ensure: [ file close ] ]
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>You&#8217;re stealing too much from FileStream, you really just need to encapsulate the #close, here are my extentions to DataStream&#8230;</p>
<pre>
fileNamed: aName do: aBlock
	| file |
	file := self fileNamed: aName.
	^ file
		ifNil: [ nil ]
		ifNotNil: [ [ aBlock value: file ] ensure: [ file close ] ]

newFileNamed: aName do: aBlock
	| file |
	file := self newFileNamed: aName.
	^ file
		ifNil: [ nil ]
		ifNotNil: [ [ aBlock value: file ] ensure: [ file close ] ]

oldFileNamed: aName do: aBlock
	| file |
	file := self oldFileNamed: aName.
	^ file
		ifNil: [ nil ]
		ifNotNil: [ [ aBlock value: file ] ensure: [ file close ] ]

readOnlyFileNamed: aString
	| strm |
	strm := self on: (FileStream readOnlyFileNamed: aString).
	strm byteStream setFileTypeToObject.
	^ strm

readOnlyFileNamed: aName do: aBlock
	| file |
	file := self readOnlyFileNamed: aName.
	^ file
		ifNil: [ nil ]
		ifNotNil: [ [ aBlock value: file ] ensure: [ file close ] ]
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Davis</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-10014</link>
		<dc:creator>Aaron Davis</dc:creator>
		<pubDate>Sat, 02 Feb 2008 21:11:49 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-10014</guid>
		<description>Hello Ramon.

I have been reading your blog for a while now, and enjoy it very much.  

I have been working on an app to learn Seaside and Smalltalk recently and thought the idea in this post was great, but I have been having trouble making it work.  I am pretty new to Squeak, so it is entirely possible I am missing something obvious.

I don't think any of your code is the problem.  #takeSnapshot works, #enablePersistance works.  The problem is in #restoreRepositories in my subclass (GLDatabase).  I have a single model class (SystemInfo with class instance var 'repository', and accessor/mutator for it) until I get it working.

Here is the relevant code:

SystemInfo class&#62;&#62;repository
    respository ifNil: [self repository: #()].
    ^repository

GLDatabase class&#62;&#62;repositories
    ^Array with: (SystemInfo repository)

GLDatabase class&#62;&#62;restoreRepositories: someRespositories
    SystemInfo repository: (someRepositories first)

I should note that I had to copy several methods (#concreteStream, #detectFile:do:, #fullName: and #readOnlyFileNamed:) which you did not mention, in order to get the code to run.

I made a little test to figure out where the problem is:

&#124; written read &#124;
Transcript clear.
ReferenceStream newFileNamed: 'temp' do: [: f&#124; 
		written := f nextPut: #(#()).
		f flush
	].
read := ReferenceStream readOnlyFileNamed: 'temp' do: [ : f &#124; f next ].

Transcript show: 'written = '; show: written; cr;
	show: 'read = '; show: read; cr.

In my case the transcript reads:
written = #(#())
read = 

If I Ctrl-p on read, it says 'Character backspace', which explains why I was getting 'Character doesNotUnderstand: #first' error from #restoreRepositories.

I think the error is coming from #concreteStream

ReferenceStream&#62;&#62;concreteStream
	"Who should we really direct class queries to?  "
	^ MultiByteFileStream.

Am I supposed to be using a different Stream class for object serialization?

Anyway, sorry for the long comment.  I hope someone can tell me what I am doing wrong.

Thanks</description>
		<content:encoded><![CDATA[<p>Hello Ramon.</p>
<p>I have been reading your blog for a while now, and enjoy it very much.  </p>
<p>I have been working on an app to learn Seaside and Smalltalk recently and thought the idea in this post was great, but I have been having trouble making it work.  I am pretty new to Squeak, so it is entirely possible I am missing something obvious.</p>
<p>I don&#8217;t think any of your code is the problem.  #takeSnapshot works, #enablePersistance works.  The problem is in #restoreRepositories in my subclass (GLDatabase).  I have a single model class (SystemInfo with class instance var &#8216;repository&#8217;, and accessor/mutator for it) until I get it working.</p>
<p>Here is the relevant code:</p>
<p>SystemInfo class&gt;&gt;repository<br />
    respository ifNil: [self repository: #()].<br />
    ^repository</p>
<p>GLDatabase class&gt;&gt;repositories<br />
    ^Array with: (SystemInfo repository)</p>
<p>GLDatabase class&gt;&gt;restoreRepositories: someRespositories<br />
    SystemInfo repository: (someRepositories first)</p>
<p>I should note that I had to copy several methods (#concreteStream, #detectFile:do:, #fullName: and #readOnlyFileNamed:) which you did not mention, in order to get the code to run.</p>
<p>I made a little test to figure out where the problem is:</p>
<p>| written read |<br />
Transcript clear.<br />
ReferenceStream newFileNamed: &#8216;temp&#8217; do: [: f|<br />
		written := f nextPut: #(#()).<br />
		f flush<br />
	].<br />
read := ReferenceStream readOnlyFileNamed: &#8216;temp&#8217; do: [ : f | f next ].</p>
<p>Transcript show: &#8216;written = &#8216;; show: written; cr;<br />
	show: &#8216;read = &#8216;; show: read; cr.</p>
<p>In my case the transcript reads:<br />
written = #(#())<br />
read = </p>
<p>If I Ctrl-p on read, it says &#8216;Character backspace&#8217;, which explains why I was getting &#8216;Character doesNotUnderstand: #first&#8217; error from #restoreRepositories.</p>
<p>I think the error is coming from #concreteStream</p>
<p>ReferenceStream&gt;&gt;concreteStream<br />
	&#8220;Who should we really direct class queries to?  &#8221;<br />
	^ MultiByteFileStream.</p>
<p>Am I supposed to be using a different Stream class for object serialization?</p>
<p>Anyway, sorry for the long comment.  I hope someone can tell me what I am doing wrong.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Claus</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9911</link>
		<dc:creator>Claus</dc:creator>
		<pubDate>Wed, 30 Jan 2008 20:28:21 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9911</guid>
		<description>Hello Ramon,

I like the idea very much - it is a bit more sophisticated that the simple ObjectFiler approach I am using in two of my (rather simple but handy) VSE programs. The absence of a backup is a bit annoying therem so I am thinking of adding something of your approach to that.

About the JPA poster: yes, it is interesting, but certainly overblown (as all J2EE stuff) for anything but real enterprise applications. And most even mid-sized companies simply do not need that.

Greetings from Germany,
Claus</description>
		<content:encoded><![CDATA[<p>Hello Ramon,</p>
<p>I like the idea very much - it is a bit more sophisticated that the simple ObjectFiler approach I am using in two of my (rather simple but handy) VSE programs. The absence of a backup is a bit annoying therem so I am thinking of adding something of your approach to that.</p>
<p>About the JPA poster: yes, it is interesting, but certainly overblown (as all J2EE stuff) for anything but real enterprise applications. And most even mid-sized companies simply do not need that.</p>
<p>Greetings from Germany,<br />
Claus</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cdrick</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9905</link>
		<dc:creator>cdrick</dc:creator>
		<pubDate>Wed, 30 Jan 2008 18:20:48 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9905</guid>
		<description>Sophie, you can also use pier and the blog component... I found it works great and is robust (http://lukas-renggli.ch/blog). Maybe you'll have to spend a bit more time to setup the pier instance (even not sure), but it's 100% smalltalk. You can use seasidehosting.st or your personal box for hosting.

Excellent post Ramon, one of my prefered...
Thanks a lot :)</description>
		<content:encoded><![CDATA[<p>Sophie, you can also use pier and the blog component&#8230; I found it works great and is robust (http://lukas-renggli.ch/blog). Maybe you&#8217;ll have to spend a bit more time to setup the pier instance (even not sure), but it&#8217;s 100% smalltalk. You can use seasidehosting.st or your personal box for hosting.</p>
<p>Excellent post Ramon, one of my prefered&#8230;<br />
Thanks a lot :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9875</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Tue, 29 Jan 2008 03:21:21 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9875</guid>
		<description>Don't wait till you get confident, you'll rob readers of going through the learning experience with you because you'll forgot what things you got stuck on.  I use Wordpress on my own Linux server, no need to reinvent the wheel, but you can start up a blog in minutes on wordpress.com and move it later if you ever get your own thing going.</description>
		<content:encoded><![CDATA[<p>Don&#8217;t wait till you get confident, you&#8217;ll rob readers of going through the learning experience with you because you&#8217;ll forgot what things you got stuck on.  I use Wordpress on my own Linux server, no need to reinvent the wheel, but you can start up a blog in minutes on wordpress.com and move it later if you ever get your own thing going.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sophie</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9873</link>
		<dc:creator>Sophie</dc:creator>
		<pubDate>Tue, 29 Jan 2008 00:18:49 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9873</guid>
		<description>Thanks for the clarification on serialization. On blogging ... not quite confident yet, not ready with infrastructure (what do you blog with?)

Sophie</description>
		<content:encoded><![CDATA[<p>Thanks for the clarification on serialization. On blogging &#8230; not quite confident yet, not ready with infrastructure (what do you blog with?)</p>
<p>Sophie</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9866</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Mon, 28 Jan 2008 02:32:21 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9866</guid>
		<description>Yea, it was your trying to use image persistence that made me decide to share this, it was already available in my image, but I figured a post about it would be better.

As for changing your classes (schema), it's serialization, so just don't change your class names and lazily initialize your instance variables in their accessors and you're golden.  New instance vars will be nil by default and get a value on first access, and inst vars you remove will just disappear.  

However, since all the data is stored in the image anyway, you can just live upgrade the code and save a fresh backup and not worry so much about restoring old data.  The backups are just that, backups, just in case, the real objects live in the image.

You can use Sixx streams instead of Ref streams if you prefer XML to a binary format, but it's a lot slower, and you get much larger snapshot file sizes, so it won't scale nearly as well as Ref streams.

Sophie, you've been very active on the list, you seem to have learned a lot, any chance you'll take the plunge and start another Seaside blog?</description>
		<content:encoded><![CDATA[<p>Yea, it was your trying to use image persistence that made me decide to share this, it was already available in my image, but I figured a post about it would be better.</p>
<p>As for changing your classes (schema), it&#8217;s serialization, so just don&#8217;t change your class names and lazily initialize your instance variables in their accessors and you&#8217;re golden.  New instance vars will be nil by default and get a value on first access, and inst vars you remove will just disappear.  </p>
<p>However, since all the data is stored in the image anyway, you can just live upgrade the code and save a fresh backup and not worry so much about restoring old data.  The backups are just that, backups, just in case, the real objects live in the image.</p>
<p>You can use Sixx streams instead of Ref streams if you prefer XML to a binary format, but it&#8217;s a lot slower, and you get much larger snapshot file sizes, so it won&#8217;t scale nearly as well as Ref streams.</p>
<p>Sophie, you&#8217;ve been very active on the list, you seem to have learned a lot, any chance you&#8217;ll take the plunge and start another Seaside blog?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sophie</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9865</link>
		<dc:creator>Sophie</dc:creator>
		<pubDate>Mon, 28 Jan 2008 01:11:26 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9865</guid>
		<description>Great post, I've already started using this thanks to you Ramon.

One thing you might want to mention --- I don't' know how ReferenceStreams handle changes to schema, in case you change things between save &#38; restore. Could also mention SixxReadStream and SixxWriteStream as a (probably slower) option that might handle some schema changes a bit better.</description>
		<content:encoded><![CDATA[<p>Great post, I&#8217;ve already started using this thanks to you Ramon.</p>
<p>One thing you might want to mention &#8212; I don&#8217;t&#8217; know how ReferenceStreams handle changes to schema, in case you change things between save &amp; restore. Could also mention SixxReadStream and SixxWriteStream as a (probably slower) option that might handle some schema changes a bit better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hiren</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9771</link>
		<dc:creator>Hiren</dc:creator>
		<pubDate>Thu, 17 Jan 2008 18:30:39 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9771</guid>
		<description>Ofcourse i do realize that. 
But sometimes you can find pleasent surprices in Java also.
I mentioned JPA only because it is something different than everything else in wild J2EE land. Simple like Smalltalk. 
However i do not have any idea how complex its implementation is.</description>
		<content:encoded><![CDATA[<p>Ofcourse i do realize that.<br />
But sometimes you can find pleasent surprices in Java also.<br />
I mentioned JPA only because it is something different than everything else in wild J2EE land. Simple like Smalltalk.<br />
However i do not have any idea how complex its implementation is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter William Lount</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9766</link>
		<dc:creator>Peter William Lount</dc:creator>
		<pubDate>Thu, 17 Jan 2008 11:13:17 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9766</guid>
		<description>Very nice solution, elegant and simple yet not simplistic - leading to a potent empowerment for developers applications - desk, server, web, client, remote, autonomous, or embedded. Sweet. Keep up the excellent work Ramon.

Now if there was only a way to snapshot only those objects in the image that have changed since the last snapshot or "checkpoint". In a way a "bulk" transaction without the bulk of saving each and every object each and every snapshot. Hey if it hasn't changed the prior checkpoints or snapshots should have it - as long as you never delete the most recent FULL snapshot.</description>
		<content:encoded><![CDATA[<p>Very nice solution, elegant and simple yet not simplistic - leading to a potent empowerment for developers applications - desk, server, web, client, remote, autonomous, or embedded. Sweet. Keep up the excellent work Ramon.</p>
<p>Now if there was only a way to snapshot only those objects in the image that have changed since the last snapshot or &#8220;checkpoint&#8221;. In a way a &#8220;bulk&#8221; transaction without the bulk of saving each and every object each and every snapshot. Hey if it hasn&#8217;t changed the prior checkpoints or snapshots should have it - as long as you never delete the most recent FULL snapshot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9750</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Wed, 16 Jan 2008 22:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9750</guid>
		<description>You do realize this is a Smalltalk site right?  I wouldn't touch Java with a ten foot pole, it's a horrible language built to enslave programmers and turn them into cogs in the giant corporate wheels of big companies who don't care about them.</description>
		<content:encoded><![CDATA[<p>You do realize this is a Smalltalk site right?  I wouldn&#8217;t touch Java with a ten foot pole, it&#8217;s a horrible language built to enslave programmers and turn them into cogs in the giant corporate wheels of big companies who don&#8217;t care about them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hiren</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9746</link>
		<dc:creator>Hiren</dc:creator>
		<pubDate>Wed, 16 Jan 2008 19:09:20 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9746</guid>
		<description>Ramon have you had look at Java Persistence API (JPA) ? 
It is very simple to use. It is really worth using.
Best articles to get started with JPA are:
&lt;a href="http://today.java.net/pub/a/today/2006/05/23/ejb3-persistence-api-for-client-side-developer.html" rel="nofollow"&gt;ejb3-persistence-api-for-client-side-developer&lt;/a&gt;
and
&lt;a href="http://today.java.net/pub/a/today/2006/06/08/more-ejb3-persistence-api-for-client-side-developer.html" rel="nofollow"&gt;more-ejb3-persistence-api-for-client-side-developer&lt;/a&gt;

Otherwise most documentation of JPA is so rubbish that i stayed away from learning JPA for one week. (Specially Sun's official Java EE Tutorial).</description>
		<content:encoded><![CDATA[<p>Ramon have you had look at Java Persistence API (JPA) ?<br />
It is very simple to use. It is really worth using.<br />
Best articles to get started with JPA are:<br />
<a href="http://today.java.net/pub/a/today/2006/05/23/ejb3-persistence-api-for-client-side-developer.html" rel="nofollow">ejb3-persistence-api-for-client-side-developer</a><br />
and<br />
<a href="http://today.java.net/pub/a/today/2006/06/08/more-ejb3-persistence-api-for-client-side-developer.html" rel="nofollow">more-ejb3-persistence-api-for-client-side-developer</a></p>
<p>Otherwise most documentation of JPA is so rubbish that i stayed away from learning JPA for one week. (Specially Sun&#8217;s official Java EE Tutorial).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vladimir Joy</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9729</link>
		<dc:creator>Vladimir Joy</dc:creator>
		<pubDate>Tue, 15 Jan 2008 23:30:33 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9729</guid>
		<description>Have just enjoyed it.

It's all we all just need. Just simple persistence.</description>
		<content:encoded><![CDATA[<p>Have just enjoyed it.</p>
<p>It&#8217;s all we all just need. Just simple persistence.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9728</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Tue, 15 Jan 2008 23:24:24 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9728</guid>
		<description>Thanks, glad you enjoyed the code!</description>
		<content:encoded><![CDATA[<p>Thanks, glad you enjoyed the code!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Randal L. Schwartz</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9721</link>
		<dc:creator>Randal L. Schwartz</dc:creator>
		<pubDate>Tue, 15 Jan 2008 17:59:28 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9721</guid>
		<description>Wonderful article.  My comments (including a fun graphic) are at http://methodsandmessages.vox.com/library/post/ramon-on-keep-it-simple-persistence.html</description>
		<content:encoded><![CDATA[<p>Wonderful article.  My comments (including a fun graphic) are at <a href="http://methodsandmessages.vox.com/library/post/ramon-on-keep-it-simple-persistence.html" rel="nofollow">http://methodsandmessages.vox.com/library/post/ramon-on-keep-it-simple-persistence.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Mitchell</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9718</link>
		<dc:creator>David Mitchell</dc:creator>
		<pubDate>Tue, 15 Jan 2008 15:04:38 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9718</guid>
		<description>Hey Ramon, great article. Added a link from the squeak wiki:
http://wiki.squeak.org/squeak/512</description>
		<content:encoded><![CDATA[<p>Hey Ramon, great article. Added a link from the squeak wiki:<br />
<a href="http://wiki.squeak.org/squeak/512" rel="nofollow">http://wiki.squeak.org/squeak/512</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9717</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Tue, 15 Jan 2008 14:57:58 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9717</guid>
		<description>Yea, Paolo's right, that should be in an initialize, however, it's a one time event that you pretty much trigger yourself while setting up and testing your repository.  So the likelihood of multiple processes hitting this is virtually nil.

Being a class instance variable, I can't use initialize since that'd initialize this superclasses lock rather than the subclasses required to use it.  Each subclass has it's own lock.  I didn't want every subclass to have to initialize it, so I chose this method given the insanely low chance you'd ever have a nil by the time you put it under multiple processes.

Thinking about it... maybe this is why some people prefer using an instance as a singleton rather than using the class instance itself, easier to initialize.</description>
		<content:encoded><![CDATA[<p>Yea, Paolo&#8217;s right, that should be in an initialize, however, it&#8217;s a one time event that you pretty much trigger yourself while setting up and testing your repository.  So the likelihood of multiple processes hitting this is virtually nil.</p>
<p>Being a class instance variable, I can&#8217;t use initialize since that&#8217;d initialize this superclasses lock rather than the subclasses required to use it.  Each subclass has it&#8217;s own lock.  I didn&#8217;t want every subclass to have to initialize it, so I chose this method given the insanely low chance you&#8217;d ever have a nil by the time you put it under multiple processes.</p>
<p>Thinking about it&#8230; maybe this is why some people prefer using an instance as a singleton rather than using the class instance itself, easier to initialize.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paolo Bonzini</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9713</link>
		<dc:creator>Paolo Bonzini</dc:creator>
		<pubDate>Tue, 15 Jan 2008 10:23:22 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9713</guid>
		<description>Yes, better to use early initialization.</description>
		<content:encoded><![CDATA[<p>Yes, better to use early initialization.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Damien Cassou</title>
		<link>http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9711</link>
		<dc:creator>Damien Cassou</dc:creator>
		<pubDate>Tue, 15 Jan 2008 08:06:43 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/simple-image-based-persistence-in-squeak/#comment-9711</guid>
		<description>Hi,

very interesting post. Thank you.

I have a doubt about your #saveRepository method.

saveRepository
  lock ifNil: [ lock := Semaphore forMutualExclusion ].
  lock critical: [...]

Imaging two process enter the method at the same time and lock is nil. They will both come into the #ifNil: block. Imagine the first process assign the instance variable lock and enter the #critical: block. Then, the second process override the instance variable and I don't see anything preventing it from entering the #critical: block because the lock is not the same. What do you think?

Bye</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>very interesting post. Thank you.</p>
<p>I have a doubt about your #saveRepository method.</p>
<p>saveRepository<br />
  lock ifNil: [ lock := Semaphore forMutualExclusion ].<br />
  lock critical: [...]</p>
<p>Imaging two process enter the method at the same time and lock is nil. They will both come into the #ifNil: block. Imagine the first process assign the instance variable lock and enter the #critical: block. Then, the second process override the instance variable and I don&#8217;t see anything preventing it from entering the #critical: block because the lock is not the same. What do you think?</p>
<p>Bye</p>
]]></content:encoded>
	</item>
</channel>
</rss>
