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

laurent laffont laurent.laffont at gmail.com
Fri Jul 30 19:48:22 UTC 2010

Hi Sven,

I've enjoyed reading your tutorial, good work !

** I've tried to add a link on http://caretaker.wolf359.be:8080/reddit, it
always throw this error:

GlorpDatabaseReadError: ERROR: relation "reddit_links_id_seq" does not exist
at character 16

Your request could not be completed. An exception occurred.

** About code formatting, could you put the class name in front of methods ?
Like this:

    self points: 0; created: TimeStamp now


RedditDatabaseResource class>>login
    DefaultLogin ifNil: [ DefaultLogin := self createLogin ].
    ^ DefaultLogin

Sometimes I've been lost....

** from Common Lisp to Phyton. -> Python

I've never used GLORP so it was the hard part for me. Indeed I'm not sure
about this sort of code:

WAReddit>>voteUp: link
    self session glorpSession inUnitOfWorkDo: [ :session |
        session register: link.
        link voteUp ]

Can WAReddit be independent from persistence solution ? In ActiveRecord way
I would expect something like:

WAReddit>>voteUp: link
    link voteUp; save.

Anyway I will try to code it and see, it's a good opportunity for a
screencast :)


Laurent Laffont


On Fri, Jul 30, 2010 at 3:05 PM, Sven Van Caekenberghe <sven at beta9.be>wrote:

> Reddit.st - In 10 elegant Smalltalk classes
> Implementing a Reddit style web application in Smalltalk
> Using Seaside, Glorp and PostgreSQL
> http://homepage.mac.com/svc/Reddit.st
> 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.

> Enjoy,
> Sven_______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100730/5906f865/attachment-0001.htm

More information about the seaside mailing list