Debugging the minefield

When building any significant software system (by which, let's face it, we mean something greater in complexity than "Hello world\n") we are going to end up with bugs lurking in the system, in the same way that landmines lurked beneath the soil of freshly-ploughed fields in the Fulda gap in the mid-80s. Perhaps comparing the methods of clearing these lurkers might make their merits and demerits plainer.

Crawl and bayonet
Highly-trained engineers push their noses through the mud, probing gently with a long sharp bayonet to feel for the edge of mines beneath the surface. Generally effective at clearing a sufficiently wide path through the field for the following troops, but won't even try to remove all the mines; anyone who steps out of the marked path deserves all they get. (Dedicated testers and bug hunters. Expensive, but reasonably reliable within limits)
Mine detector
Cheap but effective kit that identifies any ferrous material within a few feet of the sensor and allows the user to mark off the area for later leisurely detonation. Only really useful for very sparse minefields if you're in any sort of hurry. Completely ineffective and induces a false sense of security for e.g. plastic mines. (Lint)
Flail / line charge
Specialised engineering kit either smashes a path through the mines with rotating chains, or fires a long tube of explosive which then detonates and explodes the mines underneath. Hopefully. Usually good at getting 90%+ of mines, but bad luck for the unlucky trooper who then walks over one of the 10%. Also only effective if the mines are the targetted pressure-sensitive kind. Fast and relatively cheap, at least once you've bought the machine. Not too much skilled labour required. (Debugging tools such as buffer overflow detectors, lint, Purify)
Drive a large flock of sheep over the minefield. "Baaaah" FOOM! "Baaaaah" FOOM! Like a flail, but less specialised and a lot cheaper. Morally dubious. (Beta-testing)
Infantry charge
Fix bayonets and run over the minefield at speed. You may or may not choose to tell them about the minefield beforehand. Very quick, but prone to erode your squad considerably. Also worth noting that the remaining squad are likely to want to hunt you down. (Release 1.0)
Go around
If you know the minefield is there, why go through it? Of course, the alternate route may take you quite a lot longer - and who knows, your enemy may have an ambush party placed along it. Or another minefield. (Green-field redevelopment)
What minefield? No-one's going to have sown a minefield in my path. (I'm sure we've all known developers like this.)
Precision targeting
DARPA-funded smart sensor/weapon technology that does a wide-band sensor scan of the area, characterises mines and fires precision munitions through the middle of each one. Comprehensive, destructive and not too long to run, but potentially ruinously expensive to develop, and generally only works in one or two types of soil. (Formal methods, proof of absence of run-time errors)


Another 24 hours in A+E

The money quotes from this evening's episode of stabbing, slabbing, blabbing and blubbering:

Amanda the med tech: "When people come into the department, they're often very scared and so it's nice to be able to put them at their ease." Just before she rams a wide-bore needle into them and sucks out their blood. "Welcome to Kings, have a nice day!"

(Why do people have the instinct to look away when they get needles shoved in their arm? Wouldn't you expect the natural reaction to be a check that blood isn't spurting out of the wound as from a ruptured fire hydrant?)

John with the abdominal aortic aneurysm: he'd spent 140 quid on a private medical screening which had spotted the ballooning aorta and referred him to A+E. As his doctor said: "Best 140 pounds you ever spent!" So much for GP health screening. They took him off to Coffin Ward (well, that's what he and I thought it sounded like). Nice job, whoever came up with that name.

They have a sandwich trolley in the waiting area. Now that's not a bad idea, and one our local A+E could certainly use. Serving coffee you can actually drink would be quite the advance too. 

Pritpal the sandwich guy: "I wanted to be a doctor, but thank God I have my health and I can play even a small part in making people better." Quite right, chap.

Two chubby smokers come out of the department to light up. "Ah, that's it man, real air, not like that recirculated shit they have in there." The irony meter nearly melted.

92 year old Irene showed Job-like tolerance of a sustained patronising from her consultant Liz. After admitting to a nip of brandy morning and evening, she was told "Since you've got to the ripe old age of 92, I think we'll let you have that." Excuse me Liz, "let you"? Irene got this far in life, having lived approximately three times as long as Liz, she can do whatever the heck she wants.

Darren has hurt his foot from kicking a chair while playing a computer game. If breathing wasn't an autonomic reflex, Darren would be dead in short order. Between him and his girlfriend they have comparable intelligence to a below-average cat, but not quite as much common sense.

On the bright side, only one minor stabbing, and they skipped lightly over it. I was wondering whether this was to give more variety in the programme, but another stabbing featured prominently in the trailer for next week's episode, so fans of deep-penetrating trauma can look forward to it.

