Activity

What I've been up to recently

Cast an eye over my new venture. It’s pretty much a place holder site at the time being, but I’m beavering away at the bits that need beavering away at.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Blessed are the toolmakers

My dad drives a vintage Fraser Nash. I say drives, but that’s only half the battle, a large part of his Nash time is spent fettling it. It’s an old car; bits wear out, break or drop off. And because it’s an old car, you can’t just nip round to Halfords and pic up a replacement; nor can you head down to the breaker’s yard and cannibalize something else. So he has a lathe and a milling machine and a bewildering collection of tools. When he needs a part, he will disappear into the machine shop and, after sufficient swearing and/or bleeding, he will emerge with a newly made part. For dad, it’s all part of the fun of running a vintage car. If he weren’t able to do the work, the Nash would have had to remain a pleasant pipedream.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Getting the Rspec religion

I’ve been eyeing the rspec and rspec on rails packages and thinking I should give them a go.

To my eye at least, something like:

context 'Given a published article' do
fixtures :contents

setup { @article = contents(:published\_article) }

specify 'changing content invalidates the cache' do
`article.body = 'new body'
    `article.invalidates\_cache?.should\_be true
end
end

context 'Given an unpublished article' do
fixtures :contents

setup { @article = contents(:unpublished\_article) }

specify 'changing content keeps the cache' do
`article.body = 'new body'
    `article.invalidates\_cache?.should\_be false
end
end


reads far more fluently than the equivalent Test::Unit based tests:



class CacheSupportTest < Test::Unit::TestCase
fixtures :contents

def test\_changing\_published\_article\_invalidates\_the\_cache
art = contents(:published\_article)
art.body = 'new body'
assert art.invalidates\_cache?
end

def test\_changing\_unpublished\_article\_keeps\_the\_cache
art = contents(:unpublished\_article)
art.body = 'new body'
assert ! art.invalidates\_cache?
end
end


So, I installed everything and started to work on a new class in Typo using rspec. Rather annoyingly, this seemed to break the current test suite, so instead of working on my new model class, I set to porting the existing suite.

And, on about my third test suite, I found what I think is a bug in the suite. I'm not *sure* it's a bug, because, the way the test is written (by me, I admit it), masks the intent quite dramatically. I'm also finding that the freedom to name specifications and contexts in English rather than `method_names_that_go_on_for_ever` is forcing me to come up with much more useful descriptions of what I'm testing. I find myself working on making the spec runner output read reasonably well as English, and doing that casts light on what is and isn't being tested.

I've known for a while that Typo's test suite is, um, spotty, but the porting process is really helping me get familiar with what's being tested. I'm half tempted to start adding extra specs as I go, and if I could work out how to keep the existing tests working while I did it, I would, but my priority for now is to get to the point where I can check the specs and be confident that the new specs are no worse than the old tests.

Because I'm much more confident that I know what the specs are *doing*, I'm also confident that it won't be hard to revisit them to help specify typo's behaviour better. I'll just have to give myself the discipline of beginning each coding session with half an hour of fleshing out the specifications before I get back to adding behaviour.
    
  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Everyone is human...

Why do people have to be human with my new computer?

You would think that arriving home and opening up a brown cardboard box and pulling out a shiny new 15" MacBook Pro 2.16GHz would be a fine thing wouldn’t you?

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

A sketch of declarative ActiveRecord Migrations

Writing migrations can get pretty tedious when you’re being scrupulous about writing both the up and the down side of the migration. Okay, so the Textmate ninjas amongst you can use scarily clever snippets to populate the down migration while you write the up method, but I can’t be the only Mac user who still prefers Emacs. And not everyone gets to run on Macs either.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Typo on Rails 1.2

Typo users with longish memories will recall the absolute disaster we had when Rails 1.1 shipped and Typo wasn’t even remotely compatible with it. Even edge Typo didn’t work with 1.1. Chaos and confusion, strong words from DHH, all manner of unfun things.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Dear LazyWeb

I would love to be able to run a slideshow on a second screen based on a ’live’ album in Aperture. So, when I drop an image into an Aperture album on my primary screen, it shows up when appropriate in the secondary screen slideshow.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

How do you find me again?

Hmm… it’s been 3 months since I last did this. Time for another look at the incoming queries log.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Precalculating in Typo

You may or may not know that Typo is multiblog capable under its hood. There is a blogs table in the database and every single request ends up fetching the blog object by doing a Blog.find_by_base_url query.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Getting back to Typo

I’ve been taking an accidental sabbatical from Typo. It started during conference season, then there was a bunch of housekeeping and general home type stuff that needed doing, so I’ve been away from the codeface for a while (and I still haven’t turned my EuroFOO talk into a podcast, or finished scanning and uploading all the EuroOSCON photos…)

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Second thoughts...

I just pulled the the entry entitled It’s not just open source that has a problem with sexism. Here’s why:

My intention was to point up the kind of unthinking, ingrained sexism that is all too common in our field. My friends’ email exchanges with a conference organizer were textbook examples of the sort of thing I mean, so I used them and posted them pretty much verbatim without a thought. I was aware that it might cause offence, but my aim was to make the organizer stop and think about the message his conference website was sending out. So, basking in the knowledge that I Was Right, I pressed publish and was damned.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Perspective

I stand by what I said in my last post. The fight against that kind of ingrained, unconscious sexism is one that is well worth fighting.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Rolling back the enlightenment

Whatever your opinion the the Iraq war, whatever you think of Our Glorious Grinning Leader, it is still possible to point to at least one unqualified Good Law brought in by our current government.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…