Squeak newbie questions

Ned Konz ned at bike-nomad.com
Fri Mar 9 03:33:02 UTC 2001


On Thursday 08 March 2001 15:58, simon.bates at hushmail.com wrote:
> While I feel like I have a grasp of the Smalltalk programming language and
> programming environment I think that I am not really grasping some of how
> to use Squeak as a user environment, particularly the image.
> By "user environment" I mean the environment I use to perform tasks
> using a computer, such as writing documentation,
> browsing the web, reading and writing email, drawing pictures, etc. At the
> level of program usage and program interaction I am used to thinking in
> terms of data files and
> programs that operate on data files. Before discovering Smalltalk I had
> done object
> oriented programming in Java and C++. However, when using these languages
> I still built
> programs that operated on data files. I am not used to working in a system
> which is object
> oriented on all scales.

Objects don't get rid of files. Keep in mind that the image can be relatively 
fragile; it's possible to get all kinds of cruft in it, to save it in an 
unstable state, etc. Don't keep anything precious _just_ in an image. That's 
why there are so many methods in the system that read and write stuff from 
and to disk.

The ImageSegments may help with keeping parts of the image stored on disk, 
but I haven't used them yet. I'm sure others (especially Alan Kay) could 
chime in here.

If you have lots of long-lived data, much of which is just "plain old data", 
it may make sense to leave it in the same sorts of files you're used to. This 
includes the possibility of using databases (PostgreSQL and MySQL interfaces 
are available), XML (several available), compressed gzip, PKZIP archives, 
several image file formats, Flash, HTML, as well as, I'm sure, several I 
can't remember right now. The CrLfFileStream will help with plain-old-text 
files in your native CR/LF format.

Or run a Swiki; this will provide a Smalltalk-accessible, externally-stored, 
robust world that can be accessed from your LAN via regular browsers. There 
is the PWS web server built in to Squeak, as well as a Swiki, or you can use 
Comanche and ComSwiki from Georgia Tech.

> I thought that the above might help to give some context to my questions.
>
> 1. How should I distribute data between inside the image and on the host
> filing system?
>
> For example, if I want to write a photo album browser Morph for viewing
> my digital
> photos in Squeak. Do I store the photos primarily on the host filing system
> or do I file
> them all into my Squeak image? Filing all the photos in will make the image
> very large
> but is this normal and should I rely on virtual memory to swap data between
> RAM and
> the hard disk?

You should probably leave any photos you're not actively using on disk.

> 2. How should I organize instances of objects within the image?
>
> I understand that I can have variables local to a Workspace and that
> instances of Morphs
> are accessible through their GUI but how do I access an instance of an
> object across
> multiple Workspaces or Projects?

You can use global flaps for this in Morphic. You could put buttons on these 
that launch the appropriate windows or open the given Morphs in the current 
world. Look at the several kinds of ButtonMorphs.

If you're just looking for ways to get copies of templates, use a global flap 
or a part of one as a parts bin. You drop templates of things you're going to 
use a lot there, then just drag off copies.

Or globals (as you suggest), including having classes keep track of them:
	Notebook current.
	Notebook named: 'whatever'.
assuming you have a Notebook class.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com





More information about the Squeak-dev mailing list