Mon 17 Apr 2006
The Constant Gardener
Category : Commentary/TheConstantGardener.txt
No, I haven't read the John le Carre book, nor have I watched the film. But this what I've learnt from pottering around the garden - that if you want something to grow, you've got to prune, prune, prune, and prune yet again.
It's about letting light into the dark places. It's about watching for the deadwood, and cutting them off. Works for plants. Works for organisations, too (most definitely for organisations). And it works for code.
I've put aside the server-side stuff in the last week, and I've been going through Luca instead, looking for patterns in Hai Hwee's code and pruning them off.
This has been Hai Hwee's version of The Long March. She's brought Luca from 4th Dimension, through PHP, to Java and now to Objective-C. It's like we had to go through this Hejira to figure out what we really wanted to do.
I remember years ago, showing the NeXT machine to a division full of people, and I was asked why we were doing this. I said that there was something there in the Object-oriented way of programming that we ought to take notice of. If I were to be asked the same question now, I would be a lot clearer and a lot more emphatic in my reply. I think I know why, now, this is all going to be good.
People who teach programming are missing the point when they focus on syntax in the programming language. The important issue is design. There's such a thing as finding the most appropriate, most natural shape for a program. It affects maintainability. And design is what gives you the leverage to build powerful features into the application. And as for humans, the best and most pleasing shapes are often the slender ones, carrying very little weight. There's an aesthetic to application programming design. If you're equipped with the sensitivity, you can see it in the way Cocoa works, which can serve as inspiration to the way you learn to code.
For example, Cocoa has a concept called notifications - where you can set things up so that one part of your program can listen in for changes that happen elsewhere in the program. So I have been working on this :
where the changes I make to an account record will be reflected instaneously in all other open windows, keeping all the data views in sync.
There's a real world reason why you might want to do this. Accounting, as I have come to see it, is about making an account of the data, telling the story about how the data is related and what it all means to the health of a business. So you're going to be opening quite a few windows, to look at the business from a variety of angles, and at a variety of depths. And you want the changes you make in any corner of that world to be rapidly propagated to the other views.
It's about the veracity of the data and about being able to trust what you see. And you can only trust what you see if all the figures line up wherever you look, no matter what you do to the data.
It's a small thing but it can throw you off rapidly if you're always needing to refresh the windows to keep everything in sync. When it's done right, it's possible for the user to forget that he's working with a machine, and immerse himself into the flow of the data and divine its meaning.
This kind of programming can be very hard to keep in sync, traditionally, because there are an infinite number of permutations. It's so easy to get the signals crossed. In all the versions of Luca we've done, we've never got it perfect. Until today. What has made the difference is Cocoa and object-oriented programming. When you're working with objects, and well-designed objects for that matter, you can look for patterns and factor them out, re-arranging them and the shape of the application, like you're re-working the shape of a plant. There's nothing you can do in traditional "linear" programming that can quite match this in conceptual power.
I think we've found the holy grail.
My kid was watching a program on Discovery Channel the other day about the making of a Maybach - those expensive, almost hand-crafted, powerful, luxuriously equipped cars from DaimlerChrysler. That got me sitting next to him, watching, too.
That's what we want to do. Build applications of such quality.
Luca may not yet look it, with its ugly buttons and so on. But underneath, in its engine and its chassis and its cabling, we're getting there.
Posted at 4:42PM UTC | permalink