Pharo Object Model in a Nutshell

Elegance and Simplicity

Damien Cassou, St├ęphane Ducasse and Luc Fabresse http://stephane.ducasse.free.fr

Only Objects, Messages, ...

... and Block Closures

4 timesRepeat: 
	[ Transcript show: 'Hello World' ]

A Simple and Uniform Model

Pharo Object Model

Messages

Computation between objects is done via message sends

Example of the cross product of two points:

(point1 x * point2 y) - (point1 y * point2 x)

Object Creation: Creating a Point

A new object can be created by sending a message to another object

10@20

A new Point object is created by:

Object Creation: Creating a String

'Pharo', ' is Cool'
> 'Pharo is Cool'

A new String is created as the concatenation of two strings by:

Object Creation

Sending the messages new and new: to a class

Monster new
> aMonster
Array new: 6
> #(nil nil nil nil nil nil)

Here we get an array of size 6

Object Creation

Sending instance-creation messages to a class

Tomagoshi withHunger: 10

This executes a class method

Less is More :)

Summary

/