Contents

Preface
1 A quick tour of Pharo
 1.1 Getting started
 1.2 The World menu
 1.3 Sending messages
 1.4 Saving, quitting and restarting a Pharo session
 1.5 Workspaces and Transcripts
 1.6 Keyboard shortcuts
 1.7 The Class Browser
 1.8 Finding classes
 1.9 Finding methods
 1.10 Defining a new method
 1.11 Chapter summary
2 A first application
 2.1 The Lights Out game
 2.2 Creating a new Package
 2.3 Defining the class LOCell
  On Categories and Packages
  Creating a new class
 2.4 Adding methods to a class
 2.5 Inspecting an object
 2.6 Defining the class LOGame
 2.7 Organizing methods into protocols
 2.8 Let’s try our code
 2.9 Saving and sharing Smalltalk code
  Monticello packages
  Saving and loading code with Monticello.
  SqueakSource : a SourceForge for Pharo.
 2.10 Chapter summary
3 Syntax in a nutshell
 3.1 Syntactic elements
 3.2 Pseudo-variables
 3.3 Message sends
 3.4 Method syntax
 3.5 Block syntax
 3.6 Conditionals and loops in a nutshell
 3.7 Primitives and pragmas
 3.8 Chapter summary
4 Understanding message syntax
 4.1 Identifying messages
 4.2 Three kinds of messages
  Unary messages
  Binary messages
  Keyword messages
 4.3 Message composition
  Parentheses first
  From left to right
  Arithmetic inconsistencies
 4.4 Hints for identifying keyword messages
  Parentheses or not?
  When to use [ ] or ( )
 4.5 Expression sequences
 4.6 Cascaded messages
 4.7 Chapter summary
5 The Smalltalk object model
 5.1 The rules of the model
 5.2 Everything is an Object
 5.3 Every object is an instance of a class
  Instance variables
  Methods
  The instance side and the class side
  Class methods
  Class instance variables
 5.4 Every class has a superclass
  Abstract methods and abstract classes
  Traits
 5.5 Everything happens by sending messages
 5.6 Method lookup follows the inheritance chain
  Method lookup
  Returning self
  Overriding and extension
  Self sends and super sends
  Message not understood
 5.7 Shared variables
  Global variables
  Class variables
  Pool variables
 5.8 Chapter summary
6 The Pharo programming environment
 6.1 Overview
 6.2 The Browser
  Navigating the code space
  The browser menus
  Browsing programmatically
 6.3 Monticello
  Packages: declarative categorization of Pharo code
  Basic Monticello
 6.4 The Inspector and the Explorer
  The Inspector
  The Object Explorer
 6.5 The Debugger
 6.6 The Process Browser
 6.7 Finding methods
 6.8 Change sets and the Change Sorter
 6.9 The File List Browser
 6.10 In Smalltalk, you can’t lose code
  How to get your code back
 6.11 Chapter summary
7 SUnit
 7.1 Introduction
 7.2 Why testing is important
 7.3 What makes a good test?
 7.4 SUnit by example
  Step 1: create the test class
  Step 2: initialize the test context
  Step 3: write some test methods
  Step 4: run the tests
  Step 5: interpret the results
 7.5 The SUnit cook book
  Other assertions
  Running a single test
  Running all the tests in a test class
  Must I subclass TestCase?
 7.6 The SUnit framework
  TestCase
  TestSuite
  TestResult
  TestResource
 7.7 Advanced features of SUnit
  Assertion description strings
  Logging support
  Continuing after a failure
 7.8 The implementation of SUnit
  Running one test
  Running a TestSuite
 7.9 Some advice on testing
 7.10 Chapter summary
8 Basic Classes
 8.1 Object
  Printing
  Identity and equality
  Class membership
  Copying
  Debugging
  Error handling
  Testing
  Initialize release
 8.2 Numbers
  Magnitude
  Number
  Float
  Fraction
  Integer
 8.3 Characters
 8.4 Strings
 8.5 Booleans
 8.6 Chapter summary
9 Collections
 9.1 Introduction
 9.2 The varieties of collections
 9.3 Implementations of collections
 9.4 Examples of key classes
  Array
  OrderedCollection
  Interval
  Dictionary
  Set
  SortedCollection
  String
 9.5 Collection iterators
  Iterating (do:)
  Collecting results (collect:)
  Selecting and rejecting elements
  Identifying an element with detect:
  Accumulating results with inject:into:
  Other messages
 9.6 Some hints for using collections
 9.7 Chapter summary
10 Streams
 10.1 Two sequences of elements
 10.2 Streams vs. collections
 10.3 Streaming over collections
  Reading collections
  Writing to collections
  Reading and writing at the same time
 10.4 Using streams for file access
  Creating file streams
  Binary streams
 10.5 Chapter summary
11 Morphic
 11.1 The history of Morphic
 11.2 Manipulating morphs
 11.3 Composing morphs
 11.4 Creating and drawing your own morphs
 11.5 Interaction and animation
  Mouse events
  Keyboard events
  Morphic animations
 11.6 Interactors
 11.7 Drag-and-drop
 11.8 A complete example
 11.9 More about the canvas
 11.10 Chapter summary
12 Seaside by Example
 12.1 Why do we need Seaside?
 12.2 Getting started
 12.3 Seaside components
  State backtracking and the “Counter” Application
 12.4 Rendering XHTML
  Rendering the Counter
  From Counter to MultiCounter
  More about Rendering XHTML
  Using Brushes
  Forms
 12.5 CSS: Cascading style sheets
 12.6 Managing control flow
  Call and answer
  Convenience methods
  Tasks
  Transactions
 12.7 A complete tutorial example
 12.8 A quick look at AJAX
 12.9 Chapter summary
13 Classes and metaclasses
 13.1 Rules for classes and metaclasses
 13.2 Revisiting the Smalltalk object model
 13.3 Every class is an instance of a metaclass
 13.4 The metaclass hierarchy parallels the class hierarchy
 13.5 Every metaclass Inherits from Class and Behavior
 13.6 Every metaclass is an instance of Metaclass
 13.7 The metaclass of Metaclass is an Instance of Metaclass
 13.8 Chapter summary
14 Reflection
 14.1 Introspection
  Accessing instance variables
  Iterating over instance variables
  Querying classes and interfaces
  Code metrics
 14.2 Browsing code
 14.3 Classes, method dictionaries and methods
 14.4 Browsing environments
 14.5 Accessing the run-time context
  Method contexts
  Intelligent breakpoints
 14.6 Intercepting messages not understood
  Lightweight proxies
  Generating missing methods
 14.7 Objects as method wrappers
  Using method wrappers to perform test coverage
 14.8 Pragmas
 14.9 Chapter summary
A Frequently Asked Questions
 A.1 Getting started
 A.2 Collections
 A.3 Browsing the system
 A.4 Using Monticello and SqueakSource
 A.5 Tools
 A.6 Regular expressions and parsing
Bibliography