Rails 2.0 and the Future of Typo 4
So, if you’ve been watching the Typo tree, you’ll see there’s been a fair amount of activity on it since Rails 2.0 got released. There’s a new default theme replacing the rather creaky ‘azure’, and a fair amount of work on getting our code compatible with the current state of Rails. As we work on this, it becomes apparent that Typo’s code is getting horribly brittle. I have said before that there’s been several places where we’ve zigged before Rails zagged, and we’re paying the price for that. It doesn’t help that our test coverage is distinctly ropy either – and I’m probably guiltier than most for letting things get into that state.
So, our goal is to get what we have cleaned up and working with Rails 2 before releasing Typo 5.0. Once that’s done, that line of code will go into maintenance mode – there are still plenty of bugs to fix and documentation to write, but I’m afraid that extending that base is becoming too much of a chore.
Which is why I have a new path in my local svk repository, //stet. I’m using this for experimental development of a new, slimmed down blogging engine that will be, first and foremost, a capable Atom Publishing Protocol host. Things like spam processing will be removed from the core of the application, but we’ll provide a suite of webservice clients that will consume the ‘unmoderated feedback’ webfeed and use APP to either approve or delete the feedback as appropriate.
Theming (at least initially) will probably be confined to Javascript and CSS changes, and I’m even thinking of exposing the sidebars as Atom collections – certainly I expect that, in the first cut, sidebars will be static – if you want content that looks dynamic you’ll have to do it via javascript.
My initial goal is to slim things down as far as I possibly can – I want to build a blogging engine that can cope with the tight memory constraints of shared hosting by off loading much of the heavy lifting to client boxes. After all, I have far more processing capability available to me on the laptop I’m typing this on than the slice of Site5’s hosting infrastructure that’s actually running the blog. By making things small and static, I also hope to wring good performance numbers out of the tool as well – expect aggressive page caching at the very least.
Another important goal is easy migration of Typo databases. I expect to be writing models and controllers from the ground up, but converting the database should just be a matter of running a migration.
Experimental
Of course, stet’s currently very experimental – about the only thing that’s actually written so far are a couple of routing plugins which should help radically simplify our routes.rb (expect an article’s url to change from /articles/2007/12/16/rails-20-and-the-future-of-type to /article/2007/12/16/rails-20-and-the-future-of-typo, but with a redirect in place to cater for the old style urls). I may have grandish plans for the thing, but I could equally discover that I’m off up a blind alley, in which case you can expect me to return to the current typo codebase with a few more lessons learned.
ActiveResource?
I remain unconvinced by ActiveResource as a technology. I agree with the authors of RESTful Webservices – good webservices are joined up. They take full advantage of what could be described as the defining technology of the world wide web, the URL based hyperlink to knit resources together in a discoverable fashion. An ActiveResource based webservice may well be a good HTTP citizen, but it’s still not really ‘webby’ enough for my taste. Which means the Atom Publishing Protocol will remain my friend for most of the things I hope to do with stet. It may be harder to write a good APP server, but I’m convinced that it’s a much better interface for clients, and you should always favour ease of use over ease of implementation. If nothing else, we’re aiming to have more users than developers. Many more.

To be honest, the rich client is one of the things that drew me to typo in the first place. I’d be a sad panda if Typo-NG threw it away.
I doubt if it’d be going away for good; Frederic’s done sterling work on the admin interface recently, and there’s no reason we can’t make that interface, or something like it, play well with APP. The thing is, because APP is pretty well defined, it we needn’t be the only interface – there’s already an APP plugin for Firefox, for instance, and there will be more, I’m sure.
Piers,
Love Typo, but have a question. You’ve stated that you really are trying to get the engine slimmed down so that it can offload the processing work to the client, but are you considering that the basics of the existing engine is all server based? Offloading presentation to the client through JavaScript really doesn’t help very much and in today’s web technology, doesn’t CSS perform almost everything that you’d want to do in presentation anyway? Why even bother with JavaScript?
Consider this. Write the basic application in Ruby on Rails, then shove the content and presentation to the client using xhtml and css only. Since these are flat files, you improve on the speed of delivery and rendering at the browser level without the headache of using another interpreted language. This has an added benefit of being easier to learn on the user side, plus if they actually want to use JavaScript, they still can.
For the basic article display, you’re absolutely correct, and the aim of the game is to have a situation where the blog is mostly flat files in a directory structure that reflects the blog. Where I’m talking about using Javascript is in sidebars. Several of our currently sidebar plugins are dynamic and can’t be cached – when these are rendered within the page proper, it means that we can’t cache the page – no fun at all. If we limit sidebars to static text and force them to use javascript to fetch dynamic content we can continue to do page caching of the main content, but sidebars can be more dynamic by making AJAX requests.
I also plan to try and nail down the HTML as much as possible, at least for the vital elements of each page like the articles or comments with the aim of implementing chunks of the administration interface as ‘direct manipulation’ javascript, inspired by things like Seaside’s halos. So, an admin user would see handles on things like articles and use ‘click to edit’ semantics to modify anything, writing changes back to the server using APP semantics. There would still be an admin console, if only for batch work, but for ‘quick’ changes, I’m rather keen on a HUD/WYSIWYG model.
The other client side processing I’m thinking about is spam processing. If we add an arbitrary ‘state’ field, controlled by the client through APP, we can write a client that consumes the
/feedback.atom?state=pendingfeed, does spam classification and writes them back to the collection with a state ofpresumed_hamorpresumed_spam, it becomes relatively easy to write different clients for different spam protection strategies, something which has proved problematic with the current typo implementation, where spam protection measures can tie the server process up for embarrassing amounts of time.