Saturday, January 26, 2008

But I know that he knows that I know

When two people in America need to make a boolean decision and a coin isn't available, the go-to method of problem resolution is probably Rock, Paper, Scissors.

Generally people feel this game is fair, meaning there's an equal likelihood of each participant winning, losing, or tying. And of course if you're an academic who believes Big-Oh embodies everything you need to know about algorithms, you might leave it at that.

But we real geeks can never leave things at that. And I don't (just) mean playing Bear, Ninja, Cowboy:

Cowboy beats bear, bear beats ninja, ninja beats cowboy. The theory behind this is that cowboys can shoot bears but are not fast enough to prevent a ninja from assassinating them, but a bear's acute sense of smell prevents the ninja from gaining the element of surprise, thus allowing the bear to maul him. --Wikipedia
So....

The UK-based Telegraph tells us there's a strategy that wins more often than 1/3 of the time:

Research [from the New Scientist] shows that stone, also called rock, is the most popular of the three possible moves in the game.

That means that your opponent is likely to choose paper, because they will expect to you to start the game with stone.

By going with scissors, you achieve an early victory.

But hold on. If rock is the most popular move, going with scissors means you would be defeated. But here it says you'll win. Which is it?

It depends on what your opponent knows. Let's first assume that neither player knows anything about the statistics or analysis of RPS. (Yeah, RPS is not only an accepted acronym, there are even RPS tournaments. Wowzies.) A and B are innocent players, but we want to give A an advantage.

The new study says that, unbeknownst to the players, rock is the most popular move. That means ignorant B will throw more rock than average, so A can win by throwing more paper against it. So we should whisper into A's ear that he should throw more paper.

But what if B has read about this new study? His "beknownst" state has flipped to true. Then we expect B to favor paper, so in this case we should instruct A to favor scissors.

Ah but it gets worse, as it often does with these things. What if B knows that A knows that B read the study? Then B will figure out that A will favor scissors, and will start favoring rock again. Double-fake!

But you see what's coming next. If A knows all of this, A can double-fake too. And so on.

So where does all this leave us? That, at least in regard to this study, he with the most information wins. There's probably a life lesson in there somewhere.

Another life lesson is to always keep digging. Like, this isn't even over yet. One strategy is to call out what you're going to throw, and then actually throw it. The theory is that the other person generally won't believe you. Why is this an advantage? Let's take a concrete example.

A says, "I'm going to throw rock." Let's go with the theory that B doesn't believe it. So B thinks A will throw paper or scissors. If B throws rock, he figures 50% chance to win, 50% chance to lose. If B throws paper, it's 50% to tie, 50% to lose, so that's no good. If B throws scissors, it's 50% to win, 50% to tie. Add it up: B's best move (under his assumption) is scissors, and second-best is rock.

Since A will actually throw rock according to this strategy, and we figure B will throw rock or scissors, A will either tie or win. Awesome!

Until B knows that strategy, of course...

Which leads to the final point, which is that Wikipedia and the ideals of the open source movement of freedom of information has crept far and wide.

Take another look at the image at the top of this post. Nice, right? I didn't make it, I stole it from Wikipedia. It's legal because Wikipedia is good like that. But wait, who made that image? It turns out each of the pieces were stolen from other Wikipedia images and composited together by a guy known to us only by "TheCoffee." Thanks, dude.

Oh, and take another look at that Telegraph article. They stole the image too. Except they didn't credit Wikipedia. They didn't even link to the larger version of the image. Nice, guys.

Freedom at the cost of anonymity.

Tuesday, January 22, 2008

I'm gonna learn you good

There's been a rash of blog posts lately about how to fix Computer Science education so it teaches real-world, practical techniques instead of being a branch of the mathematics department.

This, in turn, has rekindled the tired debate on whether programming is art or science. Sigh.

I once got to visit a Master Cheesemaker. The term "Master" is not arbitrary. Like other traditional crafts, the (art? science?) of cheesemaking is passed down and cannot be learned by reading a book. The term implies a pedigree of apprenticeship and a level of skill that can be achieved only though years of experience.

Although you can make a passable cheese with information found on the Internet, truly great cheese-making is a process that you have to feel, both with your senses and with intuition. An example, from Wikipedia:

