2018-03-11
___O_n__s_m_a_l_l_t_a_l_k____________________________________________
I always have felt being left out of the OO programming community.
All these pattern talks and the Java/C++ code I have to deal with at
work made me question this programming paradigm. But I wanted to dig
a little deeper and see what this is all about. So around last
november I started learning one of the first OO languages around:
Smalltalk[0]. Smalltalk is a nice little language with such little
syntax, that it fits on a postcard[1] (text preview here[10]). The
main communication mechanism in this nice language is message passing
between objects. Everything is an object and responds to messages.
So you get life introspection into every aspect of the system. Also
the code is executed inside a VM (one of the first around!) and so
you can alter the system *life* and debug and change an application
while it is running!
Besides the simple language code smalltalk consists of two additional
parts: An extensive class library providing most of the functionality
that others would count to a language itself: compiler, interpreter,
debugger...
And the other part is the *graphical* UI environment. All of these
run inside a VM image, which means that you can change something save
the image quit and come back later to find your envrionment just as
you have left it. Yes smalltalk is one of these strange image base
languages, just like the lisp tradition. A collection of these UI,
class and language parts is called a smalltalk system. You may think
of it as a 'distribution' in the linux distro sense.
From the 'original' smalltalk there's now a common VM implementation
which hosts several different smalltalk systems:
opensmalltalk-vm[2]. On this VM there runs pharo[3], which
is the most complete and streamlined systems out there, squeak[4] which
is the 'original' smalltalk system comming from Xerox PARC
newspeak which is a totally new langugage with an emphasis on
security and mobile computing and my favourite: Cuis[5].
While pharo is the most 'enterprise ready' of the whole bunch, I love
cuis for its goal of being minimalistic and simple. If you want to
understand a smalltalk system, I'd recommend to start with cuis. It
has just ~500 classes, whereas pharo clocks in with 1500+...
If you don't care about graphical environments then there's also
GNU smalltalk[6] and 'a little smalltalk'[7] both are independent
implementations that come with their own VM and instruction set.
Most of the smalltalk books are legally available for download. I
recommend the 'blue book'[8] written by Adele Goldberg, one of the
first smalltalk instructors and programmers. She has also managed the
release of the first smalltalk and designed a lot of the system
parts. The pharo book site[9] contains lots of nice stuff to read.
I may tell you about my work with smalltalk in another post :)
What I like about it so far: The codebrowser, live debugging and
browsability. The codebrowser is the essential development tool on
smalltalk. It allows editing and browsing of the classes and methods
in a system. It allows quickly searching and finding
senders/receivers of a message and is therefore the main tool to
navigate through the source code.
The debugger is invoked upon an unhandled error or user request.
Since smalltalk is run in a VM it allows you to change the faulty
code, and rerun the message as if the error never has happened. The
change you made is compiled and made persistent in the image.
And since all objects adhere to an introspection protocol one can
inspect all aspects of the system life. Want to know what a
particular button does? Just click on it in a special way and open up
that class's browser window.
As you can see this changes the way in one edits code. Also pharo and
squeak contain one of the first refactoring browsers written. Want to
change some aspect of a method? Just tell the editor and it will take
care that the whole system is consistent.
I will leave you with this incomplete view for now and encourage you
to do your own exploring.
Happy hacking!
___References________________________________________________________
[0]:
https://en.wikipedia.org/wiki/Smalltalk
[1]:
gopher://vernunftzentrum.de/g/ckeen/media/smalltalk-postcard.gif
[2]:
http://opensmalltalk.org/
[3]:
https://pharo.org/
[4]:
http://squeak.org/
[5]:
http://www.cuis-smalltalk.org/
[6]:
http://smalltalk.gnu.org/
[7]:
https://en.wikipedia.org/wiki/Little_Smalltalk
[8]:
http://sdmeta.gforge.inria.fr/FreeBooks/BlueBook/
[9]:
http://stephane.ducasse.free.fr/FreeBooks.html
[10]:
gopher://vernunftzentrum.de/0/ckeen/media/smalltalk-postcard.txt