According to an advert, Mercedes has "125! years of evolution". I don't think the universe has been around for quite that long. 


A l'eau, c'est l'heure

Some special pleading in The Grauniad today about the continuing decline of foreign language studies in the UK. I have some slight sympathies to the viewpoint - every time I hear a UK tourist trying to make themselves understood in France / Germany / Spain / Italy, their combination of a raised voice, speaking slowly and exaggerated gestures is prone to bring tears to one's eyes.

I did have to concur with SamLogan who wrote:
Learning languages may lead to a more 'rounded life', but it has a massive opportunity cost. Time spent 'broadening your horizons' by learning a language, and the countless hours of verb drills and trying to roll your r's could alternatively be spent learning an instrument, training for a marathon, joining Lulzsoc or curing cancer.
I've spent enough time in language classes for it to be plain that a relatively small number of people enjoy and are reasonably good at learning and speaking it. For everyone else, to gain something close to a working knowledge is going to require near-immersion in that language for a while -- and even then, they're going to be left with a pronounced accent and awful grammar. For foreigners learning English, they have the advantage of a) any number of English-language TV channels, musicians and Internet sites, b) English being established as the dominant international language on the planet thereby making it the single obvious target to learn and c) sufficient English natives having a pronounced accent and dreadful grammar that they'll be able to blend in.

Having the opportunity to learn a foreign language or two in school is a good idea. Everyone should try it, and schools should encourage pupils who show ability - even if they don't end up using it directly, good command of a foreign language is an excellent signal of general ability, literacy and diligence to employers. But don't hold a gun to a student's head because they can't wrap their mind around der-die-das-die-den-die-das-die-des-der-des-der-dem-der-dem-den.


Being served well, and serviced good and hard

There's nothing like international travel to contrast business models. With the scars of a recent trip fresh in my mind, and a swathe of interactions across the whole spectrum of government - private - individual - corporate entities, I thought I'd jot down a guide to those most recently encountered that stood out.

The minimum wage hospitality employee: in this case, a hotel maid. Huge competition for her job and a "flexible" labour market meaning that she'd better keep on her toes or be out on her ear. Wage probably close to minimum wage, but supplemented by significant tips. On the downside, she seldom meets the guest so the guest will tip on a combination of the standard of the maid's work, the guest's ignorance of the local tipping system and their tightfistedness. Will always say hello and smile at passing guests because that makes a personal connection and makes the guest more likely to up their tip or feel bad at not tipping. Lives or dies by the standard of her cleaning and the rate of room completion, with the hotel owner specifying the balance. Probably has an OK healthcare plan if the hotel is part of a chain, so very keen not to lose it. All the cleaning I've seen has been impeccable, and I hope I tip well. Hours probably rota'd and (in the case of a large hotel) can probably get all the hours she wants as long as she delivers. Aspires to position such as housekeeping manager but that is likely many years in the future and she's going to have to take on college-educated locals and battle them using her hard-won experience. Day-dreams of being sexually assaulted by the head of an international finance body and making him pay through the nose for his sins.  

