basic patterns for persistence

Randal L. Schwartz merlyn at stonehenge.com
Thu Feb 15 20:14:09 UTC 2001


OK, I have a compelling need to track hours spent on a project for the
first time in a few years.  I have this old rusty hypercard stack
(modified to have a 'save as text') that I had formerly used, and I
think it's about time to hack the same thing in Squeak instead.  So I
have (ta da) my first Real Project in Squeak(tm).

I think TimeTracker and TimeTrackedItem sound like the two most
natural classes for this.  So I create TimeTracker as a subclass of
Morph, I suspect.  Or should it be a subclass of SystemWindow?  And is
a TimeTrackedItem on the screen as a submorph?  Does it have to be
within the parent's bounding rectangle?

Or do I even need classes?  Can I just hack a morph adding specific
behavior/data?  I know... that's the VB approach. :)

Presuming I'm using classes, where does the class code get stored?  Do
I make a project, build it there, then fileout the project from time
to time?  And then what about the data?  Should the class itself know
how to store to a file (and if so, how?), or should I just use "save
morph on file" to save the data?  And if I "save morph", but then
alter the class to add additional behavior, will the restored morph
become one of the new class instances, or somehow stay one of the old
ones?  And does "save morph" also save all the live submorphs?

I know this is probably all too basic to discuss on this list, but if
someone would prod me in the right direction, I'm going for it.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!





More information about the Squeak-dev mailing list