Seriously? A Smalltalk web framework? While you might be skeptical at first, this just might be the the ultimate developer tinkertoy.
A Web application framework provides classes, tools, and techniques to rapidly build dynamic websites and Web services using modern programming techniques. A framework typically abstracts away common, Web-related operations, like interpreting data sent from a form, generating HTML, and persisting data, so you can focus on the features specific to your application.
Seaside is a Web application framework gaining popularity among developers. Seaside is similar to other frameworks, such as Catalyst (Perl), Rails (Ruby), and Cocoon (Java), but distinguishes itself by being written in Smalltalk, as a continuation-based framework.
Smalltalk is simple to learn, especially if you already have experience with object-oriented programming. The entire syntax can be learned in about a half hour, and consists (mostly) of unary messages, binary messages, keyword messages, blocks, and assignments. Code is organized into methods, which belong to a class, and everything in Smalltalk is an instance of a class. Nearly every class has visible source code, and you can override, extend, or (in extreme cases) monkeypatch the code to yield a new behavior. And because Smalltalk has been around for nearly three decades, there’s plenty of documentation, tutorials, and examples to study. It’s the ultimate tinkertoy.
Even better, the core code serves as examples for your own code, and the Smalltalk integrated development environment (IDE) provides features that even the most advanced commercial IDEs haven’t quite caught up with yet.
And best of all, when things blow up, the IDE shows a nice debugger stack trace, with the executing line of code highlighted. But the stack isn’t an autopsy—your code is still alive and well. You can poke and prod, add new code directly in the debugger, and even resume execution right from the point your application failed.
The debugger even works from the web in Seaside. If something blows up while you’re poking around your Web application, up comes the same debugger found in the IDE (or a Web-based one if you prefer) to reveal the live server state. You can poke at the stack, fix broken methods, and then resume, which refreshes your browser and reveals the corrected output, just as if you had coded it right the first time. This is called intra-hit debugging, and once you try it, you won’t be able to use anything else without regret ever again.
The Smalltalk community practically invented the notions of “Extreme Programming” and “Test-Driven Development”, and this applies in Seaside as well. You can write your unit tests to drive the web components to get pass/fail indicators, even testing all the way down to the generated HTML by using a simulated browser to poke at forms and follow links.
Seaside HTML templating is also done with Smalltalk. For example, to get…
… in Seaside you write:
html heading level: 3; with: 'hello'.
This reads as, “Ask the
html canvas for a heading brush, then configure it to be a third level heading, and include ‘hello’ as the content.) Although this looks a bit wordy at first, it becomes quite natural after a bit.
Additionally, the HTML brushes have some smarts to understand common page flow. For example, the code…
html image url: '/images/foo.jpg'.
… generates a classic img element. But you can also take a Smalltalk dynamically generated bitmap (called a form in Smalltalk, somewhat confusingly) and point the img element at that:
html image form: aForm.
Seaside arranges for the Smalltalk form to be converted into a PNG graphic automatically, and generates a dynamic URL to point to that image, even cleaning up after a few minutes when the image has already been requested and cached. Now that’s service.
Smalltalk also offers multiple implementations for vendor and license choices. Two open source versions of Smalltalk, Squeak and GNU Smalltalk, already work with Seaside; three commercial vendors (Cincom VisualWorks, GemStone/S, and Instantiations) are Seaside-compatible, and you can even buy support if you get stuck.
Squeak Smalltalk and Cincom VisualWorks both provide distributed development tools similar to got or mercurial, so your Web application can be built by a team. Of course, these tools are Smalltalk-aware, so a renamed class or updated instance variable doesn’t cause a lot of spurious merge conflicts. (GNU Smalltalk works with traditional files, so you’ll be using your favorite text editors and version control systems there.)