[self-interest] Re:Our two weapons are fear and surprise...and..
Jecel Assumpcao Jr
jecel at merlintec.com
Sat Aug 8 00:07:23 UTC 2009
My experience teaching Smalltalk and Self has been very similar to
Most tutorials I have seen don't mention that the basic control
structures are just message passing instead of built-in. That is
something people don't need to learn right away, but it can be exciting
for people experienced in other languages and then these people want to
share with everyone by writing a tutorial that does go into that.
A more traditional path will make the student take ifTrue:, while: and
do: as given and will never see any other control structures at all. The
difficulties I have seen are: ifTrue: comes after the boolean expression
and that the first expression must be a block for while: but not for
ifTrue: (things are far worse for and: and or: where one side has to be
a block and the other shouldn't be one!!). I would have thought that do:
might be complicated since you get blocks with arguments which have a
slightly awkward syntax, but in general people find that less confusing
than the details of "for" in C.
By far the biggest complication in Smalltalk-80 is the "class/instance"
button in the browser. People will think that they are following
instructions exactly but will end up adding their method to the wrong
"side". The resulting errors will be really, really confusing. Self
neatly avoids that, but I think with the proper tools the situation
could be better even in Smalltalk-80.
About simplicity itself, Steve Jobs had some very interesting comments
in an interview in Byte magazine when the Mac came out in 1984. He
showed the Mac motherboard beside a IBM CGA video board and noticed how
much more complex the latter was even though it did far less. He said
that projects tend to start out simple because the people don't yet know
all the problems there are in practice. By the time it actually works,
it will be a lot more complicated. He said most projects end there and
ship the product, but if you could keep on going and learning still more
you would get to the point where you could build something even simpler
than the first design but which actually works even better than the
complicated one. I think this describes the history very well:
Smalltalk-72....-76....-80 and then -86 (a.k.a. Self).
Another thing I like to say about simplicity is that there are two
kinds: painful and joyful. Imagine the simplest possible paint program.
You might move the blinking cursor to the next pixel by pressing "space"
and change the color under the cursor by pressing "tab". Get what I mean
by "painful" yet? If space moves in the opposite direction to where you
want to go, you will need to press it as many times as there are pixels
to get where you want. But there is no drawing that can be made with any
other tool that can't also be made with this one! If we were to step
back from absolute simplicity (do I need to quote Einstein?) by allowing
movement in four directions using the arrow keys, the usability of the
program would increase dramatically. But on rare occasions things become
more usable when they are made simpler rather than added to (do I need
to quote Exupery?), and that is what I mean by joyful simplicity.
The math side of language designers makes them long for universals. But
I hope you can see that replacing if/then/else, for, while, until and so
on with just if and goto is an example of painful simplicity? To me,
replacing temporary variables, instance variables, class variables,
class instance variables, pool variables and global variables with slots
and parents is an example of joyful simplicity. Replacing built-in
control structures with blocks, non local returns and _Restart (Self) or
blocks and recursion (Smalltalk-80) adds a little bit of pain (in the
form of the awkwardness I reported above) but is otherwise pretty much
neutral. It is a refactoring that will only start to matter when you are
pretty deep into the language.
Some ideas about how Self could be simpler can be found in:
More information about the Self-interest