Seaside, Squeak and Smalltalk
I had an interesting chat with Nick last week and he mentioned the concept of continuations to me. One thing led to another and soon I was mucking around with an web application framework called Seaside. Seaside is quite a different type of web application framework from what I’m used to (J2EE-types, Struts, Webwork or even Ruby on Rails). For one it’s a continuations-based web application framework. Also, it’s a web application framework built with Smalltalk. Yes, Smalltalk.
That’s a language I’ve not heard for a long time. I remembered learning about Smalltalk last during my university days and not much about it since. Smalltalk, for those uninitiated, is the granddaddy of all object-oriented languages, first introduced about 35 years ago in 1971 but really made it as a programming language as Smalltalk-80 (in 1980 of course). It’s the first language that has the ‘everything is an object’ paradigm. Seaside runs on a couple of variants of Smalltalk but the one that I used is Squeak. Squeak, derived from Smalltalk-80 is an open source Smalltalk variant developed originally by Apple programmers in 1996 and currently has an active development community.
But what’s so special about Seaside besides being a web application framework done in a niche programming language? Without going into the details (that’ll take a lot of writing), Seaside provides some interesting features that I’ve not seen in any other web application framework I know. For example, Seaside encourages developers to create web applications with a macro view of the application flow instead of individual page flows. Web applications are made from highly re-usable components (really Smalltalk objects) which are not tied to the flow of the application, can have its own control flow, its own state and contain can other components. Seaside allows developers to model application flows in a single piece of code compared to modelling it in disparate HTTP request handlers (think servlets in J2EE or action classes in Struts or controller methods in Rails). Frameworks like Struts or Webwork tries to model this kind of flow in static XML configuration files, which is at best, a hack. Rails tries to do this in its own code by convention, which is a good attempt but the way Seaside does it is the best I’ve seen so far.
Seaside is full of interesting bits and pieces done by various members of the Seaside community, which I’m just barely touching the tip of the iceberg. Ajax is supported through the inclusion of Scriptaculous, the incredibly useful library by Thomas Fuchs. Connectivity to relational databases like MySQL and PosgresSQL is available, though connecting to object-oriented databases like GOODS is more natural. There are also OR mapping libraries, and all the normal stuff you’ll expect from a web application framework.
However Seaside is not all a bed of roses. Firstly if you’re like me, coming from a mainly C++ and Java background, you’ll find Smalltalk a challenge to even read (though you can try ‘I Can Read C++ and Java But I Can’t Read Smalltalk‘). The Squeak environment is Windowed and GUI, which is familiar but not so familiar. The environment is based on the concept of ‘images’ that are snapshots of the entire environment. Development is through a built-in Systems Browser and incredibly also at the web browser (I kid you not) which fascinated and freaked me out a bit initially. But like most new tools, once you get used to it, it becomes more natural and comfortable.
I’ll be doing more write-ups on Squeak and Seaside in the next few blog entries. Stay posted!
Some good links to learn about Seaside besides the official web site.