18 November 2010

Inelegant Laws

Reason: Hit & Run Blog | Jacob Sullum | Michigan Liquor Commission Bans Nonexistent Product

Last week, when the Michigan Liquor Control Commission banned "alcohol energy drinks," its list of newly forbidden beverages included Smirnoff Raw Tea. There are a couple of problems with that:
1) Smirnoff Raw Tea, a malt beverage similar to Mike's Hard Lemonade but with a flavor reminiscent of iced tea, was never marketed as an "energy drink." According to a spokewoman for Diageo, which owns the Smirnoff brand, it contained "a negligible amount of caffeine—no more than a can of soda."

2) Smirnoff Raw Tea, which was "taken off the market more than a year ago for commercial reasons," does not exist anymore.
A perusal of the commission's three-page list (PDF) reveals a few other curiosities. In addition to fruit-flavored, caffeinated malt beverages like Four Loko and Joose, it includes MateVeza, an IPA brewed with the caffeine-containing herb yerba maté; 808-brand products that contain vodka, cognac, and fruit liqueur as well as caffeine; and Black Jack Cola, the Jack Daniel's Country Cocktail that is supposed to taste like Coke with Tennessee whiskey (although it does not contain any of the latter). But the list does not include any other craft beers that contain caffeine (such as Lagunitas Brewing Company's Cappuccino Stout or Founders Brewing Company's Kentucky Breakfast Stout), and it omits caffeinated distilled spirits such as Pink Vodka. Even if it were true that caffeinated alcoholic beverages posed a uniquely intolerable threat to public health and morals, there would be little rhyme or reason to the liquor commission's targets, especially since nothing it does can stop drinkers from mixing Red Bull with vodka (or coffee with Irish whiskey).
Legislation, like a computer programs, are a system for control. Either for control of people's behaviors, or control of an information processing machine. And like programs, there are better and worse ways to write legislation. Many of these ways overlap between the two domains.

I've helped teach introductory programming classes a few times. And everytime some people in the class make the same mistakes.

Imagine your assignment is to write a program which prints out all the even numbers between 1 and 100. There are two ways you could do that. Here's one:
print "2"
print "4"
print "6"
...
print "100"
Here's another
for i = 1 to 100
  if i % 2 == 0 then
    print i
  end if
end for
(That percent sign is the modulo operator. It gives you the remainder of an integer division operation.)

Both of these programs will produce the same output. Both of them are, in that sense, identical. But the latter program is indisputably better.  It's more elegant.  It's more modifiable and flexible.  It's more obvious what you trying to do.

All three times I've taught there have been students that have tried to solve problems with the first method: just list the exact things you want to do.  It's always an uphill battle trying to explain why this is the wrong way to do things.  The applied answer is that when I give them the next assignment and ask for all even numbers between 1 and 1000, or between two numbers x and y that won't be decided until I run the program to grade it, or all the numbers between x and y that are divisible by 7 rather than 2, the first approach will be inadequate.

The more theoretical answer is that programming isn't about telling the computer what the answer to a problem is and getting it to reproduce the answer. The first approach requires the programmer to solve the problem in advance, rather than letting the program do it. The point of programming is to give a computer a general method for solving a class of problems itself.

What does this have to do with legislation?  The law that Michigan passed is an example of the first type of thinking: create a list of all the things citizens can or can't do.  Laws should be more like the second example: create a system for describing what is and is not allowed in general.  The Michigan law is fragile.  It adapts poorly to changing situations.  It is harder to understand what is being done.  In short, it suffers from all the same problems as merely listing the even numbers.  A better solution, a more just and understandable and complete and robust solution, would be something that gives rules like "no beverages with a concentration of alcohol above X and concentration of caffeine above Y."  That's how a programmer would do it, anyway.

2 comments:

  1. First of off, let's not give them any ideas about banning Founder's Kentucky Breakfast Stout, which is (IMHO) the best beer on the planet.

    Second, I like your analogy about how a programmer would do things. As I opined here (http://jeffreyellis.org/blog/?p=1940), we should just let software engineers run the country.

    ReplyDelete
  2. If only we could put software engineers in charge... [sigh]

    ReplyDelete