[Seaside] [Article] Reddit.st - In 10 elegant Smalltalk classes

Sven Van Caekenberghe sven at beta9.be
Fri Jul 30 13:05:23 UTC 2010

Reddit.st - In 10 elegant Smalltalk classes

Implementing a Reddit style web application in Smalltalk

Using Seaside, Glorp and PostgreSQL


This is a tutorial showing how to implement a small but non-trivial web application in Smalltalk using Seaside, Glorp and PostgreSQL. Reddit, is web application where users can post interesting links that get voted up or down. The idea is that the 'best' links end up with the most points automatically. Many other websites exist in the area of social bookmarking, like Delicious, Digg and Hacker News.

In 2005 Reddit switched their implementation from Common Lisp to Phyton. As a reaction I published a Lisp Movie (screen cast) called Episode 2: (Re)writing Reddit in Lisp in 20 minutes and 100 lines also known as Reddit.lisp - In less than 100 lines of elegant code. Although the title was provocative, to get attention and for fun, and this was lost on some people, the key message was just to show that it is perfectly possible to write nice web applications in Lisp and to give an example of how to do so. The reasons for their switch were social, not technical.

Reddit.st is yet another variant of this example, reimplementing the example in Smalltalk. It adds persistency in a relational database, unit tests as well as web application components to the mix.

The 10 main sections of this article follow the development of the 10 classes making up the application. The focus of the Smalltalk version is not so much on the small size or the high developer productivity, but more on the fact that we can cover so much ground using such powerful frameworks, as well as the natural development flow from model over tests and persistence to web GUI.

Reddit.st is running live at http://caretaker.wolf359.be:8080/reddit

Source code is in the Reddit package of http://www.squeaksource.com/ADayAtTheBeach.html

Feedback and remarks are welcome.



More information about the seaside mailing list