Just A Summary

Piers Cawley Practices Punditry


What happened to the routing rework?

Those of you who’ve been reading attentively will be aware that I’ve been working on a drop in replacemen for a chunk of Rails’ routing subsystem. You will also be aware that things have gone a bit quiet on that front.

I got a job.

Which is lovely, and fabulous, and safeguards my mortgage payments and all that good stuff. But it has rather put dampeners on any non paying work.

Finding the balance

What with throwing myself into the new job and spending last weekend visiting friends, family and the Brighton Coding Dojo mob, I’ve been neglecting other coding commitments. This should not be a permanent state of affairs, I’m hoping to return to the new routing project over the weekend. It’s all a matter of finding the balance.

Published on Thu, 26 Apr 2007 02:13:00 GMT by Piers Cawley under .

Must. Empty. Trash.

You know I said I was going to do some work with the Rails routing system? And paint my office? And sort out all the crap in Gill’s office so she’s got a nice place to work?

Well… Civ IV happened.

Wow, I’d forgotten how much of a time sink the Civilization games could be. Frankly it makes World of Warcraft (another game I had to back away from before it took over my life) seem like a mere casual game. (And, yes, I have seen the numbers on how long people will spend playing so called casual games).

So, it’s off my hard drive again and I can get back to doing stuff that I actually care about. Normal service is being resumed.

Published on Sun, 25 Mar 2007 07:32:00 GMT by Piers Cawley under . Tags

Ah... found it

Almost every time I hear Rails people banging on about Little Languages1, I find myself wondering what the fuss is all about – these things are not exactly new after all.

Then, while I was rereading The Structure and Interpretation of Computer Programs for the nth time and realising how much I missed the first n-1 times through, I came across this:

It is not exaggeration to regard this as the most fundamental idea in programming:

The evaluator, which determines the meaning of expressions in a programming language is just another program.

To appreciate this point is to change our images of ourselves as programmers. We come to see ourselves as designers of languages, rather than only users of languages designed by others.

In fact, we can regard almost any program as the evaluator for some language. … Seen from this perspective, the technology for coping with large-scale computer systems merges with the technology for building new computer languages, and computer science itself becomes no more (and no less) than the discipline of constructing appropriate descriptive languages.

That’s from the second edition, published in 1996, but I don’t doubt that the 1990 edition said something very similar. After all, it goes back to Turing.

The moment that it clicked in me that all programming is language design was one of those profound moments when the world seems to remake itself before your eyes – it comes back the same, but with a whole new set of perspectives on it. Understanding’s like that – the good stuff can (should?) remake your world.

1 Or, if you insist, Domain Specific Languages – a puffed up piece of nomenclature if ever there was one.

Published on Thu, 08 Feb 2007 03:21:00 GMT by Piers Cawley under , .

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.

I don’t know my way around a machine shop, except in the vaguest and most theoretical way. The tools I’ve grown up knowing to use are programming languages, editors, fine manuals and the mental tools a grounding in mathematics brings.

So, when I’m putting a new photography business together, and I realise that a couple of the supporting software tools that I had vaguely assumed ‘should exist’ don’t actually exist, I know that it doesn’t matter. I may not know Cocoa programming yet, but I know programming, so I’m confident that, like dad in his machine shop, I’ll be able to knock something up that does the job.

On reflection, I realised that this is probably a good thing. If I can set up and run the business with a combination of off the shelf software, then it’s trivial for potential competitors to reverse engineer the business and do the same (let’s assume here that the business is a success) and I’m left competing on margin in a service industry. No fun at all.

Being able to make my own tools gives me a competitive edge.

Why aren’t there more tool makers?

Published on Tue, 05 Dec 2006 11:07:00 GMT by Piers Cawley under , , . Tags , ,

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.

Published on Thu, 02 Nov 2006 11:20:00 GMT by Piers Cawley under . Tags

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.

Then I watched as the organizer’s reaction grew increasingly more aggressive, opening with a demand to remove the material, followed up by a ranting phone call and a couple of “I know where you live!” messages. His weblog entry on the affair mutated over time too. He ended up accusing me and my ‘cohorts’ of an orchestrated campaign of hacking, abuse and fraudulent spam signups.

Since I had orchestrated no such campaign, I took the view that I would not dignify such ludicrous allegations with a denial.

This morning, I learned from someone I trust that the organizer has indeed been subject to sustained attacks on his webserver. That both he and his 8 months pregnant wife have been signed up to porn mailing lists and have seen massively increased levels of spam.


What kind of infantile idiots do stuff like that? Seriously? How on earth is this kind of victimization of one side of a debate supposed to help anyone? For heaven’s sake, I don’t think the organizer set out to offend, that much is apparent from his reaction to my post.

