Powered by Burger

I’m working on a blog tool to use instead of blosxom. Not that blosxom is bad or anything, but since (a) it doesn’t do anything that can’t be accomplished with “static” HTML, (b) I want to become more at home with Ruby and© it doesn’t hurt to have a project going on in your spare time, I decided to replace it.

I’ve done a few spikes and some thinking to get familiar with the domain and potential designs, and yesterday I realized that the XP metaphor for Burger, as I call my tool, would be something along the lines of:

Files represent {blog entries}. {Blog entries} are “collected” according to different {criteria}. Each {collection} is “assembled” using a {template} into a {publishable}. Each {publishable} is “stored” in the web server’s document root.

The words within curly braces are objects and those within quotes are actions on those objects. Doing this, I realized that the “main” of the program should map roughly one-to-one with the metaphor. In other words, by looking at Burger.rb, you should be able to “read” the metaphor:

collector = Collector.new "index.html", \   (CountCriterion.new 20), \   (Template.new "/path/to/template") Entry.each "./blog/" do |each|     collector.consider each end publishable = collector.assemble publishable.store "/path/to/www/"

This would only create a front page with the 20 latest entries, but I think it expresses my the metaphor quite clearly. (Of course, it wouldn’t be possible for all types of systems to express the metaphor as easily as this. For example, a servlet-based system hasn’t got a “main” that you can read top to bottom. But I think it would be useful if it can be achieved.)

I can assemble the front page using Burger, but I need monthly and daily archives, too. This would be achieved by adding a collector for each month and day, and send consider to each collector for every Entry object. These collectors would have a TimeCriterion which inspects the date of each Entry object. This means that the set of concepts used to assemble a front page can be used to assemble monthly and daily archives, as well as separate categories (another type of Criterion), etc.

For example, I’m thinking of letting the tool create its categories automatically, by examining keywords in posts, so that when a keyword is used more than N times a new category is created, with a Collector collecting all Entry objects that passes the KeywordCriterion.

The above was posted to my personal weblog on June 28, 2002. My name is Peter Lindberg and I am a thirtysomething software developer and dad living in Stockholm, Sweden. Here, you’ll find posts in English and Swedish about whatever happens to interest me for the moment.

Posted around the same time:

The seven most recent posts:

  1. Tesugen Replaced (October 7)
  2. My Year of MacBook Troubles (May 16)
  3. Tesugen Turns Five (March 21)
  4. Gustaf Nordenskiöld om keramik kontra kläddesign (December 10, 2006)
  5. Se till att ha två buffertar för oförutsedda utgifter (October 30, 2006)
  6. Bra tips för den som vill börja fondspara (October 7, 2006)
  7. Light-Hearted Parenting Tips (September 16, 2006)