The future reinvented with Open Croquet

By Dafydd Rees

Squeak – Powerful multimedia authoring and programming for children
Croquet
Why you should care
Is Object-Technology really in crisis?
References

Quote by Alan KayOpen Croquet can be likened to many things: a multimedia authoring environment, a programming system, a collaborative, distributed, three dimensional virtual environment and ultimately, system software for a new kind of machine. Open Croquet is an open source research project being developed by ViewPoints Research Institute (VPRI) in California. ViewPoints Research Institute is focused on improving education by enabling children of all ages to learn by interactively constructing models of complex systems.

Perhaps the first reason to take a serious interest in VPRI is the calibre of the participants. To name just a few: Doug Englebart (inventor of the mouse, and major contributor to research on hypertext), Richard Dawkins (evolutionary biologist), Adele Goldberg (a major innovator in the field of object technology), Marvin Minsky and Nicholas Negroponte (both leading figures at MIT), Seymour Papert (a pioneer in the field of computer aided learning and the inventor of Logo) and David Reed (a major contributor to the design of the Internet). Even the late Douglas Adams is listed under the heading “advisor ethereous”!

Open CroquetVPRI is led by Alan Kay, a former researcher at Xerox Parc where he played an active role in many of the ideas that led to interactive, graphical, personal computing. In several recent talks Kay has suggested that the last thirty years in computing have been boring because few real innovations have been adopted by industry. He cites the fact that Linux, one of the hottest topics for many technologists, is merely a refinement of the Unix family of operating systems that have been around since 1973.

Kay blames this lack of innovation on the fact that most adults employ instrumental reasoning to evaluate and apply new ideas. This means that adults have difficulty evaluating new ideas because they’re carrying too many existing goals, and too much context to be able to see the full potential of new ideas. One way to overcome this problem is to work with children. Children won’t know that something is difficult or that hundreds of papers have been published explaining the intricacies of some particular problem. They are more likely to experiment where adults would have given up, and to ask, “So what else can I do with this?”

Squeak – Powerful multimedia authoring and programming for children

SqueakFigure 1: A simple-looking e-toy that allows children to program by assembling little scripts by composing “tiles” together. “Wire up the car, so that it can be steered by rotating the wheel.”

Croquet runs inside Squeak, which is a refinement of the Smalltalk-80 language developed by Kay and his team at Xerox in the late seventies. In order to better understand Croquet, we should first examine Squeak.

Unlike most programming languages, Squeak (and its older brother Smalltalk-80) are conceived along the lines of system software for an entire machine. This follows from work in the sixties and seventies on Lisp machines and Smalltalk machines. The intention here is to create a seamless environment where there are no separate applications as we know them, merely clusters of software “objects” that cause things to happen in the machine by sending messages to other objects.

Since all these little fragments of software are organized by a common system, there is no special programming environment or build process. The programming tools are merely collections of objects in exactly the same way as the end-user software. This makes for a very powerful programming environment where programmers can simply “pick-up” running pieces of software and inspect the state of those objects as they run. This unusual approach means that programmers are always, directly modifying the environment in which they are working. There simply isn’t any need to code, compile, link and re-run a program to see results. Changes become live as soon as they are entered at the keyboard.

Programming in conventional, file-based languages like C, C#, Delphi and Java is like creating a glass sculpture – where a small change means rebuilding the entire piece of work. Programming in Squeak on the other hand is more like shaping clay, where programmers get a productivity boost because they don’t have a build process to worry about and can think fluidly thanks to direct feedback.
Squeak includes many multimedia features, such as painting tools, sound editing and animation software, and digital video support. These features have been packaged with a simple scripting language designed for children. On the face of it, this tile-language is simple, but in reality it is only a thin veneer over the Smalltalk programming language. Squeak has been used in primary schools to help teach scientific and mathematical ideas by exploring programmable multimedia.

