[Newbies] Very Basic Squeak information

Ralph Johnson johnson at cs.uiuc.edu
Mon Nov 20 20:54:16 UTC 2006

> - Where does the source code go?  I used the workspace window to test the
> objects I created (and others), but where do I put the main program logic so
> that I can execute the program at will?  Just use workspace window like I
> was doing? Are there other methods?

You should use the browser to define and edit classes.  Perhaps this
is what you mean by "workspace" though in Smalltalk the workspace is
just a text editor that lets you evaluate expressions and so create
objects.  If you are looking at class definitions then the tool is
called the browser, and it is where you should start.

There is no main program in Smalltalk.  Once you understand this, you
will realize it is the right way to think about OO programming and
wonder why other langauges don't work this way, but it is a shock to
everybody when they encounter it for the first time.

Smalltalk is just objects.  There are class definitions, but no
programs.  When you look at classes in the browser, you are looking at
the code that is currently running.  It isn't a library in the sense
of code that you can decide to include in your program, it is already
in the image.  The image is all the objects that live in your world,
and some of those objects are classes and methods.  The browser lets
you examine and change them.

> - Is there such a thing as command line squeak?  Such that I can create my
> objects, then put the basic program logic in a file and fire it off from the
> command line?

Sort of.  You can create a specialized image that you can execute from
the command line.  But it isn't a text file.

> I feel as though I am missing something essential that was not made obvious
> from the documentation (or I just plain missed it).  How do you distribute a
> squeak program?  Do you always have to use the IDE environment to run the
> programs you create?

You distribute either source or images.  An image is the equivalent of
a binary form of a program.  Squeak makes it easy to distribute
source, but it is harder to distribute binaries, at least for
beginners.   Like many things, "it is easy if you know how".  Squeak
is optimized for developing programs, not for distributing them, but
obviously people who develop programs want to distribute them, too.  I
usually tell people to focus on learning how to develop programs and
by the time they know enough Smalltalk to do that, it won't be hard to
learn how to distribute them.

> What is the difference between the VM and the main GUI environment download?

The VM is a platform-specific program that runs the image.  The "main
GUI environment download" is the image.  It is portable and has most
of the complexity.  Most people don't think much about the VM and just
worry about the image.  There are a few people who make VMs for the
rest of us.

-Ralph Johnson

More information about the Beginners mailing list