basic patterns for persistence

Doug Way dway at riskmetrics.com
Fri Feb 16 00:50:18 UTC 2001


"Randal L. Schwartz" wrote:
> ...
> 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?

Another option is to create TimeTrackerMorph as a subclass of Morph, and then embed that inside a SystemWindow, if you like the titlebar controls that windows have.

Kind of like:

atoms _ BouncingAtomsMorph new.
window _ SystemWindow new.
window addMorph: atoms frame: (0 at 0 corner: 1 at 1).
window openInWorld.

except substitute your TimeTrackerMorph for BouncingAtomsMorph.

For more help on GUI ideas, you might want to look at the GUI Building Tools page on the Swiki:

http://minnow.cc.gatech.edu/squeak/guiBuildingTools

Using one of these tools might be overkill for what you want to do, but you might be able to steal ideas from them.  (Also, the BobsUI tool would probably need to be rewritten for Squeak 3.0, since it subclassed its widgets from AlignmentMorph, which is now gone.  (Its functionality is now in all morphs, which is a good thing.))

> 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?

I tend to just fileout the current changeset before I quit Squeak as a representation of my "program", e.g. TimeTracker.1.cs.  (While I'm working, I save the image occasionally in case anything goes terribly wrong inside or outside of Squeak.  Although you can usually rebuild things from the changelog without too much trouble if something goes awry.)

- Doug Way
  dway at riskmetrics.com





More information about the Squeak-dev mailing list