Figure 1 above, shows a simple e-toy tutorial in Squeak where children are encouraged to write simple programs that drive a car object, by rotating a steering wheel object. The key tiles here spell out messages to the Car: “Car forward by 7” and “Car turn by Wheel’s heading //5”. The script window itself is just another graphical object. What else could we use to steer the car? The program window is just another graphical object, so it has a size, position and heading. It turns out that driving the car by rotating the program itself is no more complicated: just replaced the “Car turn by Wheel’s heading” with “Car turn by Script Editor’s heading // 5”. Rotating the script causes the car to move in the same direction.

Metaprogramming for childrenFigure 2 – Metaprogramming for children: steering the car by rotating the program.

This is a simple step, yet in “enterprise class” professional programming languages like C, C#, Delphi and Java, this is unthinkable. Children, not having the context held by professional programmers working in established, commercial environments, won’t appreciate why this should be difficult. This simple demonstration also shows how children can discover complex ideas by making things. Most professional programmers don’t understand metaprogramming, yet it the basic idea can be discovered by playing with e-toys in Squeak.

In short, Squeak is a very powerful multimedia authoring and programming environment with an interesting history.

Croquet
Many of the operating systems we use today are based on small, continuous improvements over old design ideas developed in the sixties. In the sixties, computers were large, and very expensive. Many, brutal tradeoffs had to take place to produce viable operating system designs. Today we find that computers are powerful, cheap and ubiquitous. Croquet asks the question – if we were to start again with modern assumptions about computer power, what could we do?

Immersive experienceFigure 3: Editing some code and browsing the web. I’m represented in the world by the avatar that looks like Alice in Wonderland. I’ve put the mouse down on the board to move the “SystemBrowser: TeaProcessTest” window, and you can see this in the mirror looking at the black trail leading from my avatar to a point on the board.

The croquet team made these assumptions:
Hardware is fast
3D graphics hardware is very, very fast (But apart from games, there are few applications.)
“Late-bound” languages like Smalltalk-80 are undergoing a revival. (These are the languages that will allow your children to decide at the last minute to “drive the track around the car”, or perhaps might allow you to vastly outperform your competitors by adapting very quickly.)
Communication is an important part of the computing experience, but it is only used through a few narrow channels like email and the web.
Modern systems have many unnecessary boundaries (for example between different parts of the system and between separate applications.) This means that developing and customizing applications is far more difficult than it should be.

Figure 3 is a screenshot of someone reading the web and editing some Croquet code inside a Croquet environment. Users are shown in Croquet by three-dimensional avatars. Each Croquet session consists of a TeaParty in which many different users can interact at once. A TeaParty is a little like a game running on a Quake or Unreal Tournament server, because users can see each other and interact with objects is the same virtual environment. Perhaps the key difference is that Croquet is not a toy. The board, floating in mid-air on the right is in fact, a Squeak project, which contains a code editor (called a browser), and the standard Squeak Smalltalk web browser called ‘scamper’. Should you wish, you could read your e-mail in these windows.

The classic Smalltalk-80 SystemBrowser in the window on the board shows some code that is running live in the system. (Actually it’s some unit test that exercises code which synchronizes different TeaParty sessions.) Editing this code (in the bottom half of the green window) and saving it would instantaneously apply that change to the Croquet environment. Many users could be in this TeaParty at once, so anyone in this TeaParty positioned to see the board, could see those edits and help by joining the programming session. Selections made on the board with the mouse are visible to other users as arrows streching from the avatar to the item being manipulated. In Figure 3, you can see Alice, my avatar reflected in a mirror. She’s selected the SystemBrowser for me, because I’m moving the browser upwards. In the mirror, you can see a black arrow reaching from Alice to the SystemBrowser. Other participants will see the arrow, and will see the browser move on the board, in near real-time.

Most people collaborate using programs like Microsoft Windows terminal server that reproduces system-level drawing instructions so that a common screen can be shared. AT&T’s VNC program works in a similar way by sending changed bitmaps across the network. Note that Figure 3 shows the world as seen by Alice. It’s unlikely that the Hare in the foreground of Figure 3 will be able to see the source code on that board at all from its viewpoint. Conventional programs like Terminal Server and VNC look like neat, system-level hacks that expose one graphical user interface view to another user across the network. Croquet presents a proper, user-based viewpoint model that stretches down into the core of the software.

