News from the gym

I don't watch the news and to be honest I don't understand why anyone with half a brain would. That is, I don't watch except when they put a screen in my face with the captions on like it's the case at the gym. I didn't think I would ever regret being able to read. A TV screen is a terrible thing: it's very hard not to look at it. And I had forgotten the Zune.
So I watched the news.
Here's what I learned...

  1. Some random woman got condemned for murder. Not sure how this is newsworthy but that's all they talked about on CNN while I was there.
  2. Some famous golf player did something apparently not very nice. Not sure who or what, I think I my brain might have gone to sleep at that point.
  3. We might have to reconsider all the scientific results for the last five centuries, because apparently a bunch of scientists are vicious assholes.
  4. There is a segment on Fox News called "the dumbest thing of the week" that surprisingly isn't a best of what they said during the week. That's when I noticed the blood coming out of my eyes.
  5. Surprisingly, the dumbest thing I heard this week wasn't on Fox, it was on NPR in the car on my way back home. They were interviewing a guy who had raped 11 of the children that he was coaching, and he was saying that it was all right now because God had forgiven him. So apparently what's important is not that the people you hurt forgive you, what's important is that some hypothetical deity does.

Must think of taking the Zune next time...

Read more...

Metrics in software and physics

A Horrible experiment Every so often, somebody points out how bad of a metric code coverage is. And of course, on its own, it doesn’t tell you much: after all, it’s a single number. How could it possibly reflect all the subtlety (or lack thereof) of your designs and of your testing artillery? Of course, within all the various *DD approaches, some better than others enable you to know whether or not your code conforms to its requirements, but I thought I’d take a moment to reflect on the general idea of a software metric and how it relates to the mothers of all metrics: physical ones, cause you know, I used to be a scientist. Proof: the lab coat on the picture.

The theory of measurement is at the center of all experimental physics. This comes from the realization that any observation of the natural world is ultimately indirect.

For example, when you look at a red ball, you don’t directly perceive it. Rather, photons hit it, some of them are absorbed by the surface of the ball (violet, blue, green and yellow ones, but not red ones) and some of them bounce back (the red ones if you’ve been following). Those red photons that bounced back then hit your eyes, where a lens distorts their paths so that all those photons that came from a specific point on the ball converge to roughly the same spot on your retina. Then, the photoreceptor cells on the retina transform the light signal into electric impulses in your optic nerve, which conveys all that information into your brain and then, only then the complex mechanisms of conscience give you the wonderful illusion of seeing a red ball in front of your eyes.

The brain reconstructs a model of the universe, but what it really ever perceives is a pattern of electric impulses. Everything in between is a rather elaborate Rube-Goldberg contraption that can be trusted most of the time but that is actually rather easy to fool. That it can be fooled at all is the simple consequence that what you observe is an indirect and partial measure of reality rather than reality itself.

When we measure anything in physics, we build our own devices that transform objective reality into perceivable quantities. For example, when physicists say they have “seen” a planet around a faraway sun, they don’t (always) mean that they put their eyes on the smaller end of a telescope and perceived the shape of that planet with their own eyes like I saw the red ball of the previous paragraph. No, what they saw is something like this on a computer monitor:What a beautiful planet!This shows the very small (1.5%) variation of the light coming from the star as the planet transits in front of it. All this really tells them is that something dark that takes about 1.5% of the area of the star passed in front of it. By repeating that observation, they can see that it happens every 3.5 days. That’s it. No image, just measures of the amount of light coming out of a powerful telescope aimed at a star against time.

But just from that minimal data and our centuries old knowledge of celestial mechanics, researchers were able to deduce that a planet 1.27 times the size of Jupiter but 0.63 times its mass and a surface gravity about the same as Earth’s was orbiting that star. That’s an impressively precise description of a big ball of gas that is 150 light years away (that’s 1.4 million billion kilometers in case you’re wondering or 880 thousand billion miles if you insist on using an archaic unit system).

The Rube Goldberg device that enables us to see that big ball of gas from so far away is a mix of optics, electronics and knowledge, the latter being the really awesome part. Science is awesome. The bottom line of all this is that although it seems less “direct” than seeing the red ball with our own eyes, it does just as well deserve to be described as “seeing” it. The only difference is that we’re not seeing with our eyes but more with our brains. How awesome is that?

Where was I?

Yes, you might be wondering what this has to do with software. Well, all that long digression was to show that little data is necessary to infer a lot about the object you’re observing. So code coverage? Sure, it’s just a number, but combined with a few other numbers, it can help get a reliable picture of software quality.

Another point I’d like to make is that a lot of resistance to software metrics comes from the illusion that we know a lot more about our own code than any tool can tell us. But as anyone who has ever tried to read code he wrote only five years ago knows, that is delusional. What you know about your code is a combination of what you remember and what you intended to write, neither of which is particularly reliably representative of what your code is doing. Tools give us a much more reliable picture. Sure, it’s a narrow projection of the code and it doesn’t capture its full reality, but that is exactly the point of a measure: to project a complex object along a scale of our choosing. What set of projections you choose to make is what determines their relevance.

