[Newbies] Feedback: Using Output as the Next Input

Ralph Johnson johnson at cs.uiuc.edu
Fri May 1 10:29:10 UTC 2015


There is no best way.  There are many different ways, each with advantages
and disadvantages.

Suppose you have a workspace that makes some objects and stores them in
workspace variables.   The workspace contains a lot of different
expressions that use these variables.  Some of the expressions might assign
to one of the variables, some might use them to change the objects stored
in the variables, some might pop up windows on the variables, etc.   You
use the workspace by selecting expressions and executing them.   You can
run the expressions in any order, of course, though often some of them
assume that variables have been initialized.

If you do this, you can use your image as a database.   You can save your
image any time you want, and when you restart it, you will be right back
where you left off.  All the workspace variables will have the same values
they did before.  All the same windows will be up.   Of course, if your
machine (or image) crashes then you have to restore the last save, and you
lose the work you did since then.   A bigger problem is that the data is
hard to give to someone else.  You'd have to give him your entire image.
This is a good way to save data when you are in the initial process of
developing your program.  But once you get into the phase where you are
using your program to analyze a lot of different data, you probably want a
way of storing data to files.

There are lots of ways of storing data to files.  You could store it as XML
or CSVs.  You could store it in a relational database.   The simplest way
of storing it is as serialized objects.  The other ways of storing data to
files require figuring out how to map objects to the data format that you
pick, while serializing objects lets you avoid that work.  On the other
hand, it can only be read back by other images.

Since you are seem to be learning Smalltalk, I would suggest doing
everything in a workspace at first, and using your image as a database.
This will force you to learn Smalltalk faster.   When you think you
understand it, come back and ask us about all the problems of using an
image as a database.

-Ralph Johnson


On Thu, Dec 4, 2014 at 4:14 PM, Dan <dnorton at mindspring.com> wrote:

> Howdy,
>
> A class is instantiated and produces output in a data structure (array,
> collection, dictionary,
> ...). Upon each later (maybe months later) instantiation, the previous
> output is needed as
> input. What is the best way to do this for modest (not huge) output? Some
> possibilities:
>     Externally - file out and file in
>     Within the class - compile class methods containing the output; save
> with Montecello
>
> I'm interested in how to dynamically compile a class method. Can Browser
> be invoked
> dynamically? In studying Browser and friends, it looks complicated. Am I
> missing something
> or attempting something foolish or ...?
>
> - Dan
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20150501/25808bd7/attachment-0001.htm


More information about the Beginners mailing list