IT Wales on steroidsMultiplayer 3D games normally use a server to synchronize the state of the virtual world. That means that all participants will be messaging a single server somewhere on the network. Network traffic will tend to gather around this server and cause congestion. This congestion ultimately limits the number of users able to share a single game.

Croquet by contrast uses ‘peer-to-peer object replication’. The state of the virtual world is computed by each client, rather than at a single, congested point on the network. If a client machine is too slow computing the next state of the world, that machine is ejected from the TeaParty. Synchronization is achieved using a new system called ‘TeaTime’. This system defines a shared, global notion of time, so that each participant observes the same state of the world. Browsing around in the source code reveals that shared objects are actually ‘waiting for TeaTime’ to do their synchronization! (In “Alice in Wonderland”, it is always tea time!)

To overcome network latency, shared objects participate in versioning, and can record a history of messages sent from an object at a particular time, so that multiple, different strategies can be used by objects depending on their application. Perhaps this synchronization framework is responsible for the noticeable echo that can be heard when you turn on the audio conferencing.

Why you should care
Inspiration
The story so far should inspire every technologist to ask the question – “Is there a much better way of doing this that I haven’t considered?” Children don’t have our mental baggage, so perhaps we should let them help us innovate more often.

Living history
Some of the code in Squeak dates back to Xerox Parc in the seventies. Learning Squeak is interesting but it can also be quite frustrating. The literature is peppered with historical references and strange terms, for example: “click the red mouse button”. It’s quite curious that fragments of this old culture have survived this long. The only place you’re likely to see an Alto workstation, complete with red, yellow and blue mouse buttons, is in a museum!

Really exciting open-source opportunities
In the late seventies, Apple Computer paid Xerox a substantial amount to get a glimpse of their research. One third of this work, the graphical user interface, inspired the personal computer revolution (the other two thirds were networking and object-oriented technology). Today, the direct descendant of this work opens up a new direction in software system design and is being presented to the world, free of charge, with tutorials and documentation as an open source project ( http://www.opencroquet.org ). Whereas many open source projects seek to recreate better versions of existing software, Croquet and Squeak present the opportunity to help invent the future.

Most open source work is done in C or C++, often using tools developed decades ago. It’s too difficult for most people to download the source and build an open source project and those that could do it often don’t feel they have the time or patience to do it. In the Squeak environment, there is no build process, and no long waits for recompilation, nor do you have difficulty jumping into a running system to find out what is happening. Programming happens at a much higher level of abstraction in Squeak Smalltalk. Due to difficulties with C and C++ most people see open source programming as a badge of hacker machismo. Old Smalltalkers, and the new breed of Squeakers can be forgiven for asking, “Why do you people keep torturing yourselves when there’s a better way?”

Is Object-Technology really in crisis?
Many members of the British Computer Society specialist group on object technology are concerned that object technology isn’t novel anymore and so the group has decided to change names. There is a difference between owning a tool and knowing how to use it properly. Kay makes a number of criticisms of modern, commercial object-technology – especially about popular programming languages that are full of inconsistent features. His suggestion is to have a much smaller language with a few powerful ideas, and much more ‘ meta ‘ – the ability for programs to change themselves. Commercial programmers might find Squeak embarrassing: It’s far more powerful than Java and .Net, yet this power was present in old Smalltalk-80 (stabilized in 1980!). Perhaps we shouldn’t worry too much about the future of object technology: Croquet is a compelling showcase for well-applied object technology. After all the future isn’t what it used to be.

References
Croquet is due for public release “sometime this summer” at http://www.opencroquet.org

Squeak is available from http://www.squeak.org

Interesting projects for parents, teachers and children of all ages using Squeak can be found at http://www.squeakland.org

ViewPoints Research Institute can be found at http://www.viewpointsresearch.org

Dan Ingalls, Ted Kaehler, John Maloney, Scott Wallace, and Alan Kay. The Story of Squeak, A Practical Smalltalk Written in Itself. In Proceedings of the 1997 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA ’97), pages 318–326, October 1997

About the author
Dafydd Rees is a software developer specializing in object-oriented technology. He welcomes feedback on this article at http://www.dafydd.net/feedback.htm