The professional hospitality employee: in this case the previously blogged Amy the hotel bartender. Very visible public role serving both hotel guests and passing visitors. Reasonable salary and corporate benefits, roughly increasing with the size of employer and status of the hotel. Still gets significant income from tips (I did the math from sitting in the hotel bar for an hour blogging, and estimate she could easily clear $50/hour when it's moderately busy). Performance assessed by bar income and customer feedback, the latter of which is fairly nebulous. Substantial diplomatic skills required to survive and prosper, notably the ability to manage drunken guests with an over-inflated sense of self-importance. Has to have great people skills to survive and prosper, managing and balancing guests' wants with employer requirements and targets. Hours fairly anti-social as they are inherently the opposite to normal working hours. Dominant income influences are the ability to anticipate guests' wants and to build relationships with long-term and frequently-visiting guests. Probably aspires to hospitality manager if she's willing to make the hours/pay tradeoff. Day-dreams of the bladdered corporate finance team ordering a couple of magnums of the '65 Bollinger and tipping 40%.

The private entrepreneur: in this case, an airport car driver. He gets his business from your firm, but only on a very loose arrangement; winds change, corporate travel budgets are cut, an influx of new car drivers and suddenly his income can halve or go away entirely. You're not paying him personally unless you give him a tip, which with corporate-organised cars isn't too likely. He doesn't want to give you a bad experience because you might report him and bang goes his contract; on the other hand, there's no personal repeat business so he's not going to go out of his way to be friends. Time is money, so if you want to get to the airport as soon as humanly possible then your interests and his are near-perfectly aligned. Prepare for a heart-pumping journey of swerves, acceleration and sudden braking. The only limit is his personal assessment of the likelihood of a crash - that would severely dent his income - so you have to hope he's not over-confident in his abilities. No real employer so lives day-to-day, will drive even if he's so sick he can barely see. Day-dreams of the frantic corporate executive hailing him outside La Guardia and instructing him "Get me to Chicago O'Hare before 6am and there's a $1000 bonus for you".

The corporate crew: in this case, the international airline's check-in staff. Usually measured by the most abstract or obtuse appraisal scheme that their HR department can dream up, and actual customer satisfaction will barely tweak the needle of their personal cost/benefit meters. They are likely to be efficient and well-trained in corporate procedures, and so a customer who knows the system can usually leverage this; customers with significant status in the corporate loyalty scheme tend to do OK. Somewhat vulnerable to the it's-half-an-hour-to-hometime dip in service level. Often unionised in the USA, so seniority is more likely to go with time served than actual ability, and performance-related compensation to be fairly limited. If you get exceptional service it's down to sheer luck or the ability to connect personally to the clerk in question, though actually poor service is rare. Reasonable health plan and sickness benefits. Day-dreams of being on the other side of the counter on the way to Honolulu, first class.

The public sector entity: in this case, the TSA (motto: BOHICA). Almost no actual security threat to guard against, so they can apply security theatre to their heart's content. Customers, in this case better described as victims, have no option to avoid them or go to a competing firm. Very effective sanctions can be applied against troublesome customers. Anyone with the sense that the good Lord gave gravel will shut up, remove their shoes and do as they are told. The main performance measure is throughput - if enough people miss their planes the airlines will complain - so as long as they speed up at peak times they can take all the time in the world when it's quieter. The only likely form of personal interaction is to chat up a good looking customer of the appropriate gender, who will smile politely and not make trouble for the reasons detailed above. A byword for customer service - specifically, "if you provide customer service like the TSA, you'd better be running a government-backed monopoly or you'll be bankrupt in a week". Unionised Government employment conditions; salary probably not high but good pension and benefits promised. Near-impossible to fire short of actually groping a passenger - and even then it's probably 50-50. Day-dreams of retiring at 45 with a "bad back" on full retirement pay.

Private enterprise: in this case a small and moderately expensive restaurant in the airport concourse. Substantial fixed overheads, a huge potential customer base, brisk competition and (I suspect) a significant fraction of repeat customers. Live and die by the combination of customer service, appearance of the premises and the food / drink on offer. Not much that the restaurant can vary about the latter two, which is what initially gets the customer in the door. They therefore aim to hire staff with the targets of getting customers to spend more than they otherwise might and to encourage repeat business (I would say successfully in both). Aided by being just beyond the TSA security checkpoint, so a greater contrast in service would be hard to produce. Tips are a significant proportion of staff income so staff focus a lot of effort on customer service, up to and including flirting with the customers. Employer benefits pretty variable but at least an OK healthcare plan so keen to keep the job. A fair amount of competition for their jobs and so they need to ensure their employer sees them delivering revenue, filling in when the premises are under-staffed and not calling in sick. Day-dreams of running their own exclusive little bistro downtown.

I'm not condemning or condoning - I'm just reporting.


Stabbed but not slabbed

It's slightly indirect, but interesting reading the reactions of a response Police Inspector to the programme '24 Hours in A&E'. I've been following it since the start, and it's starting to become somewhat depressing. Filmed at Kings Hospital in South London we see a steady procession of knife victims come through triage. "Oh look, another teenaged / early 20's African-Caribbean guy. Shocker." It's so consistent, it's not even funny. Why aren't people shouting from the rooftops about this? Oh, I think I might know. Commentator VoiceOfReason in the comments notes:

“We all have to be so careful these days, you never know who’s listening and any suggestion that you are not ‘toeing the party line’ will kill your career stone dead.’”

Providing balance, there's an equally steady stream of pissed-as-a-fart agressive, obnoxious and barely intelligible white males in the same age bracket alternating between actual alcohol poisoning and the consequences of intoxication (falls, crashes, fights). This has already been the subject of any number of rooftop shoutings, but is equally depressing.

I'm hoping against hope that the programme makers have been focusing on the "entertaining" gangsta muppets and dickhead pissheads, ignoring a majority of peaceful accident victims and elderly acute cardiac events. But I'm afraid that my optimism is mis-placed.

There are an awful lot of people on that programme who need to be charged the full cost of their treatment, and (since they've already spent their money on booze, bling and clothes) be made to work it off. And a much smaller posse of medical staff (from porters through nurses to SHOs) who should get that money tax-free without any of it being diverted to the bean-counters or suit-wearers upstairs. Like that's going to happen. The Triage nurses in particular deserve canonisation, as the cartoon which used to hang in their room in Chester A&E noted:
The gates swing wide, the trumpets sound, the angels toll the bell. 
"Come in my dear, take up your harp; you've done your time in Hell".

Happy 99th Birthday Alan Turing

The father of modern computing, he would have been a year short of his century today -- had not an ungrateful nation, or at least its Crown Prosecution Service of the day, hounded him to an early death. You utter unmitigated bastards.

Although his Turing Machine came to characterise the general programmable computer, it's worth noting that his practical work building on the Polish bombe was very much a specialised highly-parallel application-specific computation engine. I wonder what he would have thought of the evolution of the Field Programmable Gate Array over the past 20 years, as we try to get around the single-thread bottleneck innate in microprocessor design. Yes, yes, quad cores in user desktops these days, whoop-de-frickin'-do - check out Deep Crack and tell me how many 1-U blades you need to glue together to match that performance.

Turing would have felt quite at home in the modern geekosphere. As was noted eloquently in the Jargon File's portrait of J. Random Hacker:
...the ties many hackers have to AI research and SF literature may have helped them to develop an idea of personhood that is inclusive rather than exclusive — after all, if one's imagination readily grants full human rights to future AI programs, robots, dolphins, and extraterrestrial aliens, mere color and gender can't seem very important any more.
RIP Alan Turing. Thank you for everything, and I'm so sorry it came at such a cost for you.


In praise of Amy

  • Who has a 3+ month memory of faces, at a rate of tens per day
  • Who can read a face like a book
  • Who has diplomatic skills to shame COREPER
  • Who mixes the meanest margaritas
  • Who isn't afraid to admit when she's wrong
She's my personal vote for the next SecGen of the UN, and only has to relocate a couple of km. Ban-Ki-Moon can kiss my arse.


It's a distressingly common trope that engineers don't know how to lie. I fear it's true. Dissembling, subterfuge, misdirection all come hard to the engineering mindset. It's probably even worse for the mathmos. I used to laugh at the 70's sci-fi plots that hinged on our hero using Goedel's Incompleteness Theorem segfaulting the misanthropic computer/robot, but to be honest the average engineer would find it equally difficult to complete their plots of world domination if it entailed stating a bold-faced lie in public.

I recently had occasion to tell my boss Gareth in private something which (for his benefit) he needed to keep quiet for a while. Instead, after coming out of the meeting with me, he dived straight into the office of ueber-boss Paul and remained closeted in there for quarter of an hour. Even a six-year old could have worked out what was going on. My colleague Marc figured out all the essentials of the situation in under five minutes just by watching.

I would be very curious to know if there have been any successful serial killers with an engineering or mathematics degree. The Unabomber only managed to last as long as he did by living away from other people. As soon as he published his manifesto, he was screwed.

The Greek end-game

It's not a novel observation that Greece is screwed. It fails the most simple of income vs expenditure tests. Mr. Micawber could have spotted the imminent tragedy with his eyes shut. But what's going to happen?

The conventional wisdom, by which I mean the opinion of journalists in the dailies whose collective economic expertise could be bettered by an orang-utan, is that at some point Greece will default (adminstratively or in practice, it makes little difference), fall out of the Euro, devalue the new drachma, endure a couple of years in economic purdah (c.f. Argentina, Russia) then benefit sufficiently from devaluation that it gets a small economic surplus. Bingo, problem solved. Bad luck for the Franco-German banks that lent to Greece of course, but them's the breaks of international finance.

I'm going to stick my pseudononymous neck out here and say that the degree to which Greece is screwed has been massively understated. What does Greece produce apart from olive oil? Iron, aluminium and copper which are highly vulnerable to global recession. Greece defaults, Europe is forced to recapitalise its banks as they write down their Greek loans, the China-driven commodity bubble pops, Greece suffers a decrease in exports despite devaluation. No way this ends well.

Michael "Liar's Poker" Lewis wrote of Greece and taxes in Vanity Fair and convinced this writer that there is no feasible way of persuading Greeks to pay taxes on time and in full in anything like the same proportion that German and Britons do. So there goes the state's income. No way that the rioters will countenance anything like the necessary cuts in Government spending. Any potential Government prepared to balance the budget will not get elected. For the next 3-5 years I see Greece staggering from one collapsing coalition to another.