Zorba the Hutt (zorbathut) wrote,
Zorba the Hutt

  • Mood:


Okay. I've been meaning to write this rant for a long time and someone just reminded me of it.

So I'm going to tell you about Prolog. First in factual terms. Then in artistic terms. Feel free to skip the factual if you wish.

Prolog is a member of the language family knows as "non-imperative languages". Basically, this means that instead of writing out a bunch of instructions that the computer executes one at a time, you do something else. In Prolog's case it's based around truth tables and logic. In theory, you can write something like "If a person is male and is not married, they are a bachelor." (please, no arguments on this right now, okay? I'm just making a point.) And then you can plug in a bunch of facts, like, say, "bob is male, jane isn't married, tim is male, tim isn't married" and ask it "Who is a bachelor?" and, everything going correctly, it will inform you that Tim is, in fact, a bachelor.

Now this can be expanded tremendously and in many cool ways. You can write up very complex interesting things in just a few lines of code, and the program will give you fantastic results quickly.

With just a few problems.

Computers aren't fast enough or smart enough to do this sort of thing well. We don't have the logic to make "leaps of intuition", and while computers are really smart, there are many algorithms and setups out there that can make them choke and die.

Prolog has *very* strict rules on how it executes.

None of these rules involve more than the vaguest possibilities for optimization. So you get beautifully written pretty algorithms that take literally hours to run on small data sets.

The solution? Let the programmer optimize it! Of course, since computers are effectively imperative beasts, you're going to have to optimize it along those lines . . .

Now, the artistic version:

Say a bunch of architects got together and decided to build a really beautiful building. Glass lattice, overhanging arches, the works. And they decided early on "Let's not worry about that pesky gravity. Let's just make the most beautiful thing we can."

So when it was done and they were about to remove the support structure, they suddenly realized that, actually, that pesky gravity couldn't be ignored at all.

So they called in a bunch of engineers to reinforce it, and said, "Don't worry about the architecture! Just make it stand up!"

End result: What used to be an enormous beautiful crystal building with all these giant steel I-beams slammed through it in every direction just because.

I swear it's like that every time. We get told someone and I think "oooh, that's pretty cool" and then he says "Oh, but it doesn't work in these situations because the computer can't handle it. So you're going to have to use <ugly hack>." Or we start running into performance problems and the teacher realizes the elegant solution he gave us is far too slow in Prolog, and we'll have to use something that - effectively - is an imperative solution to the problem, one that I could have coded in C++ in fifteen seconds but takes five minutes in Prolog because it's just so ghastly.

Okay. End rant.

Worst Language Ever.
  • Post a new comment


    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.