| JezUK Ltd - The Coffee Grounds - April 2008 |
| << March 2008 | May 2008 >> |
You couldn't necessarily be blamed for not noticing, but there are local elections tomorrow. You remember, it's why the kids are off school. I might sound slightly cynical, but I actually believe local elections are, or at least should be, quite important and that we should be concerned about the outcomes and what they mean. Local councillors really can make a difference to what goes on outside your front door, and so it's rather silly not to pay attention. I've actually been considering who to vote for pretty seriously from some weeks.
Here in Moseley and Kings Heath ward, there are seven candidates. One each from the three major parties, Conservative, Labour, and LibDems, plus candidates from the Greens, Respect, UKIP, and BNP.
As ever, the BNP candidate clearly isn't interested in the ward and is just standing to the BNP can tout they stood a full slate of candidates in the city. Interestingly though, last year the BNP fielded the only candidate who wasn't from round these parts, while this year both Respect and the Greens have had to reach out for candidates. The Greens are also fielding a full slate, but traditionally, Moseley and Kings Heath have pretty good for them so I'm surprised they couldn't raise a local candidate. Respect fields a handful of candidates, in and around Sparkhill where they have a councillor, so again I'm surprised they couldn't find a candidate from with the ward.
I can tell you this stuff, by the way, because I've actually gone looking for it. If I'd based my information on the election leaflets through my door, I'd only know about three candidates; Gaston for Respect, Howells for Labour, and Judges for Conservatives.
The Respect leaflet, printed as ever on expensive high gloss paper, was, as I recall, a generic vote-for-me-I'm-radical-I-am-I'll-stop-the-war-and-everything leaflet. If it omitted the detail about the candidate being a former priest you probably could have used it in any ward in the country. Pleasingly though it was largely missing the pretty blatant sectarianism of previous years.
The Labour leaflet was rather anodyne, apart from the little section laying into sitting Councillor Mullaney. Mullaney, the YouTube Councillor, was recently suspended for a month by the Standards Board for "showing disrespect" to a local resident. There's some debate locally as to whether this actually true, and even if it was whether he should have been suspended for it. There's a more radical school of thought that suggests the local resident in question actually deserves several weeks of minor damage to his car and perhaps a punch on the nose, but I digress. My point is it's not a surefire vote winner.
The most recent leaflet (which arrived over the weekend and I have in front of me), delivered FREE by your local Conservatives it says here, introduces Maura Judges who describes Moseley and Kings Heath in ways nobody could possible disagree with, having "good transport links with the City centre and other areas of Birmingham", and also "you are never far from open green spaces". Thanks Maura, I don't think I'd noticed that before. Maura is also "looking forward to getting to know [...] people [...] during the Election Campaign". Best get a move on, then, because it'll all be over tomorrow. The leaflet promises more money for recycling. It's short on details and, indeed, on platitudes, but the implication is that it's more money for kerbside recycling. It seems a strange thing to focus on, because we have kerbside recycling in Moseley already. There's also mention of the below inflation council tax increase, while also promising more money for social care services, schools and libraries. No mention on what might be cut to provide that, but I guess that's to be expected.
Surprisingly, no leaflet from the LibDems, as in the past they've been campaigning machines firing out leaflets all year round. They currently hold all three seats for the ward, and their senior man Mullaney is up for reelection for the first time you'd think they'd make a bit of an effort.
So, seven candidates standing. At least two of those, BNP and UKIP, are for show. Of the remaining five, two have failed to communicate with me in any form during this campaign, while the other three have managed one leaflet each, none of which was particularly memorable. I'm taking it seriously, but are the candidates?
Fiona Bruce, presenting the BBC News At Ten, has just revealed that Eastern European immigrants are all packing up and heading back home again. It's news that so exclusive and, well, new I listened to a half hour long programme on that very subject on Radio Four a month ago. In case the TV news people have forgotten, that's BBC Radio Four.
I pay the AA for breakdown insurance. In any conventional insurance arrangement I'd be called a customer, but for peculiar historical reasons the AA and RAC like to call the people who buy their breakdown cover members.
I'm not a member in meaningful sense. In the unlikely event of my car breaking down I just want to be able to have a cheery fellow in bright yellow van will come and rescue me. I certainly didn't "join" out of any kind of conviction nor, I suspect, did anyone else with an AA card in their wallet.
The AA, however, likes to pretend we did actively join and, further, it can speak on our behalf, and on behalf of the "motoring public" in general. It regularly issues statements on government policy, firing out, for instance, a slew of announcements about fuel duty when the Budget was announced.
Last week Edmund King, AA president (conventional insurance companies have chief executives), popped up on the radio to deride a rather radical proposal from Richmond Council to charge up to £75 pounds a year for permits to park near schools. "Some people live a long way from their child's school", he suggested at one point. Possibly, they needn't park outside the school gate and, in any case, "a long way" is a rather subjective measure. Our kids walk or cycle to and from school. The kids over the road get driven. While I'll concede they don't park right outside the gates, clearly our definitions of "a long way" are rather different.
Stand outside any primary school on the morning, and you'll see dangerous driving craziness caused by a combination of traffic volume, silly parking, and impatience. Anything which might result in fewer kids being driven to school is, I reckon, worth a go and if Richmond think charging is the way to do it, then let them try.
I absolutely didn't give my consent for the AA to speak on my behalf on this or any other matter, nor will I.
http://googleblog.blogspot.com/2008/04/helping-others-go-green.html
[added 24th Apr 2008]
As chair of the ACCU why don't you sound off on some issues on behalf of your members?
(Or maybe you want to call them customers?)
How Jez Higgins, Chairman of the ACCU said: "Our members are fed up seeing Government money wasted on code written without Unit Tests. Gordon Brown should mandate TDD to be used in all Government IT projects."
[added 24th Apr 2008]
One of the major themes of accu2008 was functional programming. That's partly because we deliberately skewed in that direction, inviting Simon Peyton Jones to give a keynote and asking Joe Armstrong to run one of the preconference tutorials, and partly because it reflects current discussion, both within ACCU and much more widely. If you look at some of our regular speakers, many of them of spoken on functional programming topics in the last couple of years so it's a sudden new or expected theme.
At the heart of function programming is purity. A mathematical function f given an input x gives a result y. And that's all. In a functional programming language, a function f given x produces y. And that's it. In a more conventional programming language (although I'm slightly uncomfortable with the term "more conventional"), a function f given x could produce y, then if you give x again it might give you back z, do a bit of logging, write something to the screen. And launch the missiles. Those are, perhaps slightly disparagingly, called the side effects. Pure function programming eschews side effects. Pretty much everything else that's associated with FP stems from that: concurrency, function composition, garbage collection, type inference (whether static or dynamic), and so on.
Of course, functional programming is nothing new, it's history goes back as far as computing itself, and the two languages most discussed currently and represented by their designer/implementors at the conference, Haskell and Erlang, aren't exactly spring chickens. You don't have to be knee deep in spurious parentheses to "be functional" though, many of people routinely use of functional programming languages or functional programming techniques in their everyday work. The often overlook XSLT and XQuery could, I suspect (on no particular evidence), be candidates for the most used functional languages at the moment, although the vast majority of their users wouldn't consider themselves to be "functional programmers". That's if you don't count spreadsheets which, as Simon Peyton Jones pointed out, are functional programming tools. We all nodded and said "ah, yes, of course!", because as soon as he said it we knew it was true, we'd just never considered it in those terms before.
What particularly pleased me was the generally pragmatic approach being advocated. Simon Peyton Jones gave a fantastic, engaging, energetic keynote on Haskell, a language he helps to design and implement, in which he characterised functional languages as safe but useless. If a program has no side effects how do you know it has run? he pondered. More conventional (although I'm uncomfortable with that label) imperative languages are, he suggested, dangerous but useful. Those side effects we try so hard to avoid are actually what we need to do any real work.
In order to become more useful, he argued, functional languages need to be a bit more dangerous, while imperative languages can become safer by becoming more functional. For me, that's the single most useful idea to take away from the conference. It's not necessary to throw away all your existing code and start afresh in some strange new language. Programming in Python or Java or Perl or C++ doesn't make you, as many LISPers in particular like to suggest, a lesser programmer with a smaller brain. Simply by examining your practice, and perhaps taking on some FP ideas, maybe formalising slightly something you already do, you can become an even better programmer.
Assign-only programming is one idea, which I first heard about from Russel Winder. He suggests that a variable should be assigned once, and then never changed. I think he developed this idea while teaching his students Java, to great effect. Immutable variables sounds like a bit of a contradiction, but matches the concept of a variable in mathematics. A variable may take many values, but at any given time it has a single, unchanging, value. Since FP languages use the mathematical notion of a function, they also adopt the mathematical notion of a variable. Assign-only brings that idea into imperative languages. Obviously it needs a bit of discipline because your compiler/interpreter is less able to help you (unless it supports the notion of const, say), but it's a relatively simple and, Russel argues, productive thing to try.
Peyton Jones advocates a strong differentiation of the pure code and the effects causing code. Rather that have effects throughout your program, they should be isolated. We often talk about seperation of concerns, partitioning, and so on, and what he suggested made a lot of intuitive sense. So much so, I'm slightly surprised that I don't recall having heard it suggested in quite those terms before. Haskell actually puts this idea right into its type system. Effects-causing functions in Haskell are called Monads, and there's some fierce mathematics behind them. Peyton Jones glossed over that, noting that he wished they had been called "warm fluffy things". A warm fluffy thing carries a type annotation, and (I think this is correct) cannot be called from a pure function. Since a pure function that called an impure one would no longer be pure, you can see why this makes sense. It's analogous to C++'s notion of const-ness. A const method is stating that it won't change an object's internal state, and so a const member function can't call non-const member functions [1]. This separation also fits will with Russel's assign-only idea.
There's more to be investigated here, particularly around my favourite little hobby-horses of pipelining, iteration, and algorithms. Unfortunately (or perhaps fortunately) my train's about to arrive and my batteries running flat, so I'll have to come back to it another time, if I ever get my thoughts sufficiently lined up. (The EEE I've been typing this on is fab, by the way.)
[1] - Let's leave aside const_cast please. It really isn't the type system get out of jail free card, nor is it the worm at the heart of the apple. The notion const-ness is a good and useful idea, a powerful one even. I've heard many people lament (indeed I've done it myself) the lack of const in Java and C#, Python too. Recently, I've heard it argued that C++ free functions, not just member functions, should be const-volatile qualifiable. That is an interesting idea. [back]
Revisiting position matches at the moment. I've described how position matches need to be written, and the code works and works well.
Except when it doesn't. It actually fails for the less common cases, and it took me a little while to work out why.
Here's the pattern from the test case that showed the problem
foo[@att1='c'][2]
It wants to match the second node in the set of foo elements with an att1 attribute containing 'c'.
Arabica rewriting finds the positional predicate and applies its incorrect magic. The rewritten pattern is equivalent to
foo[2][@att1='c']
which picks out the second foo node if it has an att1 attribute containing 'c'. The difference isn't immediately clear, even when you have the both the incorrect output and the expected output sitting in front of you.
My small crumb of comfort is that if you do want foo[2][@att1='c'], Arabica does do the right thing. That gave me the clue. Arabica implements XSLT match patterns by rewriting them as XPath expressions.
foo[2][@att1='c']
is rewritten as an XPath along the lines of
self::foo[. = parent::*/foo[2]][@att1='c']
My faulty rewriting of
foo[@att1='c'][2]
was
self::foo[@att1='c'][. = parent::*/foo[2]]
which you should be able to see is logically identical to the above. What I need is
self::foo[. = parent::*/foo[@att='c'][2]]
I had to work quite hard to see that this is what it should be, despite being pretty familiar with XPath and XSLT use and implementation. It's only been part of my working toolkit for the last 8 years or so, after all. When rewriting a positional match, any preceding predicates must be folded into the rewritten expression. Now I see it, it's pretty obvious. Failing tests now pass, which is lovely.
[added 18th Apr 2008]All the cool kids are doing it ...
jez@etrigan-ubuntu:~$ uname -a
Linux etrigan-ubuntu 2.6.22-14-386 #1 Tue Feb 12 07:12:19 UTC 2008 i686 GNU/Linux
jez@etrigan-ubuntu:~$ history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
83 ls
82 vi
72 cd
41 make
27 sudo
22 python
13 ./configure
12 ghc
10 autoreconf
9 svn
svn is rather lower than I expected, vi rather higher. The ghc represents a recent dabble with Haskell.
It's our fifteenth wedding anniversary today, so naturally I spent the morning in A&E.
Made a cake this evening though. There's something quite exciting about deciding to a bit of baking at eight in the evening.
Who's stronger - Microsoft or Open Source? It's the programmer version of Chelsea vs Arsenal, or Thor vs The Hulk. At the conference this year, Jan-Klaas Kollhof and Ed Sykes decided to settle it, once and for all. Sort of. Jan and Ed have, over the past couple of years, established themselves firmly in my must-see category (my chum Allan would have them as C to B transitioners) because they are funny and they do fun things. They decided to settle the who's stronger question through the medium of Lego Mindstorms robots.
Ed kicked off talking about the Microsoft Robotics Developer Studio. He'd obviously drawn the short straw because it seems to follow the standard Microsoft model for developer tools. It's clearly very capable, the simulator proved that, but by heck is it long winded. Everything seems to take an inordinate amount of code and a great deal of fiddling and faffing and pipes and connecting and event handling and what not. I suspect very strongly if you dug out your old "how build a COM container that works with almost anything" manuals, the robotics studio code would look very similar. It worked, but Ed appear thoroughly sapped of fun.
Jan-Klaas's straw, on the other hand, was extremely long indeed. Using free tools, he had his robot racing round the place in no time. The code was short, to the point, and extremely readable. I'm sure I could give Jan's code to Daniel and he'd be able to work with it. (Which may be the excuse I need!). Ed sat with a face like death while this was going on, and when Jan said "so I hooked up my Wiimote" he looked like he wanted the Earth to swallow him up.
So who's stronger? Robotics Studio is probably stronger on capability and generality, but Open Source is hugely stronger on fun. Me, I like fun.

