Some
introductory documentation by Alan Kay
Earlier in these notes I
mentioned Alan Kay was writing an introduction to Squeak for American
schoolteachers of elementary school and their pupils. It is partially finished, and here is the link:
These are a quite clear
set of step-by-step instructions how make a drawing of a car in Squeak and
attach code to it so that it can move around the screen.
Incidentally, for those
new to Squeak: To use this documentation in Squeak, do the following:
(1) download the above file
(2) Inside Squeak Open a Filelist
(3) Find the downloaded file in it
(4) Load it in a browser inside Squeak
and you have inside
Squeak a step by step docmentation that very clearly explains things.
A popular misconception of programming,
Prolog and Smalltalk
One of the monthly
computer magazines I read is the English PC Plus, which is a bit less inane
than most computer magazines these days and that comes with CDs with lots of
interesting programs. (For example, about half a year ago it had VisualWorks
5.3 nc including its pdf-documentation - which is a huge download over the
telephone.)
PC Plus runs a monthly
column by Huw Collingbourne, called "Rants and Raves", which has
the merit of being fairly decently written. In #184 of PC Plus, nominally of
"December 2001", I read the following in Collingbourne's
column:
"Back in the 1970s and 1980s, programming is where it all
was happening, Back then, the future direction of computer programming was up
for grabs. New ideas were springing up all over the place.
Take the
Prolog language. This
introduced 'logic' programming for artificial intelligence. To some people,
it seemed that this was going to be the way everyone would program one day. Well,
if so, that day is a long time coming. Then there was Smalltalk. This had the
first completely integrated graphical development environment for object
orientation. Hardly anyone programs in
Smalltalk these days
but its innovative user-interface have been ruthlessly copied. In short,
without Smalltalk there would be no Windows. (...)
These days, there is nothing new in programming. Delphi and Visual
Basic could hardly be called revolutionary. Languages such as C++, Java
and C# do little more than tinker around the edges of C. Each of tem has its
pluses and minuses but, ultimately, they are nothing to get excited
about."
Well... I will not propose this quote as a
game of "spot the many errors". It so happens that I know Prolog
quite well and have programmed a lot in it (mostly indeed not "'logic' programming for artificial
intelligence") and it so happens this part of my site is
given to the most recent incarnation of Smalltalk, which is Squeak, and that
it seems a bit odd if not unfamiliar for me to belong to "Hardly anyone".
What concerns me most in
the quoted passage from a well-known computer journalist, who even knows how
to program (in Delphi), are the odd notions that "These days, there is nothing new in
programming." and that programming languages "are nothing to get excited about."
Obviously, if all you
care for is widget-clicking, e-mail sending, and game-playing, the real power
and potential of a computer - these days in the 1 Mhz processor range with
512 Mb memory as more or less standard option - is not for you, and MicroSoft
may be happy to serve your needs for pay.
If you are really
interested in using and developing your own mind, then clearly you will be
much excited about the basic tools with which computers are made to do
things: programming languages.
It is simply about as
fundamental misconception about computers to regard programming languages as
unimportant as it is about human beings to believe their language is
unimportant.
For intelligent people,
programming is always interesting and exciting, for intelligent people want
to understand computers and are always interested in how to communicate with
them.
And in fact, these days
there is quite a lot that is new in programming, such as Perl, Python and
Squeak.
An alternative set of metaphors for programming
in Smalltalk
In these notes I have several times commented on my unhappiness with the
Standard Received Version of presenting Smalltalk and talking about
Smalltalk. (See Index of Squeak notes).
Also, I have summarized
my own views on this type of language in my Review of SqueakNews
(especially in my reviewes of articles 5, 6 and 8).
So here is first another way of thinking about what Squeak
and Smalltalk offer in their basic System Browsers, and second a new set of principles for programming
languages like Squeak.
I offer both sets of
remarks in a tentative
mood, but also based on 14 years of programming (in other languages than
Smalltalk) and some 30 years of reading and thinking about mathematical
logic, analytical philosophy and cognitive psychology, which are three
disciplines that informed much of the opinions about Squeak and Smalltalk
that I expressed earlier in these notes.
I. On what the Smalltalk System Browsers
show
In the Standard Received
Version these are all "objects" presented over 5 main windows,
which I will call Categories, Classes, Protocols, Methods and Code. Each of
these windows in fact is an editor that show text.
In my terms, these five
windows show the following:
|
Categories
|
Index of names of collections of
classes - alphabetical
|
|
Classes
|
Classes of programs
|
|
Protocols
|
Index of names of subsets of
programs of that class
|
|
Methods
|
Programs of the class
|
|
Code
|
Program
|
The main items are in
fact the Classes, Methods and Code windows, for the other two are merely
indexes to make the items in these three windows tractable for human users.
The Classes are in fact
what Smalltalk calls "objects" but that I obstinately want to
consider named sets of programs intended for a specific purpose (covered by
its name).
And in my terms, the
following sort of defined identities hold:
|
Classes
|
=def named sets of programs
|
|
instances
|
=def set of named programs
|
|
object
|
=def base-class for all programs
|
And the basic principle
should be: Everything that can be
identified (named, selected) by means of a computer can be explained and
programmed by it.
Classes have instances, which are names, which can be assigned values by
programs. By making a new instance of a class Pi := {pi1,..,pin}
the names P'i and p'in..p'in are put in
memory as compiled code ready to run when the name and parameters are
supplied. Evaluating p'ij is executing that code to produce p*ij. I.e.
p'ij := p*ij by executing i.e. evaluating p'ij
i.e. binding its variables and processing it.
And to run a program a new instance of its class must be loaded into memory,
which is garbage-collected if unused. (I.e. the general idea is: Make new,
execute, store value as assignment, forget about rest, for it wiill soon be
removed if unused.)
II. A new set of principles for programming
languages like Squeak.
It follows from the
above remarks and the rest of the notes this text is part of that I am not
impressed nor converted by the metaphor of "Object Oriented
Programming".
And here is a sketch of another set of principles: POP = People Oriented Programming, that
covers essentially the following:
-
Full explanations of everything:
Everything that can be identified by means of
the computer (named, slected) is explained by the programming
environment
-
Full source of everything:
The programming environment is completely open source and
completely given to the user, in the way language, mathematics and music
are given to people by people
-
Full access to processor and memory:
The programming environment extends the powers of the underlying
processor by a VM (Virtual Machine) + loaded image
-
Full freedom for the immediate changing of everything:
The programming language is fundamentally interpreted, for
immediate debugging of any piece of code and the possible changing of
all or anything it does
-
Everything identifiable is programmable and
explainable:
Everything that can be identified (named, selected) by
means of a computer can be programmed in the language and explained in
the environment
-
Everything computers can do can be programmed in the
language:
There are programs and explanations for all important
aspects of computing (text, mathematics, graphics, sound, internet)
-
Programming languages must be free like language is
free:
Something that is as fundamentally important as a
programming language belongs to mankind, and should be developed and
maintained by all people and especially by academics; programming
languages should not be the property of corporate enterprises.
This list of basic
principles about programming languages and programming environments seems to
me to be conceptually much clearer than the usual story. (Incidentally, the
(Smalltalk-)image is less essential than the VM, which is an extension of the
capacities the processor has, and is also there to give the programming
language more power and greater ease of use, which is of very great
importance.)
Also, in this approach
the following holds:
-
it makes the basic problem of computing consist in the
communication between men and machines;
-
it makes the basic task of computing to make this
communication with computers as easy as is possible for people;
and
-
it makes computers into tools for thinking.
The above is a list of
properties that shows why something like Squeak is and can be pretty
unique and different and shows what POP - People Oriented Programming - is
about:
Apart from Squeak hardly
any program or programming environment has full explanations, full source,
full access to the processor, immediate changing and inspecting of any code
it runs, and programs and explanations for all fundamental things open to
computing.
In fact the standard commercial approach to computing, which conveniently and
aptly may be abbreviated as COP (=
Commercially Oriented Programming, based on secret and compiled code
that must be bought or hired) is the opposite. What COP is about is
this:
Partial explanations; no source; no access to the processor except in
an OS- and executable-limited way; no right to inspect or change the code;
and only task-specific programs and explanations, which must be paid for in
cash, and are always secretive about their mode of operation and actual
contents in terms of code and processing power.
So what I call COP = Commercially Oriented Programming is
clearly oriented around computing as a way to make money from programming -
which may be done in an honorable way, for respectable reasons, but which always will saddle the buyers
with software they must take on trust, and can neither inspect nor alter nor
fully understand, and which will always
saddle the users with hidden and secretive powers over and accesses to their
private information, given to powerful private enterprises about whom the
buyers or hirers of the commercial secretive software have themselves no
effective control whatsoever.
The COP approach to
programming is about making money - in an essentially secretive way.
Finally, POP is clearly
is oriented around computing as a human activity like talking and reckoning -
which are the basis of human civilization, and should come for free in the
hands of every human being, simply as an individual human right and as the
basis of scientific, technological and social progress.
The POP approach to
programming is about making civilization - in an essentially open way.
I think these principles are clearer than is OOP in terms of basic terms to
think about computing and programming, and are so in quite a few
respects. Also, the abbreviations found and their explanations have a
certain fittingness and justness - or so it would seem to me. (I do believe
there is ethically decent commercial computing, but I also think it does not
bear the name of MicroSoft. Similarly, there is ethically decent private
enterprise, but rarely by monopolies and oligopolies.)
Also, from my point of view, OOP in programming practice does come down to
the having access to classes of programs that are precompiled and only need
their parameters fixed - think of the "property-lists" Delphi shows
- and see On what the Smalltalk
System Browsers show.
One of the things that is part of the above notion is a FAR more extended use
of - say - the F1-key to pop up help in the form of a menu-list of the
possibilities in the context plus comments (help-balloons, say, in the
Squeak-way) of these list, and an option to a more comprehensive help. (Namely,
a full User Manual that explains all of the environment and the language.)
And the basic OOP-dogma
("Everything is an object") gets into POP as
This fits in quite well
with Morphic in Squeak
(Squeak's extenstion of Smalltalk) which makes parts of the screen "objects" to
which one can attach code - which indeed are much better named as
"morphs" than as "objects".
In fact I want to
altogether avoid the name "object"
(as common and as used in OOP), because it is too general and common a term
that makes it almost inescapable to confuse levels (especially: speaking of things
modelled as if they are and have the properties of the programs that attempt
to model them, speaking as if programs are animated creatures; and speaking
as if code in a human mind is and means and does the same as code in a working
computer).
Also, for one like me - which includes my background knowledge and
programming experiences - the present approach sheds a considerable
amount of light on what the Smalltalk system browser shows, while the
OOP-style of expression - as exemplified by Goldberger and Robson's "Smalltalk 80" - gets me
in the most neo-positivist of anti-Heidegger moods (as one may infer from my review).
And indeed, my reaction
to OOP is the reaction of someone qualified in mathematical logic, analytical
philosophy and cognitive psychology - and while nobody is perfect because of
his knowledge, certainly this doesn't make those who don't have the knowledge
more fit to judge what the knowledge is about.
Those who don't have my
background and think I am mistaken - as I may well be - should ask themselves
why a text like "Smalltalk 80"
has not become a
classic in logic, philosophy or cognitive or educational psychology. I
think the main reason is that while Smalltalk is a great programming
environment and language, the metaphors used to describe and explain it are
fundamentally misleading and are the source of much unclear writing and
thinking about Smalltalk.
Nov 14, 2001