Just A Summary

Piers Cawley Practices Punditry

Bwah hah ha ha!

Posted by Piers Cawley Tue, 06 Dec 2005 04:11:00 GMT

This evening, I acquired a commit bit for the Typo project. I’ve been chucking the occasional big patch and ideas at Scott Laird, the most active of the current maintainers, but he’s been busy doing all sorts of stuff, and he just started working at Google (go Scott!) so he doesn’t have quite as much copious free time as before.

So, this evening I asked for, and received, my very own commit bit. Which means I can make changes to Typo without needing to funnel them through a maintainer—I’m now part of the funnel.

Of course, responsible programming means I’ll still run big changes by Scott and the other maintainers, but it’s also useful to be able to make the kind of small changes that sometimes need to be made without it blocking on a busy man.

Wish me luck.

Thinking aloud about Typo

Posted by Piers Cawley Fri, 23 Sep 2005 07:41:00 GMT

Unless you’re interested in the internals of the Typo blogging engine and a possible rejigging of it, don’t bother reading the rest of this.

Typo Content Models

I’ve been attempting to follow the DRY Principle and rejigging Typo so that there’s fewer places with similar code to handle the cached html associated with a content object. Also, I’ve been thinking of how to build a more intelligent cache sweeper—at the moment, if you change a single article, every page in the cache is removed, which isn’t ideal. To that end I wrote a ContentModel mixin that adds a new class method:

class Article < ActiveRecord::Base
  include ContentModel

  content_fields :body, :extended
  ...

Declaring a content_field sets up a setter method that would notify any object observers that the content has changed and reset the associated _html attribute.

Which is all very well, but I think the time might have come to make a Content superclass. The various typo content models already have quite a few fields in common, and even Article, the ‘biggest’ of them doesn’t have too many unique fields, so using Single Table Inheritance a completely insane idea.

What does that buy us?

  • Conceptually, it buys us a neater model, albeit at the expense of a slightly scruffier table structure (Rails can’t do multi-table inheritance yet).
  • A unified ID scheme for our content models means that any putative table mapping content objects to currently cached files is going to be substantially simpler.
  • Threading. Add parent_id column to the table and, because of the uniform ID structure, a comment gets to have a parent that is either an Article, another Comment or (possibly) a Trackback.

How could it hurt?

  • The database table’s a bit scruffier.
  • Writing the migrations could be fun.
  • We’d have to make sure that the old articles/read/id URLs continued to work—Adding an old_id column is one way forward, but it strikes me that a better way to do it would be to extend the articles table until it had all the fields required then rename it appropriately and then copy all the other content objects into it.

Conclusions

Well, I think it’s worth doing. But it’s my idea, so I would say that wouldn’t I. If you’re a Typo person and you’re reading this, what do you think?

Version Control

Posted by Piers Cawley Sun, 04 Sep 2005 22:52:00 GMT

The trouble with version control systems is that, if you’re not careful, it’s almost as bad as having no version control at all. I’m currently juggling about 4 active branches of typo: the local development branch, the production branch and a couple of branches that isolate some of the local changes so I can make clean patches for the typo developers.

So far, I’ve managed to upload about 5 patches, and I’m still not sure if the patches that are up on the Typo tracker are sane. And back porting the clean new system’s been a complete nightmare.

Still, it could be worse. I could be still trying to understand the inner workings of Moveable Type.



Just A Summary