In additional to the craft skills of cheesemaking, cheesemakers also need to be skilled in the grading of cheese to assess quality, defects and suitability for release from the maturing store for sale. The grading of cheese involves the visual inspection of a cheese and the assessment of a sample by sight, smell, taste and texture. The ability to predict when a cheese will be ready for sale or consumption forms part of the cheesemaker's skill, as the characteristics of cheese change constantly during maturation.
Moreover, these skills take years to master:
Most cheesemakers by virtue of their knowledge and experience are adept at making particular types of cheese. Few if any can quickly turn their hand to making any kind of cheese. Such is the specialisation of cheesemaking.
So it's an art, right? Not entirely.

During the tour we saw several stages of the cheese-making process from developing curds to cold-chamber aging, and what struck me was the amount of precision involved. There were thermometers everywhere. Workers checked the numbers constantly -- variations of 5% were enough to kill a live culture or ruin a texture or destroy a taste. Hours of labor and expensive ingredients had to be discarded if something went wrong with step #23. This precision seemed a lot closer to science than art.

So it's a science? No. Because amidst the measurements and process, the Master still had to stick her hand in the cauldron and make sure the curds "felt right."

Does this story sound familiar? Isn't software development a mixture of intuition and measurable steps? Can't we agree that code coverage stats and tight, automated build systems are valuable, but simultaneously we should value beautiful code and code smells?

So perhaps when it comes to computer science education we can take a hint from other crafts. This is the kind of thing you learn from experience. It's not like chemistry which requires experience but also requires a great deal of schooling before you can even start making a difference. We all know that very little of what we learned in school is ever used in practice, yet many of us consider ourselves to be great developers. We must have learned that on the job!

So let's just admit that this is probably the best way to learn. Sure we can do a mixture -- it would help to take a short course on best practices on version control and branching, it would help to practice writing good unit tests, and making Joel's book required reading might be a good start.

But nothing beats writing code next to an expert who is willing to share the "why's" of development.

Tuesday, January 8, 2008

Tidbits from New Hampshire


Please. Think of the kittens.

Nuggets from the news networks' coverage of the New Hampshire primaries as it unfolded:

Hiliary Clinton bowing out of the next few primaries would guarantee four defeats in a row.
Analysis at its best. Thanks Fox. Why were they even discussing that?

Clinton's flashes of sadness and anger have brought her candidacy a raw authenticity that her aides for years have struggled to manufacture.
Can you manufacture authenticity? Is it bad that "sadness and anger" is the proof that Clinton is "authentic?"

[From Obama's Camp] New Hampshire was Hillary's to lose. Her roots run deep here. As the underdog, anything close to a win by Obama is a victory that will carry into Michigan and Nevada.

[From Clinton's Camp] Anything that's even close to a win is a victory. Barak was up on the polls several days ago, so if the results are close it's because Hillary won the debates, which shows she has the momentum going into Nevada and South Carolina.
Heads I win, tails you lose.

And finally:

America is the greatest country in the world, and not just because of our beautiful landscape, but because of the American people.

Monday, January 7, 2008

Google is not evil... right?

Has Google lost sight of its "do no evil" strategy?

On December 14th, Google decided that every blog post that you've ever shared with a specific person should immediately be shared with everyone in your Contacts list.

As lovingly described on Felipe Hoffa's blog:

No need to opt-in, no way to opt-out. If you didn't react fast all the info you previously shared with your chosen parties could be viewable by everyone you had exchanged e-mails (using Gmail data).
Everyone. Family, friends, people at work, customers, vendors, everyone. Immediately. No choice. Hope you weren't on vacation.

One of Google's (few) responses to piles of angry forums posts was:
We just added a new option for those of you wishing to rearrange your sharing habits in light of the new features.

Seriously?

And it's still not fixed.

As Google collects more and more info, we must trust them more and more. And so long as Google retains its Benevolent Dictator status, the benefits probably outweigh the possible disadvantages.

But their insistence on this subject could be a bad sign. Mistakes are fine so long as you admit them and fix the problem. JetBlue's delay debacle took them from being at the top of customer satisfaction ratings in 2006 to being removed even from consideration in some 2007 satisfaction polls. Today JetBlue is back at the top of customer service ratings. Why? Because they turned what could have been disaster into an opportunity to demonstrate that, no really, they are concerned with customer well-being, and they immediately went on the record saying so and explaining how they will ensure that type of problem never happens again. And they did what they said.

Google is in the same position now, but they have just the opposite response. Facebook capitulated; Google needs to also.