Skip to content
Tutorials Center
My learning

Topics

Lesson 23 of 38 ยท Tools and Image Workflow

The Image, the Changes File and the Sources File

Understand the Smalltalk image-based workflow: the VM, image, changes and sources files, saving and snapshotting, recovering lost work, and why this differs from file-based languages.

Most programmers write source files, compile them and run a fresh process each time. Smalltalk works differently. You start a virtual machine (VM) and load an image, a snapshot of every object in a running system: classes, methods, windows, the debugger, even your half-finished work. You change the live objects, and when you quit you may save a new snapshot. Programming is closer to editing a running world than to building a program from text.

This lesson explains the files you meet in Pharo or Squeak, how saving works, how to recover work after a crash, and how the image workflow shapes everyday habits. Smalltalk is not available on this site, so file listings and commands are read-only. A JavaScript stand-in at the end models a tiny image with a change log so you can feel the mechanics.

The four files

A typical installation has these pieces (names differ slightly between dialects):

File What it holds
VM (pharo, Squeak.exe) The native program that runs bytecode. It knows nothing about your code.
Pharo.image A memory snapshot: all objects, compiled methods, open windows, the current selection.
Pharo.changes An append-only log of every change you made: each method you accepted, each class you defined, each do-it you ran.
Pharo.sources Source text of the standard library, shared and read-only. Compiled methods in the image point into it.

Compiled methods keep only a small pointer to their source. The text for the system classes lives in .sources, and the text for your own methods lives in .changes. That keeps the image small and keeps your edits recoverable.

flowchart LR
  VM["VM<br/>native program"] -->|"loads"| IMG["image<br/>live objects"]
  IMG -->|"source pointers"| SRC["sources<br/>library text"]
  IMG -->|"source pointers"| CHG["changes<br/>your edits, append-only"]
  YOU["you, in the browser"] -->|"accept a method"| IMG
  YOU -->|"every accept also appends"| CHG

Accepting a method updates the live image and appends the source to the changes file.

Saving and snapshotting

Save writes the current object memory to the image file. After that, reopening the image brings you back exactly as you left it, including open tools. Save as gives the snapshot a new name, which is a cheap way to branch your whole environment. Quit without saving throws away everything since the last snapshot, but the changes file still remembers your accepted methods.

In a workspace you can also snapshot from code (read-only):

SMALLTALK
Smalltalk snapshot: true andQuit: false.   "save the image now"
Smalltalk imageName.                        "path of the current image"
Smalltalk vm version.                       "what VM runs it"

Recovering from a crash

Because every accepted edit is appended to the changes file as it happens, a crash rarely loses work. Reopen the last saved image, then open the Recover lost changes tool (in Squeak, from the world menu; in Pharo, through the changes browser). It lists every change after the last snapshot and lets you file in the ones you want. Edits that were never accepted (still in an open editor) are not logged, so accept often.

A related trick: because the changes file is plain text, you can read it in any editor. It looks like chunk-format source (read-only):

SMALLTALK
!Account methodsFor: 'testing' stamp: 'AB 11/4/2026 10:12'!
isOverdrawn
    ^ balance < 0! !

The ! characters separate chunks. Each chunk records the class, the category (protocol), the author's initials and the time.

What image-based development changes

  • No restart loop. Editing a method takes effect immediately in objects that already exist. You can fix a bug and keep the data that triggered it.
  • State is precious. Objects you build by hand in the playground survive until you quit. That is powerful for exploration, but it also hides bugs that only show up on a fresh start. Rebuild from a clean image before you ship.
  • Source control is separate. The image is binary and personal. Share code through packages and a version-control tool such as Git, covered in Monticello, Iceberg and Git, not by sending images around.
  • A clean build. Teams keep a script that starts from a fresh image, loads a baseline of packages and runs the tests. That is the equivalent of a clean checkout.

A tiny image in JavaScript

This stand-in is not Smalltalk, but it models the mechanics: a live object store (the image), an append-only change log, a snapshot, and recovery after a crash.

JS Stand-in: image, change log and recovery

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The change log is the safety net: it records each accepted edit even though the snapshot is older.

JS Stand-in: two images from one starting point

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Next you will meet the tools that work on this live system: the inspector, debugger and playground.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the changes file contain?

    Each accepted method or class definition is appended, which makes recovery after a crash possible.
  2. 2. What is the image?

    The image stores the whole object memory, so reopening it restores the exact running state.
  3. 3. Why should you rebuild from a clean image before shipping?

    A clean build proves the packages, not your leftover objects, produce a working system.
  4. 4. How should teams share Smalltalk code?

    Images are binary and personal, so code is shared as packages under version control.

Summary

  • A Smalltalk system is a VM plus an image (live objects), a changes file (your edits) and a sources file (library text).
  • Accepting a method changes the live system and logs the edit; saving writes a new snapshot.
  • After a crash, reopen the last image and recover logged changes.
  • Hand-built state is convenient but must be proven against a clean build.
  • The JavaScript snippets are stand-ins; commands and file listings are read-only.

Next: The Inspector, Debugger and Playground