Preface
- Page ID
- 36459
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)What is Squeak?
Squeak is a modern, open source, fully-featured implementation of the Smalltalk programming language and environment.
Squeak is highly portable — even its virtual machine is written entirely in Smalltalk, making it easy to debug, analyze, and change. Squeak is the vehicle for a wide range of innovative projects from multimedia applications and educational platforms to commercial web development environments.
Who should read this book?
This book presents the various aspects of Squeak, starting with the basics, and proceeding to more advanced topics.
This book will not teach you how to program. The reader should have some familiarity with programming languages. Some background with object-oriented programming would be helpful.
This book will introduce the Squeak programming environment, the language and the associated tools. You will be exposed to common idioms and practices, but the focus is on the technology, not on object-oriented design. Wherever possible, we will show you lots of examples. (We have been inspired by Alec Sharp’s excellent book on Smalltalk1.)
There are numerous other books on Smalltalk freely available on the web but none of these focuses specifically on Squeak. See for example: stephane.ducasse.free.fr/FreeBooks.html.
A word of advice
Do not be frustrated by parts of Smalltalk that you do not immediately understand. You do not have to know everything! Alan Knight expresses this principle as follows2:
Try not to care. Beginning Smalltalk programmers often have trouble because they think they need to understand all the details of how a thing works before they can use it. This means it takes quite a while before they can master
Transcript show: 'Hello World'.
One of the great leaps in OO is to be able to answer the question “How does this work?” with “I don’t care”.
An open book
This book is an open book in the following senses:
- The content of this book is released under the Creative Commons Attribution-ShareAlike (by-sa) license. In short, you are allowed to freely share and adapt this book, as long as you respect the conditions of the license available at the following URL: creativecommons.org/licenses/by-sa/3.0/.
- This book just describes the core of Squeak. Ideally we would like to encourage others to contribute chapters on the parts of Squeak that we have not described. If you would like to participate in this effort, please contact us. We would like to see this book grow!
For more details, visit the book’s web site, SqueakByExample.org, hosted by the Institute of Computer Science and Applied Mathematics of the University of Bern, Switzerland.
The Squeak community
The Squeak community is friendly and active. Here is a short list of resources that you may find useful:
- www.squeak.org is the main web site of Squeak. (Do not confuse it with www.squeakland.org which is dedicated to the eToy environment built on top of Squeak but whose audience is elementary school teachers.)
- www.squeaksource.com is the equivalent of SourceForge for Squeak projects.
- wiki.squeak.org/squeak is a wiki with up-to-date information about Squeak.
About mailing-lists.
There are a lot of mailing-lists and sometimes they can be just a little bit too active. If you do not want to get flooded by mail but would still like to participate we suggest you to use news.gmane.org or www.nabble.com/Squeak-f14152.html to browse the lists.
You can find the complete list of Squeak mailing-lists at lists. squeakfoundation.org/mailman/listinfo.
- Note that Squeak-dev refers to the developers’ mailing-list, which can be browsed here: news.gmane.org/gmane.comp.lang.smalltalk.squeak.general
- Newbies refers to a friendly mailing-list for beginners where any question can be asked: news.gmane.org/gmane.comp.lang.smalltalk.squeak.beginners. (There is so much to learn that we are all beginners in some aspect of Squeak!)
IRC.
Have a question that you need answered quickly? Would you like to meet with other squeakers around the world? A great place to participate in longer-term discussions is the IRC channel on the “#squeak” channel at irc.freenode.net. Stop by and say “Hi!”
Other sites.
There are several websites supporting the Squeak community today in various ways. Here are some of them:
- people.squeakfoundation.org is the site of SqueakPeople, which is a kind of “advogato.org” for squeakers. It offers articles, diaries and an inter- esting trust metric system.
- planet.squeak.org is the site of PlanetSqueak which is an RSS aggregator. It is good place to get a flood of squeaky things. This includes the latest blog entries from developers and others who have an interest in Squeak.
- www.frappr.com/squeak is a site that tracks Squeak users around the world.
Examples and exercises
We make use of two special conventions in this book.
We have tried to provide as many examples as possible. In particular, there are many examples that show a fragment of code which can be evaluated. We use the symbol \(\rightarrow\) to indicate the result that you obtain when you select an expression and print it
:
3 + 4 → 7 "if you select 3+4 and 'print it', you will see 7"
In case you want to play in Squeak with these code snippets, you can download a plain text file with all the example code from the book’s web site: SqueakByExample.org.
The second convention that we use is to display the icon \(\bigstar\) to indicate when there is something for you to do:
\(\bigstar\) Go ahead and read the next chapter!
Acknowledgments
We would like to thank Hilaire Fernandes and Serge Stinckwich who allowed us to translate parts of their columns on Smalltalk, and Damien Cassou for contributing the chapter on streams. We also thank Tim Rowledge for the use of the Squeak logo, and Frederica Nierstrasz for the original cover art.
We especially thank Lukas Renggli and Orla Greevy for their comments on drafts of the first release.
We thank the University of Bern, Switzerland, for graciously supporting this open-source project and for hosting the web site of this book.
We also thank the Squeak community for their enthusiastic support of this project, and for informing us of the errors found in the first edition of this book. Finally we thank the team that developed Squeak in the first place for making this amazing development environment available to us.
- Alec Sharp, Smalltalk by Example. McGraw-Hill, 1997 (URL: stephane.ducasse.free.fr/FreeBooks/ByExample/).
- www.surfscranton.com/architecture/KnightsPrinciples.htm