Doers of Stuff.org

A place to Do Stuff and see Stuff Done…

# Squeak by Example

Squeak is a modern open-source development environment for the classic Smalltalk-80 programming language. Despite being the first purely object-oriented language and environment, Smalltalk is in many ways still far ahead of its successors in promoting a vision of an environment where everything is an object, and anything can change at run-time.

Squeak by Example, intended for both students and developers, will guide you gently through the Squeak language and environment by means of a series of examples and exercises.

This book is made available under the Creative Commons Attribution-ShareAlike 3.0 license. You can either download the PDF for free, or you can buy a softcover copy from lulu.com. (You can also pay for the PDF download from lulu.com, if you would like to make a contribution to this effort, but you are under no obligation.)

### Topics

The book helps you get started with A Quick Tour of Squeak and guides you through A First Application. The Smalltalk language is introduced in three chapters on Syntax in a NutshellUnderstanding Message Syntax and The Smalltalk Object Model.

Development with Squeak is covered in The Squeak Programming Environment and SUnit. Several of the key classes are presented in chapters on Basic ClassesCollectionsStreams and Morphic.

The first edition of the book concludes with chapters on Classes and Metaclasses and Frequently Asked Questions.

### An Open Book

This book is open in the following senses:

We would like to see this book grow! We encourage you to contribute chapters on the parts of Squeak that we have not described. If you would like to participate, please contact us.

### Hands On!

The book is filled with hands-on exercises for you to try out.

Wherever possible, Smalltalk code is illustrated with lots of working examples.

factorial := [:n | (1 to: n)
inject: 1
into: [:product :each | product  * each ] ].
factorial value: 10 → 3628800


Actually, most of the examples are automatically converted to SUnit tests, so we can be sure that the code really runs as advertised. For example, the following expression (on line 114 of the Preface)

3 + 4 → 7

will be translated to:

test114 self
assert: [ 3 + 4 ] value printString = '7'.


and automatically run: