God's Epiphany

Ovid on 2004-04-17T16:50:04

Cat sitting for a friend. Forgot to bring a book or my laptop. Mind starts wandering. It starts wandering back to an earlier conversation where I'm explaining to someone that Perl is not C and trying to program in one while thinking in the other is difficult and leads to error prone code.

The I started thinking about Widge. Widge is also falling into the "not spectacularly fast" category because ... because ... because ... crud! Widge is also a C program written in Perl. Somehow, I can't seem to break my mind out of the C mindset. I see the awful code and I cringe; I tweak it slightly but leave it substantially untouched.

I now realize not only what I was doing wrong, but what I need to do right. By being away from the code, I started thinking in terms of Perl. I started envisioning how I would code it if I was coding it from scratch, which is what I'm going to do. I now know the system well enough that I no longer need any code to refer to. The neural network is crystal clear (admittedly, it's a simple network) and the eyes are ridiculously obvious ... when I stop thinking about C. The new plan is much simpler and should run one heck of a lot faster. A quick test of some concepts this morning bore out some of my suspicions. Unfortunately, I now have to pack for my new apartment when what I really want to do is create my world of widges and watch them evolve. Damn.

I'm wondering if I can get an article out of all of this when I'm done. I really need to start writing.


Now you're getting it

VSarkiss on 2004-04-17T22:41:06

You've figured out what's so damn hard about computing. We have high-level revelations that we turn into algorithms, but we have low-level hardware. It's hard to spell out one into the other.

So.... Let's make the hardware smarter! Oh, wait, that was the '70's idea: VAX opcodes, smart assembler. That didn't go very far.

So.... Let's make the translator smarter! Oh wait, that's what RISC was going to do in the '80's: super-smart compilers against cheap, dumb hardware. Well, that kinda panned out, but not really....

So.... Let's just live with the difference, and make the hardware faster! Yes, the '90's and '00's superscalar processors, the multi-gigahertz chips. That's the ticket. Or is it...?

As you've found, it's still hard. The real impedance mismatch is between our creative brains and our constructive hands, and it hasn't been crossed yet.

Wonder what the '10's will bring.

Re:Now you're getting it

Ovid on 2004-04-18T03:23:12

Wonder what the '10's will bring.

Perl 6? :)

Seriously, I think something really needs to change in the world of computing. Testing is what's really helped to push me there. Specifically, once I started realizing that we can't just know how to build good software, I started thinking harder about this problem, but I am Bear of Little Brain and I don't have a solution for it. I realized that tests (particularly acceptance tests) are an ad hoc method of ensuring program correctness. They do not, however, prove correctness and with our insistence upon programming in ALGOL-style languages, we cannot develop proofs for our programs. Some functional languages allow for such proofs, but I understand that they are usually not supplied with the programs. I've also heard of attempts to build programs automatically from proofs. Perhaps this will help.

Currently, if I were to ask a math-savvy person to compute to factorial of 5, she will hopefully respond with 120. However, we simply do not expect her to ever forget that there's a terminating condition, as some programmers might in a naive factorial function:

sub factorial {
    my $n = shift;
    # whoops!  Forgot the terminating condition of $n == 1
    return $n + factorial($n - 1);
}

Now she might make a simple math error and that's something that computers are generally better and faster at, but she won't have a logic error. I can also ask her to hand me a pen and she won't hand me a book by mistake. Computers can and will make such mistakes.

We're also fault-tolerant in a way that computers are not. If I ask who the redhead hired in accounting is, you might tell me that his name is "Sam", but he was hired in human resources. (Neural networks might also be able to do that, I might add.)

I don't think the 10s will solve this problem, but the 20s might start getting a handle on it. Unfortunately, we may have to be willing to release our love of ALGOL-style languages to get there, but I'm still unsure of what might take its place. I actually think that Perl 6 rules might start giving us some interesting clues. If the language is widely adopted, for the first time that I am aware of, we will have a programming language in widespread use that might allow logic programming in a typical environment (assuming that we can implement logic programming in P6 rules -- I think we might be able to.)

Bah. I'm rambling about something I know very little about. Silly me. Time to get off the computer, stop packing for the day and hit the clubs. I understand "The Cancer Fags" are playing to night and I've been meaning to see them.