The conclusion of all this is that we should assume that our code is an unknown object that needs to be measured, like that big ball of gas 150 light years away, if we want to get an objective idea of its quality without having our judgment clouded by our own assumptions.

And probably the best tool you can use to do exactly this by the way is NDepend by Patrick Smacchia.

Read more...

Why Guitar Hero is dead to me

(c) Bertrand Le Roy 2007 I bought the new Guitar Hero 5 because I needed a new fake plastic guitar and Activision’s guitars are the best that are not outrageously expensive. The Rock Band guitars I just can’t stand. So as I was going to buy a guitar from them, I thought I might as well get a (couple of) cheap game(s) with it.

At first, I really liked what they did with GH5, especially when compared to the mediocre World Tour. The party mode, for example, is a very nice idea: the game acts as a media player and plays songs on its own; but you can jump in at any time and start to play any instrument. Being able to play any instrument in any number is also a nice touch, seeing as few people like to sing in public, but most are not afraid of the guitar or drum set.

I also liked the tapping sections and the bass’ sixth note.

Problem is, that’s about it. The game has 85 songs but they’re not good. Going through the career mode feels like you’re grinding through mediocre song after horrible song. And when there’s one good song (there are a few), it is usually spoiled by an absurd, deliberately “challenging” partition. “Challenging”, in Activision’s mind of course means they have to make extra-sure you’ll have no fun playing the song.

After passing most songs, I heard myself thinking “this is a song I’m never going to play ever again”.

And the design… Will somebody please do something about the ugliness and get out of that uncanny valley? The rest of the industry has, one way or another. Guitar Hero is generally very consistent about the bad taste.

Contrast that with the elegant and subdued design of Rock Band, their well-balanced, well-designed, fun partitions that have the appropriate difficulty (no song is harder in medium than another in expert for example).

And of course, until EA and Activision realize the consumer’s interest is theirs and it’s absurd to limit the songs you sell to only one media player, there can be only one. Nobody wants to switch games in the middle of a party. But that is unlikely to happen as Activision can’t even manage to be compatible with their own games: 35 songs out of World Tour’s 85? WTF? It’s as if Apple was selling iTunes 2008 and iTunes 2009 but you couldn’t play on 2009 all the songs you bought on 2008. And you had to pay again to play those few “old” songs that you bought only a year earlier.

Don’t even get me started on how they milk the franchise, from inane band-specific titles to ridiculous toy-versions.

There can be only one in each home, and for me that one is going to be, for now and I suspect for a long time, Rock Band.

Read more...

The symmetrical universe

(c) Bertrand Le Roy 2005 Warning: this post is devoid of contents.

During one of the very first classes of my Bachelor of Science in Physics, I got struck with a particular piece of information that sounded like a revelation to me:

If a problem exhibits a certain symmetry, the solutions to this problem do not necessarily exhibit that same symmetry, but the set of solutions always does.

The example my professor was using to illustrate this is the following. Imagine you have the four summits of a square and you want to find how to connect each point to all of the others using lines, but the total length of those lines must be as small as possible.

The problem itself has mirror symmetry, central symmetry and rotational symmetry with an angle of 90 degrees. In other words, the four summits are perfectly equivalent and can be exchanged without changing the problem in any way.

Now here’s the weird thing. There are two solutions, which are themselves less symmetrical than the problem itself and that look something like this:How to minimally connect the summits of a square

Notice how rotating any one of those by an angle of 90 degrees doesn’t keep it unchanged, but instead gives the other solution. In other words the set of solutions (those two solutions together) has exactly the same symmetries as the problem itself although each one of them separately doesn’t.

This is more far reaching than it seems and is nothing else than the phenomenon called spontaneous symmetry breaking that has been keeping a good number of physicists busy during the 20th century and the beginning of the 21st. Because there is only one universe that we can observe, whenever a physical process has the same characteristics as the above problem, the physical world has to choose one of the solutions and “break” the symmetry of the problem.

Now in any physical process, the experimental conditions are never perfect and small perturbations are likely to push the system to this or that particular solution so there is nothing super-weird about what’s happening here.

But there are phenomena where an external nudge to the system can’t explain the symmetry breaking: the ones that are at the origin of the universe. Cosmologists are actually still debating explanations to why the universe is so dissymmetrical (the arrow of time, the four fundamental forces, the inhomogeneity of matter, etc.) whereas the equations that seem to describe it are so symmetrical.

