Skip to content
Tutorials Center
My learning

Topics

Smalltalk Tutorial

Learn Smalltalk step by step: 38 lessons in 9 chapters with examples, quizzes, diagrams and projects.

Start learning →

of lessons completed

Getting Started

  1. 1 What Is Smalltalk? A Pure Object Language and Living System Meet Smalltalk: the pure object-oriented language where everything is an object and every action is a message. Learn its history, its living-image idea and how it shaped modern languages.
  2. 2 Installing Pharo and a Tour of the Smalltalk Environment Install Pharo with the Pharo Launcher, understand VM, image and changes files, and take a guided tour of the World menu, Playground, System Browser, Inspector and Debugger.
  3. 3 Playground and Your First Smalltalk Programs Write your first Smalltalk programs in the Pharo Playground: evaluate expressions, use temporary variables, print to the Transcript and inspect results, then build a small greeting and a counter.
  4. 4 Everything Is an Object in Smalltalk: Numbers, Booleans, nil, Classes See why Smalltalk has no primitives: integers, fractions, booleans, nil, blocks and even classes are objects. Learn class, isKindOf:, respondsTo: and the object hierarchy from Object down.

Syntax and Messages

  1. 5 Smalltalk Syntax on a Postcard: Literals, Comments and Keywords Learn the complete Smalltalk syntax: number, character, string, symbol and array literals, comments, statements, the six reserved words, and how to read a line of Smalltalk code.
  2. 6 Unary, Binary and Keyword Messages and Precedence in Smalltalk Understand the three kinds of Smalltalk messages and their precedence rules: unary first, binary next, keyword last, left to right. Learn when parentheses are needed and avoid the common traps.
  3. 7 Cascades, Assignment and Statements in Smalltalk Use Smalltalk cascades to send several messages to one receiver, understand yourself, chained assignment, statement values and returns, and write clear multi-line code with good layout.
  4. 8 Control Flow with Messages: ifTrue:, whileTrue:, to:do: in Smalltalk Smalltalk has no if or for keywords. Learn conditionals, loops, ifNil:, and:/or:, to:do:, timesRepeat:, whileTrue: and early exit, all expressed as messages that take blocks.
  5. 9 Variables, Scope and Pseudo-variables in Smalltalk Learn the kinds of Smalltalk variables (temporaries, arguments, instance, class and global variables), their scope rules, and the pseudo-variables self, super, nil, true, false and thisContext.

Classes and Objects

  1. 10 Defining Classes and Methods in Pharo Smalltalk Create your first Pharo class with the fluid class definition syntax, add instance variables and methods in the System Browser, write accessors, and understand method categories and the Class >> selector notation.
  2. 11 Initialize and Creating Instances in Smalltalk: new, Constructors Learn how Pharo creates objects: new calls initialize, how to write class-side instance creation methods like owner:, validate arguments, and avoid the classic trap of overriding new.
  3. 12 Inheritance, super and Polymorphism in Smalltalk Understand Smalltalk single inheritance, method lookup, overriding, super, abstract methods with subclassResponsibility, and polymorphism with a shapes example you can follow and run as a JavaScript stand-in.
  4. 13 Class Side, Class Variables and printOn: in Smalltalk Learn the class side of a Smalltalk class: class methods, class variables, class-side instance variables, singletons, and how printOn:, displayString and storeOn: control how objects are shown.

Collections and Blocks

  1. 14 Blocks and Closures in Smalltalk: value, Parameters, Non-local Return Master Smalltalk blocks: anonymous code you can store and run later with value, parameters, captured variables, non-local return, ensure: and ifCurtailed:, and how blocks power every control structure.
  2. 15 Arrays and Ordered Collections in Smalltalk Work with Smalltalk sequences: Array, OrderedCollection, Interval and SortedCollection. Create, access, add, remove, search, slice and copy elements, with the 1-based indexing rules and common errors.
  3. 16 Dictionaries, Sets and Bags in Smalltalk Use Smalltalk's unordered collections: Dictionary and Association, Set, Bag and IdentityDictionary. Learn at:put:, at:ifAbsent:, keysAndValuesDo:, counting with Bag and how = and hash decide membership.
  4. 17 Iteration and Enumeration in Smalltalk: do:, collect:, select:, inject:into: Master the Smalltalk enumeration protocol: do:, collect:, select:, reject:, detect:, inject:into:, anySatisfy:, with:do:, groupedBy: and sorting with blocks, and learn to build your own iterators.
  5. 18 Strings, Symbols and Streams in Smalltalk Work with text in Smalltalk: String, Symbol and Character, concatenation, searching, splitting, formatting, and efficient building with ReadStream and WriteStream, including streams on collections.