If you, reading this, are responsible for the attacks and you believe yourself to be doing it at my behest, then please stop it and, if you have it in you, apologise. Your actions are despicable and I hope that, should you persist, you are caught and punished to the full extent of the law.

Why pull the entry?

I still stand by what I intended to say in my earlier message, but after more reflection and a bad night’s sleep, I also realise that what I wrote was hurtful. It’s all too easy to forget that the people we debate with are flesh and blood too. Frankly, being right isn’t a good enough reason to cause as much pain as I appear to have done, and for that I apologise.

Published on Thu, 19 Oct 2006 06:23:00 GMT by Piers Cawley under , .

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.

In July this year, my uncles, after being together for 36 years, got married. The law calls it a civil partnership, but it’s marriage in all but (official) name.

Yay! One Good Thing. Better than many governments manage I think.

In the light of that, Yesterday’s Observer carried a story that leaves me furious with my government and it’s pusillanimous approach to matters of religion.

The proposed measures would ban discrimination over the provision of goods and services, meaning, for example, that hotels which banned gay couples from sharing a room could be prosecuted. In turn, gay bars would also have to be open to straight clients. More broadly, the rules potentially affect everything from fertility clinics’ right to refuse lesbian couples IVF treatment to whether the tourism industry can promote heterosexuals-only honeymoon resorts, drawing several Whitehall departments into the row.

Faith schools have, however, led the protest, arguing that the rules could affect teaching about sex or require them to let gay groups hold meetings on their premises after hours. Catholic adoption agencies fear being forced to allow gay couples to adopt children. The Catholic church, which regards homosexuality as a sin, has suggested adoption agencies would close down rather than obey.

It appears that the cabinet is blocked on bringing these regulations forward unchanged or watering them down to allow for a religious opt out. Apparently the stumbling blocks are Tony Blair and Ruth Kelly (who is a devout Catholic). Well at least Blair will be out of the picture soon, but Ruth Kelly is the Communities Secretary. Frankly, it worries me that the Communities Secretary could be labeled a devout anything (well, maybe a devout liberal, but that’s a pair of words that don’t sit that well together).

Refusing someone equal rights simply on the basis of their sexuality is no better than refusing those same rights on the basis of their skin colour, sex or the colour of their hair

Admittedly, the UK is an awful long way from being Gilead just yet, but I had thought that our leaders were a bit better than this. It seems I was wrong. Again.

Published on Mon, 16 Oct 2006 03:40:28 GMT by Piers Cawley under .

Catching up with Dominus

Several years ago, Mark Jason Dominus gave a lightning talk entitled ‘Design Patterns’ Aren’t. I didn’t see the talk, but I did come across his writeup not long after I first discovered the Gang of Four’s Design Patterns book. In that talk, Mark put his finger on an issue that had almost subliminally bothered me: many (possibly all) the patterns in that book weren’t really patterns. At least, not in the way Christopher Alexander – the architect who invented the form – described them. Alexander asserts that:

… no pattern is an isolated entity. Each pattern can exist in the world, only to the extent that it is supported by other patterns: The larger patterns in which it is embedded, the patterns of the same size that surround it, and the smaller patterns which are embedded in it.

For Alexander, patterns only make sense as part of a pattern language. Reading A Pattern Language it becomes apparent that a great deal of thought has gone into selecting the patterns described and the presentation and ordering of the language so that pattern appears in an appropriate context. Throughout, Alexander stresses that these are no mere boilerplates; in one section he talks about the poetry of the language:

In an ordinary English sentence, each word has one meaning, and the sentence too has one simple meaning. In a poem, the meaning is far more dense. Each word carries several meanings; and the sentence as a whole carries an enormous density of interlocking meanings, which together illuminate the whole.

The same is true for pattern languages. It is possible to make buildings by stringing together patterns, in a rather loose way. A building made like this, is an assembly of patterns. It is not dense. It is not profound. But it is also possible to put patterns in such a way that many many patterns overlap in the same physical space: the building is very dense; it has many meanings captured in a small space; and through this density, it becomes profound.

Patterns also only make sense if they have ‘the quality without a name’, a quality they share the artefacts they are written to generate, the language in which they are embedded. In one chapter of Patterns of Software, Richard Gabriel grapples with what it means to say that software has the quality without a name and ends up taking a page (p42 if you’ve downloaded the PDF, and you really should, Gabriel has thought deeply and writes well about this stuff) to list some aspects of it. Paul Lynch, an old NeXT programmer friend of mine, reckons that this is because the quality without a name is the Tao and ‘The Tao which can be spoken of is not the true Tao.’ It doesn’t stop us trying though, but it does make it hard.

