Friday, November 06, 2009

Complexity and chance

In one of the Miles Vorkosigan books, the main character has a device installed in his brain and a remote that can trigger a seizure - he needs that because otherwise he would get uncontrolled seizures, usually at moments of high stress (when that's the last thing he needs). One of his problems is having that remote triggered accidentally, so the doctors assure him they coded the connection - no random signal can trigger the seizure, only the remote.

What are the possible dangers here?

1) Accidental signals that would match the frequency of the brain device, thus generating a false positive.

How does one defend against this possibility? A small code of some sort is usually required for triggering the functionality - like the 4-digit code I have to enter when my Nokia cellphone locks the keys (to prevent me from accidentally dialing out when I keep the phone in my pocket).

2) Intentional signals from would-be hackers who want to trigger the device.

In this case, one would need a much more complicated mechanism - possibly a challenge-response sequence where the remote must confirm that it knows a secret. (The book does not explicitly say this but, with Miles formerly in ImpSec and currently one of the several Imperial Auditors, we can assume something like this was actually employed.)

Note the difference? Against randomness, a very simple (= of low complexity) code is sufficient. It is unlikely to the extreme that I would accidentally press my Nokia cellphone's 4-digit code while carrying it in my pocket. It is practically impossible that I would manage that with an 8-digit code. If that code is entered, the phone software can safely assume I *meant* for it to happen - chance simply cannot account for that complexity. (Again, that's a 4-digit code, which is around 14 bits of information - 2^13 = 8,192 < 10,000 < 2^14 = 16,384.)

However, intelligence CAN overcome quite a hefty complexity barrier. Millions of man-years have been spent on creating ciphers that are supposed to last against other millions of man-years working to defeat them. This is VERY STRONG evidence that, given a complex system, we can safely eliminate chance as the cause. While chance can overcome complexity barriers of a few bits - even of dozens of bits, given enough time and the right circumstances - once we get in the realm of hundreds of bits (the CSI barrier) it is absolutely ridiculous to insist on claiming it is a reasonable possibility.

So - what created life, again? :D

Saturday, August 01, 2009

Maintainability

Lots of noise on this subject - as far as I know, it started with this article by Patrick Smacchia that has apparently annoyed Ayende, who replied to it (and followed here). A few days later, Ayende replies to an article by Frans Bouma to explain what he means by maintainability - a definition that goes against what Patrick believes to be true.

Now that you're up to date, my opinion :)

An analogy from C. S. Lewis helps here. To claim that using toothpaste is good, he said, does not mean that if you find someone with bad teeth, but who uses toothpaste all the time, and someone who never used it, but has great teeth, you have disproved the statement. What matters is: given the same person, is he going to be better off by using toothpaste or not?

To apply the analogy: given the same person, whether an average developer from the street or Peter Norvig (or Ayende or Frans or Patrick), which application is he going to find more maintainable: one with - say - hundreds of cyclical references, or one layered as Patrick argues should be done?

In my opinion, this helps to nullify the inherent subjectivity of the issue: an application is more maintainable than another if, on average, more programmers would find it so. (I remember reading about someone who wrote code that would take into account the time it took to execute a piece of code and then read the next value from the disk — which was exactly what he needed at that point; he knew where the disk head would be given that precise timing. That was a maintainable application for him — less so for anyone else.)

Of course, my definition (if I can call it that) still depends on the idea that there are lots more competent programmers than Daily WTF candidates; I do not know if this is in fact the case :)

Saturday, July 11, 2009

Monkeysphere?

Interesting article at http://www.cracked.com/article_14990_what-monkeysphere.html. They didn't elaborate on the subject of religion, but I think (as some commented) that this is why the so-called golden rule is emphasized: trying to love everyone as you love yourself is another way of saying "realize they're also people just like yourself".

No big discovery, I realize :) but I liked the connection.