Reflection and Metaclasses

  1. 19 Reflection and Introspection Learn how Smalltalk objects inspect themselves at run time: class, respondsTo:, selectors, instance variables and perform:. Real code is read-only; runnable JavaScript stand-ins show each idea.
  2. 20 Classes Are Objects and Metaclasses Understand why every Smalltalk class is an object, what a metaclass is, how class-side methods and class-side instance variables work, and walk the class hierarchy with runnable JavaScript stand-ins.
  3. 21 doesNotUnderstand: and Proxies Learn how Smalltalk handles unknown messages with doesNotUnderstand:, and use it to build proxies, loggers and null objects. Real code is read-only; JavaScript Proxy stand-ins run here.
  4. 22 thisContext and the Execution Stack See how Smalltalk makes the call stack an ordinary object: thisContext, sender chains, stack traces, and how the debugger can restart or change running code. Runnable JavaScript stand-ins included.

Tools and Image Workflow

  1. 23 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.
  2. 24 The Inspector, Debugger and Playground Learn the core Pharo tools: the Playground for experiments, the Inspector for looking inside objects, and the Debugger for fixing code live. Runnable JavaScript stand-ins model each idea.
  3. 25 Monticello, Iceberg and Git Learn how Smalltalk code is versioned: Monticello packages and snapshots, Iceberg and Git in Pharo, Tonel files, commits, branches and merges. Real tools are read-only; a runnable diff stand-in is included.
  4. 26 Metacello, Baselines and Package Loading Learn how Smalltalk projects declare packages, dependencies and groups with Metacello baselines, load them reproducibly, and run them in CI. Read-only Smalltalk plus a runnable dependency-resolver stand-in.

Testing and Patterns

  1. 27 Testing with SUnit Learn SUnit, the original xUnit framework: TestCase classes, setUp, assertions, expected failures, test resources and running tests in Pharo. Includes a runnable JavaScript mini-framework stand-in.
  2. 28 Test-Driven Development in the Debugger Follow the Smalltalk test-driven loop: write a failing test, let the debugger create missing methods, make it green, refactor. Worked example in read-only Smalltalk plus a runnable JavaScript simulation.
  3. 29 Design Patterns in Smalltalk See how classic design patterns look in Smalltalk, where blocks and polymorphism often replace boilerplate: Strategy, State, Command, Template Method, Visitor and Null Object, with runnable JavaScript stand-ins.
  4. 30 Announcements and Observers Learn the Pharo Announcements framework: Announcer, Announcement classes, subscriptions, unsubscribing and weak references, and how it replaces the older dependents mechanism. Runnable JavaScript stand-in included.

Web and Applications

  1. 31 Seaside: Web Components and Callbacks Learn how Seaside builds web applications as Smalltalk objects: components, renderOn:, the canvas, callbacks, call and answer flow, and sessions. Real code is read-only; a runnable JavaScript stand-in shows the model.
  2. 32 Teapot and Zinc: HTTP Services Learn Zinc, Pharo's HTTP client and server, and Teapot, a small routing layer for REST APIs: GET and POST routes, path parameters, JSON, status codes. Read-only Smalltalk plus a runnable router stand-in.
  3. 33 Persistence with Fuel and Databases Compare ways to keep Smalltalk objects after a restart: the image, Fuel binary serialization, STON and JSON text, Voyage with MongoDB, and SQL. Read-only Smalltalk plus runnable serialization stand-ins.
  4. 34 Morphic and Spec: User Interfaces Learn the two Pharo GUI layers: Morphic, a direct-manipulation world of live morphs, and Spec, a declarative presenter-based toolkit for applications. Read-only Smalltalk and runnable JavaScript stand-ins.

Projects and Practice

  1. 35 Project: Build a Mini SUnit Build a small xUnit framework step by step, the way Kent Beck did in Smalltalk: TestCase, TestResult, TestSuite, setUp and tearDown, with a runnable JavaScript implementation and the matching Smalltalk shape.
  2. 36 Project: A Text Adventure Engine Model rooms, items, a player and commands as collaborating objects, the Smalltalk way. Build a runnable text adventure engine in JavaScript with polymorphic commands, a world graph and tests.
  3. 37 Project: A Smalltalk Message Interpreter Build a small interpreter for Smalltalk-style expressions in JavaScript: a tokenizer, a parser for unary, binary and keyword messages with the right precedence, and an evaluator with blocks. Runs in your browser.
  4. 38 Practice: Smalltalk Exercises Twelve graded Smalltalk exercises on messages, blocks, collections, classes, reflection and tests. Read the Smalltalk solutions, then check the ideas with runnable JavaScript stand-ins.