This is a joyous ride, and I’m still on it! I’ve been rediscovering my “roots”, and moving forward. It’s ironic that technologies that are now decades old hold keys to the future. As I’ve written about previously, I rediscovered Lisp earlier this year. I’ve put that on the shelf for a while, but I intend to get back to it.
Back in August, I dug out some old Smalltalk code I had written for a couple assignments while I was getting my Bachelor’s in computer science, back in the early 1990s. I have fond memories of working with this language. Up to this point I haven’t had a chance to use it in my work, unfortunately. While I was finding videos for my “Great moments in modern computer history” post, I happened upon some videos of Alan Kay dispensing his wisdom, and demonstrating what he had been working on since about the late 90s: Squeak and Croquet. I talked about this a bit in my post, and gave a link to where you could watch one of his presentations. Here are most of the others.
Squeak/EToys, from Lisa Rein’s tour of Alan Kay’s ETech 2003 presentation
What first interested me in Squeak was its multimedia features. In the online videos of his presentations, Kay used Squeak to create his presentation slides. They look like they might’ve be done in Powerpoint, but they were not. They had integrated video and EToys demonstrations. I liked his demonstrations of what children could do with EToys, where they could draw their own graphical objects, and manipulate them with a little bit of script, or just using their “halos.” Halos are a Squeak concept. Since everything in Squeak is an object, even fundamental graphical elements like menus and windows, they can all be manipulated by the user in standard ways. They can be rotated and moved, made to disappear, etc., just by using the mouse. The same can be done with graphics that a user draws.
As I said before, Kay is worth listening to, even without the cool graphics. One speech to note is the one he gave for his Turing Award, which he received in 2003. I like the title of it: Alan Kay gave a speech when he won his Turing Award in 2003 entitled “The Computer Revolution Hasn’t Happened Yet.” Amen! The Turing Award is like a “lifetime achievement” award in the computer science community. Only people who have made significant contributions to the discipline are awarded it. There’s a list of previous Turing Award winners here. If you’ve gotten an education in computer science you will have seen at least a few of these names.
Croquet, from Lisa Rein’s tour of Alan Kay’s presentation at ETech 2003
Croquet is the more recent project he’s worked on. It’s like something I imagined would come along one day: a 3D user interface. Croquet is an expansion of the idea of Smalltalk. The intent is to create a collaborative environment. It uses elements that are already part of MMPGs (Massively Multi-player Games). Each user has an “avatar” in the environment, though you typically have a first-person POV. The team behind Croquet purposely made networking and collaborative computing easy. Like Smalltalk, Croquet is designed to encourage experimentation, and appears to be ideally suited for creating 3D simulations. It’s in beta at this point. While it looks neat, it’s not something I’m particularly interested in, but perhaps one day I’ll get into it. It couldn’t have come at a better time, since people have just been introduced to collaborative computing over the last several years, though as with everything else, what people usually see is a web interface. Croquet is more along the lines of the classical GUI, but upgraded.
Squeak is something I can relate to. It’s a free, open source implementation of the Smalltalk system. It’s the canonical object-oriented programming environment. Every object-oriented language shares many of its features, though the more popular ones lack some of them.
From what I can surmise, Squeak is a lot like the original Smalltalk system developed at Xerox PARC more than 30 years ago, though it’s gotten some updates. It has color, for one thing. It’s practically its own operating system, though it runs in Windows, Mac, Linux, etc. as an application. The interface is like the desktop-style UI we’re all used to by now (though I’ve heard it’s possible to run it in a “headless” mode, where you can just start it from a command line with no GUI). All code and data are stored as objects in an image file, not unlike the virtualization images used with bona fide operating systems in Virtual PC or VMWare. In reality, it’s probably more like Common Lisp, which also can create image files. Squeak allows users and developers to do unlimited undos to changes to its system. You can in effect “go back in time” to an earlier system state. Conceivably users could even use this feature to go back to an earlier version of Squeak than the one they have (not recommended–it’s better to just download an earlier release of Squeak if that’s what you’re after). It’s a bit like System Restore in Windows XP, and I’m sure Mac OS X has a similar system-wide feature.
This slipped my mind when I first wrote this post. Squeak comes with its own developer tools that you can select from a sidebar-type menu within the Squeak interface. There’s a lot to get used to with Squeak. Even though it has a desktop-style interface, it doesn’t operate like Windows or the Mac. A difference I noticed right off the bat is you do not double-click on icons to get a GUI program started. Rather you click and drag. Doing this starts the tool right up. Things are not where a newbie Squeaker expects them to be, so you have to have some patience and search for them. After a while you’ll get used to it.
It has an IDE, called a “Browser,” that allows you to see all the classes in the system, plus any that you create. It has its own code editor and debugger.
Developers can create GUI projects (analogous to an application) that run inside Squeak, using a GUI framework called Morphic.
Squeak has its own components for creating presentations as well. They’re fairly easy to set up and get going.
Squeak in education
Alan Kay has long focused on education. His Squeak/EToys demos are targeted at those interested in using technology in education. Squeak used to contain many working multimedia features, and that’s what they were targeted at. I talk about this more below. The educational site for Squeak is here.
Smalltalk was designed to be a fundamental technology upon which greater technologies could be constructed. For example Croquet is written in Squeak (Smalltalk). The Smalltalk programming language is powerful. Programmers can get things done in fewer lines of code than they could in most other languages. Some of the reasons are it’s a dynamically typed language, it implements method calls as parameterized messages that are passed to objects, it implements closures, and has support for continuations. Lisp shares all of these features except for the object-oriented message passing (though CLOS may have them. I don’t know). Closures are chunks of code that can be passed around between objects, but which maintain enough of the context from where they were created to execute them successfully when the referencing objects choose to run them. An analogy to closures would be anonymous methods in .Net and Java. Below are a couple of examples.
x := 0.
#(5 4 3) do: [:a | x := x + a].
Transcript show: x.
‘x’ is a temporary variable. The array #(5 4 3), in this case an array literal, has a method called “do:” that takes a closure. The code in between the ‘s is the closure. The part you see inside, between the ‘[' and the '|' is where parameters for the closure go. The part after the '|' is the logic of the closure. The array's "do:" method iterates over itself, passing each element into the given closure, using the ':a' parameter. The logic inside the closure adds each element to x, which functions as an accumulator. Transcript outputs the result, which is 12. Note that even though the closure is passed to an object, the local variable 'x' functions as though the code in the closure was running in the local scope.
To show the power of Smalltalk, I can shorten this into one line by using another method of the array class:
Transcript show: (#(5 4 3) inject: 0 into: [:a :c | a + c]).
Before I go further I should explain that it’s possible to combine messages for a single method. The above code is an example of this. There is an inherited method available to the array class, called inject:into:.
It’s two messages for one method, each message carrying a parameter It’s a method that takes two parameters.
What this does is “inject” 0 into the ‘:a’ parameter when the closure is executed the first time by the array. Thereafter the ‘:a’ parameter functions as a persistent variable inside the closure. The method iterates over the array, passing each element into the closure. The ‘:c’ parameter receives each element of the array. The logic is subtle. Each time the closure is called, what happens in effect is: a := a + c, and the end result of ‘a’ is the result of the method call. This gets passed into Transcript, which outputs the result.
Seaside – the Squeak Enterprise Aubergines Server and IDE
What made me pay more attention to Squeak is a web framework written for it called Seaside. One of the goals of Seaside was to make web programming simple. Avi Bryant, one of the creators of Seaside, has said that he tried to make it as simple as programming a thick client application. To do that, he used continuations. Seaside saves the stack state of the web application for each client session between round trips to the server, automatically. There is no session state to deal with! Secondly, you can have it detect backtracks by the user. An example Avi has used is an airline reservation system, where the user may want to try out a bunch of different itineraries. After going part way through Itinerary A, the user may backtrack either part way or all the way to the beginning of the reservation process, using the Back button on the browser, and pursue alternate itineraries. In the end, the user may want to go back to Itinerary A, and then want to check out. With some web application systems, if the reservation system is written badly, it might try to bill the customer for the last itinerary they tried, like Itinerary C.
This was disconcerting to me at first. As I read about packages like Mewa and Magritte, though, I realized that they do the job that I used to do in page templates. Where this way of doing things could conflict with project operations is if you normally have a page designer set up this sort of stuff.
Edit: I had just barely gotten this posted when Ramon Leon of On Smalltalk pointed out that I was not entirely clear in explaining myself! It is possible to do CSS programatically in Seaside, as he explains here.
Forgot to mention, you can use Squeak’s class browser and debugger to write your Seaside code.
Seaside is written in the spirit of Squeak. It implements “halos” like the Squeak UI does. You can turn them on inside your web browser while running your Seaside project, and do some manipulations of things onscreen. You can take a visual element in the browser window and have it bring up a web version of the Squeak class browser in another instance of your web browser, so that you can examine and change the code, without having to stop the application. Class browser, web browser… I know! The terms can get confusing! Smalltalk had the term “browser” first. It wasn’t meant to confuse people. The point is you don’t have to have access to the Squeak GUI to make minor changes to the application.
From what I understand these development features can be turned off when you deploy your app.
Hosting: Hardly any ISPs offer hosting for Seaside. I found one solitary Seaside host on the web at http://www.seasidehosting.st/. To boot they do not host commercial sites, or databases. So if you’re wanting to set up a business app., or one that requires quick lookup of lots of data, your only option may be to either work with a hosting company that’s flexible, that will allow you administrative latitude, since they probably don’t know about Seaside, or host the site yourself.
What about using a database? Squeak can interface with external resources, and this goes for databases as well. There are MySQL and PostgreSQL drivers that run in Squeak and interface with those database systems. There are several drivers for object oriented database systems, though the databases run outside of Squeak. There’s even an object-oriented database written entirely in Smalltalk, called MinneStore, so you can run it inside of Squeak.
(Update 9/23/08: Ramon Leon has written his own persistence framework in Squeak called SandstoneDB. He wrote it as a way of advancing the state of the art in web site development. He found some things about object databases wanting.)
How does a web server interface with Seaside? I’ll put up a separate post about this later. After doing some searching on the web I found one guy who was trying to get IIS to work with it. I think he managed to do it.
There are some hurdles to overcome, but from what I hear, the rewards are worth it. I’ve only read about it at this point.
Made here, used in Europe
This is going to sound like trivia, but it was striking to me. Squeak was written in the U.S., perhaps with contributions from abroad, and Seaside was written by a Canadian (apparently–Avi’s site is in Canada). Just about everyone I’ve seen who’s using these technologies are European, though I have found some American Squeak/Smalltalk bloggers. Most of the major sites are hosted in Europe (I’ll explain more about them below):
- Squeak.org, the official site for Squeak, is hosted in Germany
- Squeakland.org, an educational site for Squeak, is hosted in Germany
- Seaside.st, the official site for Seaside, is hosted in Switzerland
- lists.squeakfoundation.org, the Squeak/Seaside mailing lists, are hosted in Germany
- smalltalk.org, a Smalltalk evangelism site, is hosted in Canada
- The SqueakMap site is hosted in Germany
- SeasideHosting.st, the one public hosting service for Seaside, is based in Switzerland
I’m not saying there should be no participation in Europe. I just think it’s striking that there doesn’t seem to be that much use of this technology in the U.S.
In contrast, all the major Ruby on Rails sites are U.S.-based.
Flies in the ointment
I can’t give you an honest assessment of Squeak and Seaside without also talking about its weaknesses.
A glaring weakness, IMO, is how disorganized the Squeak/Seaside community is, in terms of web presence. There are a few Squeak/Smalltalk/Seaside “central” sites that seem to be the “places to go” to start finding out about it, but they’ve got broken links all over the place. Just the other day I checked THE central site for Squeak, http://www.squeak.org, and it was down. The main Squeak sites were down just a week ago, before they were brought back up again.
There are also Squeak developers and users who are up in arms over how its continued development is being handled. I talked to the author of a book on Squeak’s architecture and multimedia features recently, and he said he had given up on it. Apparently the multimedia features have been getting broken by the modifications the Squeak development team has been making to it. He recommended if people are going to use EToys or Squeak’s other multimedia features that they get Squeak Version 3.2 and stick with that. That’s the last version where all of these features worked.
Seaside apparently works fine with Version 3.8, the latest release marked “stable” as of this writing.
Apparently what the development team is trying to do is modularize Squeak, so that developers can downsize it if there are features they don’t need. I understand the impulse to do this, but I wonder if it was designed the way it is on purpose, and that perhaps something is getting lost by trying to split it up. You know, techies complain about how everything is integrated in Microsoft Windows, and they wish it was more modular, but integration creates certain advantages and disadvantages. People should do a cost/benefit analysis on it before dismissing this model. It may have been better to start from scratch than to try to make Squeak something it’s not.
The Squeak system itself has pretty good documentary support. There were a few books written on Squeak specifically several years ago. You can find them at Amazon.com. There’s only one that’s been written recently, targeted at programming for children, called “Squeak: Learn Programming With Robots”. It’s not about using Squeak to program real robots, just virtual, graphical ”robots” inside the Squeak environment. It’s more akin to turtle graphics in the Logo language. In addition, there are several free online books on the Smalltalk language.
There’s some introductory material on Seaside here, and here.
I was kind of amazed to find this, but apparently there’s a Squeak-.Net Bridge package you can get.
Some words of advice:
- Don’t get discouraged by broken external links. You’re going to run into a lot of them on Squeak-related sites. Even if they appear broken now, they may come back to life later. The same goes for the links on this blog post (though I can’t vouche for the links on the pages I refer to). Last I checked, all of my links worked.
- Some features you may see demonstrated in the videos may no longer exist. One screencast on Google Video featured page templates in Seaside. Yes, they once existed, but they were taken out later.
- Sometimes the main Squeak sites, like squeak.org, go down. It’s been happening some lately. If they are down, don’t worry. They will be back up again eventually.
Online resources for Squeak and Seaside, in no particular order:
- Squeak.org - This is the official Squeak site. You can read a little about it here, and download official releases.
- Squeakland.org – This is the educational site for Squeak. There are some online Squeak demos you can try out. You’ll need to install an ActiveX control, or perhaps a plug-in for your browser, since they run inside of a web page. I haven’t found this add-on yet, but I hear it’s available for download on this site.
- Seaside - This is the official Seaside site. If you click on the “Download” navigation link there, you’ll get access to Squeak image files that have everything you need to get started with Seaside (so you don’t have to put together the needed components yourself), plus a little instruction on how to get the Comanche web server (a component called WAKom, written in Smalltalk) started.
- On Smalltalk - A blog written by Ramon Leon, a former ASP.Net developer who has switched to using Seaside. His post, “Seaside for the .Net Developer” is worth reading.
- Learning Seaside - A blog written by Ian Prince on his experiences in learning Seaside, among other things.
- The terse guide to Squeak - This is similar to Quick Reference for Squeak, except it’s an HTML page. It briefly documents the standard Smalltalk types and how to use them.
- The Seaside mailing list - Hang out where the knowledgeable people are. Discuss/ask questions about Seaside. You’ll need to subscribe first. Posted messages are sent to your e-mail address.
- The Squeak Beginners mailing list - New to Squeak? Ask your questions here. It was pointed out by gcorriga of The Weekly Squeak that you can subscribe to this list and receive messages posted by others in your e-mail, or you can just e-mail your questions to the list, without subscribing, but your messages will be run through a moderator (to get their approval) before they are posted for everyone else to see.
- Smalltalk.org: the learning page - This is an evangelism site. It talks about all things Smalltalk. I’m directing you to the learning page here. It has a bunch of links to some good resources. Check out some of the navigation links to other parts of the site. I found the “Articles” page particularly interesting.
- SqueakMap - Once you get familiar with the Squeak environment, check out this site. It’s a comprehensive database of Squeak packages and projects. Some of them are the ones I’ve mentioned in this article. Apparently SqueakMap is similar to the Gems utility/service in Ruby. I’ve used the site, but you’re supposed to be able to use it inside of Squeak as well, to easily download and install packages, and updates to ones you already have.
Other Smalltalk Implementations
One last note. Just today I found Cincom Smalltalk. It’s a commercial development environment, but they have a free developer’s license. Like Squeak, it’s cross-platform compatible. It works on Windows, Mac OS, Unix, etc. It has .Net, COM, and C integration packages. You can use it to develop GUI and web applications, and web services. Pretty neat! You may see sites or people refer to VisualWorks. They were bought by Cincom, and the VisualWorks product has been integrated into Cincom Smalltalk.
There are many other Smalltalk implementations out there, amazingly enough. It seems to be a relatively small community. I think there are about 8 different implementations.
Read Full Post »