New Blog Features

Posted August 18, 2007

I promise I’ll stop talking about the blog pretty soon. But I just added some new features I wanted to talk about.

First of all, the post URLs are now pretty. For example, instead of /posts/23, this is now /posts/23-new-blog-features. This is mostly because I was getting annoyed looking at Google Analytics and being unable to remember which links went to which posts.

Actually, the pretty-URL thing has been around since the big major update, but it wasn’t as visible as it is now. Links from the front page used the pretty URLs, but links from the feeds didn’t. That’s fixed, now.

Luckily, the old URLs didn’t cause any compatibility issues. /posts/23 goes to the same page as /posts/23-new-blog-features. In fact, it doesn’t matter what you put after the number; /posts/23-the-way-you-can-go-isnt-the-real-way goes to the same place as well. This is so that, in the event that I change the title of one of the posts, the old URLs don’t break.

Why I'm Not Doing Anything

Posted July 31, 2007

Recently I haven’t been very active in the various projects I’m involved with. I’ve been doing stuff like applying patches and fixing minor bugs for Haml, but no major development. I’ve answered a few make_resourceful questions on the mailing list, but haven’t touched the code. I’ve barely even thought about Scribble. I’ve even been negligent in my blog posts; this is my first post in over a week.

This isn’t because I’m losing interest or anything; on the contrary, I’d love to spend more time working on this stuff. I just don’t have more time. Microsoft takes up a good ten hours every weekday (eight hours there and an hour-long commute each way). I’m a zombie if I don’t get enough sleep. That doesn’t leave me with a lot of free time.

What time I do have, on weekends and squeezed in on weekdays, I’ve been spending (perhaps foolishly) on a personal project. I’m not ready to unveil it yet, although I’ve talked to some folks about it. It may never see the light of day at all. But it’s fun to work on, so it’s also been sucking my time.

New Blog (Engine) Soon

Posted July 13, 2007

As some folks may know, the engine on which this blog runs was written by myself. However, the code was not the prettiest thing ever to grace the tubes. I wrote it in a nice, RESTful manner, but as I noticed that I was repeating a large amount of code, I tried to abstract it out into various separate methods. The result ended up being rather messy. But then I moved on to other projects and left the engine as “good enough.”

A little over a month or ago, though, I decided it was high time to revise it. I’m very fond of the idea of revising code. In the best English course I ever took, we talked about the idea of “revision.” The professor explained that revision was literally the process of seeing your text again: “re,” meaning again, and “visio,” the same root from which comes “vision.” After just getting all your ideas down on paper, you take a step back and read them from the perspective not of the author, who by definition already understands everything that’s going on, but of a reader. This allows you to see weaknesses and potential strengths in a way that was impossible before.

The same principle applies to code. Once it’s written, it’s quite effective to take a step back and adjust your perspective. So I did for my blog; I essentially dumped all my REST-abstracting code in favor of make_resourceful, added a bunch of specs, and generally made the code cleaner, smaller, and more readable.

Overview of make_resourceful 0.1.0

Posted May 26, 2007

I said last Monday I’d mention when the make_resourceful Rails plugin, which Hampton Catlin, Jeff Hardy, and I have been working on, is released. Well, as of yesterday (the 25th) around midnight, it was. See Hampton’s blog post for the official announcement. The main points are as follows:

  • Very alpha release. The API is subject to change, although it probably won’t for the most part.
  • There’s a Google group.
  • Install with ./script/plugin install

For those who didn’t catch my last post about it and are too lazy to go back and read it, make_resourceful is a plugin that allows you to factor out all the repetitive REST code that clutters up the controller a surprising amount. It manages this by automatically creating typical RESTful actions, while allowing plenty of room for user customization.



Posted May 21, 2007

I just (well, as of last night) got back from RailsConf 2007, which I was attending courtesy of Unspace as a sort of thank-you for working on Haml. It was great fun. I got to meet many awesome people, including Hampton Catlin, with whom I’ve been working on Haml for a long time but whom I’ve never seen in person, as well as the rest of the Unspace team; various folks with whom I’ve talked on the Haml, Scribble, and Hackety Hack mailing lists; a couple members of the Rails core team; and too many other people to list here.

I also went to lots of engaging (and a couple boring) talks. By far the most interesting of these was a talk on a soon-to-be-released plugin called make_resourceful. The basic idea is to DRY up the code in RESTful controllers. Even with the new Rails support for REST, there’s some code that’s just always repeated. For example, for even a minimalistic update:

def update
  @person = Person.find(params[:id])
  if @person.update_attributes params[:person]
    redirect_to person_url(@person)
    redirect_to :back

Now, that’s not terrible. It’s only six lines. Most of the other typical RESTful actions (index, show, new, edit, create, update, destroy) are similar in length or shorter. But they’re all the same; the code is repeated over and over again. And when you get to having nested resources the code gets messier: