What Can Software Developers Learn from Tigers?

Object-oriented programming is a powerful way of modeling the world. Objects encapsulate data and behavior, and can interact and be composed in many useful ways.

As developers, one question we often consider is which types (in both technical and non-technical sense of the word) of objects to privilege by building them into our systems. Is an Address a proper object, or is it just a bit of data that can be encapsulated under a User? Are PowerUsers and NewUsers different enough to merit their own classes? (Probably not.)

But as our systems evolve, it can become difficult for existing object models to respond to new requirements. That’s apparently what is currently happening with tiger species. Because there are nine recognized tiger species, preservation efforts are spread across the six non-extinct species. A new proposal based on examination of DNA suggests that there should only be two tiger species.

As one researcher quoted in the piece says, “It’s really hard to distinguish between tigers…. The taxonomies are based on data from almost a hundred years ago.” Although your object model may not have legacy code that is quite that old, this case demonstrates the importance of reconsidering what traits and behaviors you allow to be first-class citizens in your system.

In the case of tigers, reducing the number of recognized species to two (one inhabiting continental Asia, and another the archipelago of Indonesia) would allow conservationists to try more flexible strategies. One example mentioned in the article is moving tigers within the same (redefined) species from one area to another (the updated definition of a continental Asian tiger would include the Amur tiger of Russia, the Bengal of India, and the South-China tiger). To a non-expert, it seems that interbreeding between these population groups would also help increase their numbers and perhaps increase genetic diversity.

Figuring out how to classify real-life entities can be very difficult. For tigers, what characteristics define a species? A century ago it might have been their physical appearance, while today we can look at the genetic level. In software, we have to think hard about the taxonomies we choose because they quickly become metaphors we live by.

The lesson for developers is that making your object model too fine-grained can introduce unexpected constraints when requirements change. To paraphrase Keynes, “When my information changes, I alter my code.”

Politics in the Animal Kingdom

Cartoon by Nick Galifianakis

From lion kings to queen bees, political metaphors for animals abound. But do animals really think and act in a political manner? Tom Seeley, and entomologist at Cornell, thinks so:

[He] has written a lovely and compelling book titled Honeybee Democracy which suggests we turn to the bees to see how they make decisions. Thanks to the work of Seeley and his collaborators, it is now clear that honeybee hives really are democratic. When it’s time to look for a new nest, options are weighted by the evaluations of many different bees about a site’s qualities—its size, its humidity, the density of surrounding flowers. Individual bees vote with dances, and when the number of dances in favor of some particular site is high enough, the masses are swayed. Together, citizen bees choose, if not perfection, the best possible option.

In ants, choices about how to nest or feed also seem democratic, though a few experts influence the process. Some ants just know more than others.

Forms of democracy also exist in flocks of birds (who must decide when to fly) and troops of monkeys (who decide when to move). In each of these situations, consensus is necessary, and consensus is reached by some form of voting. Democratic decision-making is common in nature; humans did not invent democracy.

There’s more at Slate, including parallels to our own elections.

Stated vs Revealed Preferences: Health Care Edition

In social science, much research centers on the idea of preferences. Preferences are a key element of decision theory, which suggests that individuals have some order of preference over a set of outcomes. More generally, we can think of such varied topics as voter choice and grocery shopping as preferences. There are two ways to measure preferences.

The first is stated preferences. Often, individuals even have preferences over things that they cannot control or we cannot measure directly. Say, for example, that we are trying to ascertain how strongly people prefer environmentally friendly products to less eco-friendly products. If we just want to know their stated preferences, we can simply ask them. (Although, if we want to run a scientific survey, it gets less simple the more accurate we want to be.)

On the other hand, say we want their revealed preferences, so we observe their actual behavior. Behavior with regard to eco-friendly products centers on purchases, so we look at whether individuals tend to purchase eco-friendly products more than the alternatives. (It turns out they don’t. h/t to Adam Ozimek) Economists generally prefer to work with revealed preferences, and as a political scientist so do I. The definitions of “hard” or “soft” data might be fuzzy, but when I talk about hard data this is the kind of thing I mean: actual, observable behavior. Sometimes survey research is your only alternative, but I have a hard time thinking of an instance in which it would be ideal. [edit: it’s important to note–which I neglected to do earlier–that revealed preferences often get screwed up outside of the context of a free market; in the US even sugar isn’t a free-market commodity thanks to high tariffs; this potentially undermines what I say later about health care but I think the main point still holds]

Now to apply this to health care. Karl Smith had a post over the weekend citing several studies that indicate that consumers don’t actually care how effective certain hospitals/treatments are when making health care decisions. This is based on actual patient behavior (revealed preferences). Of course if you ask anyone, they would say that they want the most effective treatment possible.

This is the difference between stated and revealed preferences–everyone says they want effective treatment, but when it comes to making health care decisions, as Karl argues, often they simply feel the need to do something. On one level this is completely fine: if you’re spending your own money and it’s just to make you feel better in an emotional sense, go for it. Whether that means purchasing lots of movie tickets, lollipops, health care, whatever. But when you start spending other people’s money (government health care) it seems reasonable that the public (“other people”) take an interest in the efficacy of various procedures or treatments. I’m not talking about death committees or anything like that, but if the government is funding your health care then they have a right to say no to certain treatments. This is the same principle that leads me to believe that the government should have a right to tell people in NYC that they can’t buy cola with food stamps. It doesn’t mean you can’t buy cola (or health care), it just means that you have to use other (ahem, your own) money to do it. If it’s too expensive, find a cheaper alternative. That might mean more competitiveness in the market for health care. It might mean people going to other countries for treatment (not ideal but certainly possible). And it might even mean that more people become aware of homeopathic alternatives.

On a lighter note, here’s a clip from Scrubs that always comes to mind when I think about the effectiveness vs cost of certain health care procedures: