This paper will teach you the basics of Smalltalk80 language. This tutorial suites the needs of C and Java programmers. But the tutorial can be understanded by everyone knowing a bit of C and/or OOP concepts, as we'll see. Because I will refer a lot to other books and use a lot of technical terms, I'll try to enjoy you while reading.
Squeak Smalltalk, image.gif
Finally, this is a tutorial, not a reference manual: I cannot say to you "Jump over this chapter is you are not interested" because all the chapters are equally important in this sequence.
This is the Version 1.1, Date: Jan 2002 with minor fix and an explanation of the metaclass concept.
Version 1.0 Date: February 2001 First Version for Squeak 2.8
Native Format: Sgml
The document is available from the Author at his main site (http://objectsroot.com/squeak/squeak_tutorial.html) in these formats:
Please look at the medium limitations (beyond) for choosing the right format which meets your needs.
If you have any suggestions, corrections, or comments, please send them to me, and I will incorporate them in the next revision of this document. I expect to do the next mayor revision of this document near April 2002, but a small revision will be done near the Feb 2002 for adding a MVC section.
You can reach me using one of these email addresses: gio@objectsroot.com, daitangio@tiscali.it
I thank a lot Stephen T. Pope (stp@create.ucsb.edu) for including this document in the Squeak cd-rom and for his supervision. I thank also my friends for reading this document before its final revision: Cristian Ghezzi, Daniele Bufarini, Marco Lamberto.
Giovanni Giorgi is born in 1974 and is tall 1.80 meters, with black hair and brown eyes He got a Master Thesis at Dep. of Comp. Sci. (DSI) of Milan, on 23th Feb 2000, with a Thesis on Design Patterns and UML. He works with Java, likes Smalltalk and loves cats. Preferred Film: Blade Runner by Ridley Scott, The tiger and the Dragon.
This small paper has been written using the SGML-Tool (see http://pobox.com/~cg/sgmltools) of the linux-doc project. The arrow of the html version and all the screen-shots has been done using the GIMP http://www.gimp.org. I have changed Html2Html.pm module to fit my needs.
The valuable editor is Emacs 20.6.1 and the O.S. is linux
I thank a lot the GNU projects for their efforts.
For medium limitations, the best version is the html version. The Postscript version is a nice printed version, but for images see the images directory!
The text version is the final, desperate solution for who wants to read it in a palm computer with no-so-much-ram :-)
We will use this text for code you must type in your Smalltalk implementation and try it.
This tutorial is for Squeak, but you can adapt a lots of concepts to other Smalltalks. For instance, VisualAge for Smalltalk and VisualWorks should work with most of this examples.
This document has been written by Giovanni Giorgi (called the "Author" from this point).
You can copy/distribute this document providing that:
The Author do not provide ANY WARRANTY for the content of this document, for errors or omissions and so on. There is NO WARRANTY even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This small paper is addressed to the very good Java/C programmers out of there, who wants to enter in the Object Oriented World in a fast, easy and fun way. Watching the growing Java world we can say a thing: become a Java programmer can be not so difficult. But becoming a good Java programmer in a short time is not easy!!
Smalltalk is a old programming language, born before Java, C/C++. Smalltalk has a good base library (first attempt to build it was done before 1980!) and a very productive engine.
If you use Java in your work-of-every-day, you can run Smalltalk without loosing speed or efficency (and probably you can get a good improvements with a commercial Smalltalk version!).
Why Smalltalk is not so used? The reason was the high cost of Smalltalk in the '80 years and until the 1995. Worst, the fastest Intel-PC in the 1990 was too slow for using Smalltalk (or Java or Lisp) in the all-day work.
If you feel C/Java language is nice, but you want a way for increase your productivity without looking for bugged code every day, Smalltalk can give you a solution. C++ is not often a solution because a good C programmers continue to use is as an "enhanced C" without using the full power of the OOP. C++ is for efficency: but efficency can lead to bad Object Oriented code, because you do NOT tend to isolate the classes as they should be.
I used Java, C and C++, then I discovered Smalltalk. It seems incredible, but you can do a lot of thing with Smalltalk: you can find the bug very quickly and enjoy a lot!!
In the last five years you can download free version of Smalltalk, which are quite powerful and fast, and you can buy a professional Smalltalk at a reasonable price.
This because the competition of Java has lowered the costs of the implementations.
Best, you can find the same Smalltalk implementation under Unix, MS-Windows and Mac, so it is widespread as the Java/C languages.
So, why not invest a bit of our time to learn a dynamic, powerful and fun language?
Okay, now we will start talking about what you should know for understand this small paper: