The Law of ‘S’

For me, a lot of the discipline about programming is about finding useful heuristics for a large number of circumstances. Today, was tracking down an error in someone else’s code that my usual heuristic would have saved me from. It involves the letter ‘S’.

Let’s say, for the sake of argument, that I’m making a banking application. And let’s say that I have to name something: a variable, a CSS class, an XML node, or a JSON property. In some circumstances, it might be meaningful to say “account” and in some circumstances, it might be meaningful to say “accounts”. Here’s my rule. If both forms of the word seem reasonable in context, then I always use the singular. And then, later, when I have to apply the CSS class, or read the XML node, I’ll know what form I chose because I’ll know I followed the rule.

Unfortunately, there’s one programming problem that I haven’t figured out a good rule for: other people. Other people write code, and aren’t as anal as I am. Bummer.

Pa Senp

Here’s a story that I’ve always rather enjoyed; it comes from Tracy Kidder’s book, Mountains Beyond Mountains. The book recounts Paul Farmer’s attempt to create an alternative treatment regimen for tuberculosis.

So he got some people together to find out why the current treatment wasn’t working. One group of people (perhaps unsurprisingly, the relatively poor villagers that were typical of his patients) put their finger on the real problem: giving people Tuberculosis medicine when they don’t have food to eat isn’t all that great. Using this insight, Farmer went on to develop a treatment programme that ensured that all the Tuberculosis patients received food money and extra attention.

What interests me, though, is the other perspective. The other group of people — typically more affluent doctors — felt that the problem was related to the superstitiousness of the patients. According to them, the patients didn’t really believe that microbes caused Tuberculosis: instead, they believed that Tuberculosis happened because of sorcery, and therefore they didn’t stick to the medication regimen.

After talking to a lot of his patients, Farmer learned that although a lot of his patients actually believed this, the belief didn’t make much difference to their recovery rate.

Read more

Toronto Police: Kinda Douchecanoes

Toronto police say they are working to improve their relationship with the city’s transgender community, even as some transgender people say they’re being targeted by officers.

“The policy itself requires that interactions with transgender-transsexual people will take full account of their human rights,” said Alok Mukerjee, the chair of the Toronto Police Services Board. “And give them the same respectful treatment as anybody else.”

In turn, people in the transgender community say they’re still stigmatized and often mistaken for prostitutes.

The comments from both sides come in the midst of the city’s huge annual Pride celebrations, and just weeks after Ontario became the first jurisdiction in North America to protect the rights of transgender people.

Police began tracking the number of times officers search or detain people who identify themselves as transgender in 2010. That year, it happened 186 times. In 2011, that number rose to 244.

CBC.ca

My LJ-friend, Morgan Page, is quoted in the article.

What’s Newsworthy?

I developed and manage a web site that deals with health care standards. One of the features that I threw in to the site was the ability to fetch health-related news articles from a handful of news sources, so that there’s a rolling “top stories” section.

The weird part is that I also extract keywords from the site — usually keywords that the original news source originally identified. And I have a tag cloud that shows me the relative importance of those keywords over the last three months.

As of today, I’m currently seeing the following top keywords:

  • cancer
  • children
  • doctors
  • drugs
  • health care
  • medicine
  • mental health
  • obesity
  • ontario
  • research
  • workout

There’s a part of me that’s just boggled that obesity is on this list and, say, HIV isn’t.

Objective-C Oddities

I was tweaking a bit of Objective-C code the other day, and stumbled upon one of those situations that seemed like it should be straight-forward, but which bit me. Consider the following.

My app is downloading some information in a background thread. Here’s my code:

NSData *data = [NSURLConnection sendSynchronousRequest:request 
                   returningResponse:&response error:error];
if (error != nil) {
    NSLog(@"error : %@", error.localizedDescription);
} else {
    
    // check response code, etc.
    ...
}  

The code compiled fine, but when I ran it, I would sometimes get an EXC_BAD_ACCESS crash. Turns out, the Cocoa APIs are designed to communicate information via the response type, as StackOverflow clarified for me. According to the Apple Error Handling standards:

you should always check that the return value is nil or NO before attempting to do anything with the NSError object.

So I’d needed to write:

NSData *data = [NSURLConnection sendSynchronousRequest:request 
                   returningResponse:&response error:error];
if (data != nil) {
    // check response code, etc.
    ...
} else if (error != nil) {
    NSLog(@"error : %@", error.localizedDescription);
}  

At some level, this type of error feels wrong. I’ve got a non-nil error object; it’s just in a state that I can’t use it. It feels to me like there’s something messed up with the way the API works.

But whatever. Data first; error second.

Caricatures of Agile: The Goldfish

As agile developers, we sometimes like to point our fingers and snicker at some of the more problematic personalities that can sometimes haunt waterfall development shops. To some extent, we take comfort from the sense that many of these personalities are able to hide out in the nooks and crannies of the waterfall methodology, but certainly Those Types Of People would never survive in an agile shop.

Take the classic example: the Hidden Deadbeat. While many agile environments force a lot of developer interaction by putting the team in a shared project room, the waterfall world still embraces the cubicle farm. And we’ve certainly met a large number of Hidden Deadbeats: people who don’t really do or accomplish anything, but who succeed in not doing anything for long periods of time because they don’t have to interact with people very often. If nobody really knows what they do, then nobody really knows that they’re doing nothing.

But agile projects have their fair share of… interesting personalities. There are some behaviours that are downright dysfunctional. Sometimes a difficult behaviour can provide a good counterbalance to another problematic behaviour. Pairing someone who just wants to get things done with someone who likes spending a lot of time thinking about concepts and theories creates a powerful team.

Read more

The UN Legacy

The Christian Science Monitor is running a story right now titled, “Will the United Nations’ legacy in Haiti be all about scandal?”

My answer: “Yes.”

This has been another installment of “simple answers to simple questions.”

The Chronicles of Madison

One of the things that was especially exciting about this year’s WisCon was the opportunity to get my hands on a copy of this year’s WisCon Chronicles. And it’s all about vanity, I admit: I have an essay in the book about the way panels over the last few cons have struggled with talking about class.
Read more

Space Girl

Reading through this year’s WisCon Chronicles, I was motivated to look up this vid:

I love that music, but it totally gets in your brain and won’t leave. Apparently, this vid premiered at WisCon 35 — it’s pretty beautiful.

Just ’cause I’m here. And I’m real

Blogging platforms. I feel so behind.

I mean, I was on LiveJournal in 2002. I’ve been blogging pretty consistently since then, although I moved over to DreamWidth as my primary blogging platform. For reasons I can’t really explain, I’ve never loved Facebook (although maybe the fact that they won’t let me spell my name correctly has something to do with it). And while I’m okay with Google+, I do feel like it isn’t really designed for long-form blogging.

So I’ve embraced change, and I’m going to try my hand at the funky world of WordPress. And, okay, I admit that I’m not on the bleeding edge, here. But it’s a new world for me, anyway. We’ll see how it goes.

I’m also wondering about the different personas of me on the Intertubes. I mean, on my work blog, I usually only talk about programming and agile. On my personal blog, I talk about fannish stuff, and social politics. I sometimes say “fuck” a lot. But I seldom cross the streams. And I haven’t yet fully thought through what this blog is going to contain.

Ah well! It’s an adventure. And I’m inviting you along for the ride.