Wednesday, October 19, 2005 code

I came across this snippets site and I think its a damn good idea. You can store some interesting code snippets which you might have come across on the internet and it is available always. Very similar to but this is for code snippets.

I have come across a lot of times when I say or hear other people say something like: "Oh! I had done this before somehow...but i seem to have forgotten it!" or "I had seen the soution to that when i was searching for something else but I dont know where on the web I found that code".

Hmm...Why dont I come up with ideas like this which are very simple but are so useful?

Wednesday, October 12, 2005

The Cat ate my source code

This post is related to my previous post

This one is from 'The Pragmatic Programmer - From Journeyman to Master' :

Time for a little quantum mechanics with Schrödinger's cat.
Suppose you have a cat in a closed box, along with a radioactive particle. The particle has exactly a 50% chance of fissioning into two. If it does, the cat will be killed. If it doesn't, the cat will be okay. So, is the cat dead or alive? According to Schrödinger, the correct answer is both. Every time a sub-nuclear reaction takes place that has two possible outcomes, the universe is cloned. In one, the event occurred, in the other it didn't. The cat's alive in one universe, dead in another.
Only when you open the box do you know which universe you are in.

No wonder coding for the future is difficult.

But think of code evolution along the same lines as a box full of Schrödinger's cats: every decision results in a different version of the future. How many possible futures can your code support? Which ones are more likely? How hard will it be to support them when the time comes?

Dare you open the box?

Sunday, October 09, 2005

'Cat'chy Reality

I recently finished reading this book. It is an awesome read if you are interested in what reality is and where modern physics is pointing to. It looks like the distinction between scientists and spiritualists is blurring away. The way you look at the world starts slowly changing. Especially the many worlds interpretation is a very interesting one. After reading it I have started thinking in that way unconciously.
Let me try to put it in as few words as possible:

The Cat paradox
Imagine a box that contains a radioactive source, a detector that records the presence of radioactive particles, a glass bottle containing a poison such as cyanide, and a live Cat. The detector is switched on for just long enough so that there is 50-50 chance that one of the atoms in the radioactive material will decay. If the detector does record such an event, then the glass bottle is crushed and the cat dies; if not, the cat lives.
We have no way of knowing the outcome of this experiment until we open the box to look inside.
The whole experiment is governed by the rule that the superposition of both the outcomes of this is real until we look at the experiment, and that only at that instant of observation does the decision happen and one of the outcomes is seen.

The Many worlds Interpretation
This theory says that both the outcomes of the experiment are equally real. The surprise is that according to this theory there is not one real cat but two. There is a live cat, and there is a dead cat; but they are located in different worlds.
Faced with the decision, the whole world - the universe - split into two versions of itself, identical in all respects except that in one version the atom decayed and the cat died, while in the other the atom did not decay and the cat lived.

It sounds like science fiction but it goes far deeper that any science fiction. It is a truth stranger than any fiction.