Looked at in the light of the quality without a name, many of the patterns in the Gang of Four book simply don’t have this quality. Dominus is particularly hard on the Iterator pattern, pointing out that it simply isn’t a universal solution to the problem of doing something with all members of a collection – it’s a workaround for weakness in static languages. In a more dynamic language like Perl, Ruby, Smalltalk and others, the language (or its standard library, the two are essentially the same thing) solves the problem with syntax like foreach or methods like each. There simply isn’t the need to build the infrastructure needed to kluge around the problem; it’s already solved in generic fashion which can be extended as appropriate (#inject, #map, #reflection_on_all_associations, …).

Another problem with the GoF book is that it’s not a pattern language but a collection of patterns (a problem which is acknowledged by the authors). In A Pattern Language Alexander and his team present their patterns with plenty of reference to the larger patterns which employ a pattern and the ‘smaller’ patterns it makes use of and this network of relationships reinforces and contextualises the individual patterns as they are discussed. Many of the patterns in Design Patterns are presented in isolation, or with an inconsistent set of motivations. Which is getting away from Dominus’s point and onto one of my own hobby horses. Sorry.

In Design Patterns of 1972, Dominus strengthens his earlier assertion. He claims that “Patterns are signs of weakness in programming languages” and uses the hypothetical Subroutine Pattern from 1972 and the way in which frameworks like Ruby on Rails and Subway have managed to internalize the Model/View/Controller pattern to make his case. He argues that identifying and documenting a pattern shouldn’t be the end of the story. Rather, we should have the long term goal of trying to understand how to improve the language so that the pattern becomes invisible or unnecessary.

Except, Rails hasn’t internalised the MVC pattern, it’s just made it easier to do the Right Thing. If you don’t have some understanding of the pattern, then the Rails Way is going to be bewildering to you.

Martin Fowler Refactoring can be seen as a pattern language – if you become fluent in the language, you’ll find it easier to improve the quality of your code. The thing is, many of the refactorings Fowler describes have been implemented as semi-automated tools. The book is useful even if you have access to a Refactoring Browser because the patterns are presented as a coherent language; the discussion of each refactoring and its motivation teaches you the why of the tool as well as the what. Without the why, the what is often virtually useless.

Kent Beck presents another pattern language in Smalltalk Best Practice Patterns, a book I’ve raved about before and will no doubt rave about again. Beck concentrates on the ‘tactics’ of programming in a fashion that makes your intent clear. His utterly humane patterns concentrate on matters like choosing good names for variables, methods, and classes, the appropriate use of Smalltalk Collections. Each pattern carries with it a clearly defined rationale, relating it to other relevant patterns. It seems that concentrating on writing a language has helped infuse the book with the quality without a name; the ‘grammar’ of it reinforces the individual patterns by tying them into a larger entity.

Both Refactoring and Smalltalk Best Practice Patterns present patterns that depend on the programmer adapting them to the particular circumstances in which they are used. It’s exceedingly unlikely that the Composed Method pattern, for instance, will ever be rendered invisible by a language feature – even if we end up using some other programming paradigm, it seems likely that there will still be a need to express our intent by decomposing functional units into well named, smaller, functional units. (Beck does have one pattern that addresses a language limitation – if your language has multimethods, you’re not going to need double dispatch). Many of the refactorings have already been implemented as tools, but they can be used to do awful things to code as well as to improve them. If you lack good taste and integrity, you’re stuffed.

In the end, I think Dominus is mostly right. Patterns are often signs of weaknesses in programming languages. But it seems obvious (though possibly in the same retroactively obvious way that great scientific discoveries seem obvious) that a pattern isn’t the end point. It’s a stop along the way; once you have a pattern it’s time to start looking at whether it’s a pointer to a language/library fix.

Published on Thu, 05 Oct 2006 16:14:00 GMT by Piers Cawley under , .

Yes... that would be me

In my semi regular trawl of the searches that bring people here, I was surprised to discover that someone had arrived searching for piers cawley nottingham university.

What do you know, they probably found the right person.

If you’re thinking that I’m more than a little curious about who has been searching for me, you’d be right.

Published on Fri, 29 Sep 2006 17:19:59 GMT by Piers Cawley under .

Capturing a rant

There was a session at EuroOSCON on ‘Music 2.0’ and very good it was too. However, during the Q&A, I found myself ranting about how the model of music as product is dead. About the only specific thing I can remember of what I said was “I make music because I must. I record it because it helps me improve. And I distribute it because I can.”

If anyone reading this was at the session and can remember what I said in a little more detail, I’d love to hear from you. It’s amazing how quickly things fade from the memory.

Published on Sun, 24 Sep 2006 03:22:00 GMT by Piers Cawley under , .

Powered by Publify – Thème Frédéric de Villamil | Photo Glenn