More or less back on track after accu2008, the JezUK out-and-about number-one technical-beano-and-wingding. Haven't done a great deal of work over the last couple of days mind, but I think I've sufficiently internalised enough to properly concentrate tomorrow morning. The physical hangover wasn't too severe, which probably means I didn't work hard enough of the squash court, rather than anything else. Like sitting up half the night talking and drinking, for instance, in which I also indulged. (And yes, I was Lakosed, but not to the point where I had to do one-arm press-ups.)
Last year, I thought the programme was ridiculous good. This year's was better (or, depending on your outlook, worse). There were several occasions when I was interested in seeing four out the five sessions, and there wasn't a time when I was interested in less than two. It was ludicrously hard to decide, and I know from asking around that I was far from alone in finding it difficult. Giovanni, our conference chair, deserves hearty congratulations, right before we take him round the back and give him a good roughing up. Next year I'm shooting for a 15 days single track conference, just to make it easier on everyone.
As ever it was super to catch up with the, I now realise very, many friends and colleagues I have in ACCU. There are always more people to see, and as Chair there are extra demands on your time, and I was disappointed not get to the chance to meet some people. I said hello briefly to Thomas, but would have loved to spend longer with him. Similarly, by the time I realised that the tall chap with the young kids hadn't accidentally booked into the wrong hotel, but was, in fact, C++ threading maven Anthony Williams, I didn't get the chance to speak to him. Next year, perhaps. But hey chaps, if you're passing, give me a call and I'll take you out to dinner.
Just bought a piece of Fred Hembeck art and Berni Wrightson print from his Frankenstein illustrations. God bless the failing American dollar.
About to commence relocating the JezUK high-yield computing laboratorium-and-workshop infrastructure. Hopefully the move back will be less stressful than the move out.
Now to pack for accu2008, and then off my first ever ACCU Chair freebie - dinner at the UKUUG Spring Conference. Woo! [added 1st Apr 2008]
Packed. No bike :( [added 1st Apr 2008]
[Add a comment]
| << March 2008 | May 2008 >> |