Monday, April 20, 2009

Careful what you ask me!

Some poor guy wrote to me to ask me what I meant by the following line from the little 'bio' paragraph I used to put at the end of programming articles:


[Greg is] a devout believer in the religious idea that, when a computer program works, it's a complete coincidence.


I sometimes get questions about articles I wrote (many years ago), but no one had asked me about this line, so I was pleased to respond. But the poor guy didn't know what he was getting into, because I just went on and on and on:



> I haven't thought of it before. and I know it may sound silly, but I'm
> curious to know why you think so..

Not silly at all! I've gotten many emails about my articles over the
years, but no one asked about this most-important of topics.

In programming, we use so many methods to try to control the
complexity, but in the end, I, at least, feel like I don't have a
handle on the whole system, and when something works, it *feels* like
I just got lucky.

When I first wrote that bio, I was just a year out from writing
DOS/Windows games. It drove me nuts -- one bug and you have to reboot
your computer. It really frustrated and traumatized me, so that I
would be crossing my fingers every time I ran the program. I guess I
needed more reliability than that, which is why I was quite pleased to
switch to Java.

If I think about the enormous complexity of the whole system, it
boggles my mind. I write this code running inside emacs, an ancient,
huge program that, itself, contains a lisp interpreter; my code is
compiled by a huge program that itself was compiled by a huge program
that, itself, was in turn compiled by a huge program, going all the
way back over the years to someone who wrote a tiny assembler and
punched it into the front panel of some primitive computer.
Meanwhile, the compiler is reading from disk spinning at who knows how
many RPM, with a magnetic head floating just above the fragile
surface. The disk sectors are being read, possibly out of order, into
memory buffers, probably inside an interrupt where some special pin on
the chip halted the processor in the middle of decoding some zany
machine language that looks like

0a 62 6f 67 67 6c 65 73 20 6d 79 20 6d 69 6e 64
2e 20 20 49 20 77 72 69 74 65 20 74 68 69 73 20
63 6f 64 65 20 72 75 6e 6e 69 6e 67 20 69 6e 73
69 64 65 20 65 6d 61 63 73 2c 20 61 6e 20 61 6e
63 69 65 6e 74 2c 0a 68 75 67 65 20 70 72 6f 67
72 61 6d 20 74 68 61 74 2c 20 69 74 73 65 6c 66
2c 20 63 6f 6e 74 61 69 6e 73 20 61 20 6c 69 73
70 20 69 6e 74 65 72 70 72 65 74 65 72 3b 20 6d
79 20 63 6f 64 65 20 69 73 0a 63 6f 6d 70 69 6c
65 64 20 62 79 20 61 20 68 75 67 65 20 70 72 6f
67 72 61 6d 20 74 68 61 74 20 69 74 73 65 6c 66

but also, since it's DOS (or Windows 3.1, same thing), the memory is
being paged around by some crazy 'dos extender' which has all its
interrupts going; all of this data is being parsed by a crazy state
machine with hundreds of states, and turned into a code tree and
analyzed and rendered into more '79 20 63 6f 64' and written to an
executable file with interlocking code sections; and then that file is
read into memory which does the run-time linking, relocating pointers
or whatever the hell it does, and don't forget that we might be
triggering page faults and reading from and writing from disk, and all
of this is written in a language that is almost certainly not Java,
all of this is running inside a little chip of silicon, tiny currents
running through tiny wires, right next to humming power supplies and
spinning fans, and any single component might go bad and a 0 changes
to 1 and you'll never never ever ever know...

I'm telling you, I get freaked out thinking about it, and when my
program *doesn't* print "Segmentation Fault: core dumped", it seems
like I just got *really lucky*.

So that's why.

In the morning, my code feels to me like it's a nicely-designed
bicycle, with a few well-understood moving parts, and I have to adjust
this or that and get riding; by the end of the day, it seems more like
an off-shore oil rig slowly toppling into the sea...

Put another way, in the morning it feels like science, and in the
evening it feels like religion.

Wednesday, April 15, 2009

In Soviet Russia, Fir Tree Uproots You!

Some guy in Russia went to the doctor and they found a little fir tree growing in his lung. Would this be the first creature born to a male animal?

Susan came and told me this, and we were both filled with a feeling of reverence. I would honored if a tree would grow in me. However, it sounds like it was rather painful; I would probably pick some other place to grow it.

For added fun: this news story actually has a list of 5 related articles. Um, this news story is not related to any other news story that has ever been.

Monday, April 13, 2009

View larger.

I love how "view larger" really means "resize my browser and show me the same image".

When will people realize that pop-up windows are for programmers to impress clients with, not to help the user?

Friday, April 10, 2009

Tiny tiny kittens

I just have to post this picture of Becky and Tessa as tots. I look at it several times a day. I imagine there's a "well, are you going to take us home" kind of look in their eyes, so it kind of tugs at my heart. But then I remember that I did bring them home, and now they are jolly, healthy cats, are are by no means the same size anymore.

Bad ad targeting.

Really bad ad to show on the Baby Chick Cam...

Primitive art not so primitive after all?

I found an "office cave painting" the other day: a coffee splotch on a counter that looked like a hippo. Note the sophisticated use of foreshortening that makes this young hippo seem to be walking away from us.

test

test via ping from phone
Test from ping.fm.