Many plausible explanations do exist, such as that our observable universe is part of a bigger “multiverse”. The weaker versions of this idea still consider a connected symmetrical universe that is one big multidimensional space-time continuum with different local regions where symmetry is broken in all possible ways. But why do we need the connectedness at all? Is it even an option? If you look at the square problem above, those two solutions are entirely disconnected and you couldn’t find a connected symmetrical solution if you tried. Why would the multiverse then need to be connected?

This leads us to the strongest version of the multiverse concept, the Mathematical Universe Hypothesis. The idea behind this is to attribute reality to all mathematical structures and to postulate that our observable universe is just one of this infinite number of structures (in an interesting case of taking the map for the territory).

Mathematical structures have this interesting property that they exist independently of culture, the human mind and even physics. Group theory for example could be discovered in any universe and would yield the exact same list of finite groups. In other words, they have lots of the qualities we associate with the reality of our own physical universe. Going from that to the idea that our physical world is just emerging from that primordial mathematical soup is quite tempting.

Now of course, it has been objected that such an idea is not testable or falsifiable and thus cannot be called scientific. That is absolutely true. But it does have that Occam’s razor quality of simplifying some of the apparent complexity of our universe. It also has the advantage of being an entirely naturalistic hypothesis to the origin of the universe if you’re into that sort of thing.

All this to give you an idea of the rush of ideas that went through my 20 year old brain at the precise moment when that professor showed us those two simple diagrams that you see above, oblivious at the time that those ideas that seemed so new and original to me had actually already been invented and debated a couple of years earlier. I felt at this instant the raw explanatory power of science and also its ability to extend its influence way beyond its self-imposed limits of testability. It is without a doubt the most powerful instrument of thinking and the best catalyst of ideas that the human mind has invented.

Read more...

The French are so lazy...

The economist has a piece about how much American kids study (http://www.economist.com/world/unitedstates/displayStory.cfm?story_id=13825184&source=most_recommended) that starts with the requisite clichés about the lazy French.

Did you know that the French are the fifth most productive people of the OCDE, before the US and way before Japan?

It's true that the American work on average 11% more than the French but did you know that on average the French work more (and better) than the German?

Interestingly, there seems to be an inverse correlation between hours worked and productivity: the less you work, the better you work.

Other data seem to indicate that the French *are* the most arrogant on the planet though, and this post can only reinforce that. :)

Source: OECD http://stats.oecd.org/Index.aspx?DatasetCode=LEVEL

Update: David sent me some interesting additional data (see comments if you can read French) that shows that although Americans still work around 40 hours a week in the industry, the picture is very different when you look at the whole active population because of the lack of stable jobs. The average then falls to less than 34 hours a week (White House data for 2007, which corroborates the OECD data) and still steadily falling. It's even worse in Great Britain (less than 32 hours a week). Also interesting to look at is the average length of work for French people who are working full-time: 39.2 hours.

What this tells us is that the average length of work does not just come from regulation (the infamous French 35 hours) but also from the general social and economical climate (the amount of stable, full-time jobs). The end result in terms of quality of life can be drastically different even though the figures look close on first analysis.

It is of course also relevant to look at the repartition of the GDP, which is something that the above statistics hide. If there is added productivity, who reaps the benefits? The answer is that only the top 5% American salaries have raised over the last five years. It is doubtful that it is those 5% that are driving all of the productivity increases.

Finally, another interesting data point is that according to Eurostat, France is the country that saw the greatest increase in productivity since 1980, with a whopping 2.2% increase.

Read more...

Five gems of XBLA

  1. The Maw is a charming and seriously fun game that is going to make you smile from start to finish.
  2. Puzzle Quest is one of those “just one more” time sinks. The improbable mix of puzzle gaming and RPG is just awesome. The sequel, Galactrix, is pretty good too (but quite buggy, you might want to wait for a patch or at least regularly copy your game save).
  3. Portal is simply the best game ever, at least for me. Portal proves once more that the simplest ideas can be the deepest and does so with amazing grace and mastery of the art of video games.
  4. Banjo Kazooie and Banjo Tooie were two of the best N64 games, maybe on par with Super Mario but with that unique Rare sense of humour.
  5. Cloning Clyde: smart and funny.

What are your favorite XBLA games?

Read more...

The PlayStation’s Flower power

flower Yesterday, I bought Flower for the PS3 and played it through in one sitting (the game is really short but still, couldn’t get my hands off the controller once I started).

This game is one of the best things I’ve seen in gaming this year. It’s beautiful, poetic, more contemplative experience than game. There is not the shadow of a doubt that this thing is art. What really interested me was the way it tells a story without a word. I’m convinced that the acceptance of video games (or any medium) as art is conditioned by its ability to find storytelling methods that are unique to it and that are impossible to reproduce outside of it. Flower is one of those games that do exactly that.

There are many things I dislike about the PS3, but one has to admit Sony knows how to produce original, quirky and high-profile games (Patapon, LocoRoco and Pain are other examples).

Flower is well worth your $9.99 but you have to be aware it will last only about two hours.

Read more...