Next: Programming Bottom-Up, Up: The Extensible Language
Because Lisp gives you the freedom to define your own operators, you can mold it into just the language you need.
If you’re not sure yet what kind of program you’re writing? To some ears that sentence has an odd ring to it. It is in jarring contrast with a certain model of doing things wherein you
According to this model, if Lisp encourages you to start writing your program before you’ve decided how it should work, it merely encourages sloppy thinking.
Well, it just ain’t so. The plan-and-implement method may have been a good way of building dams or launching invasions, but experience has not shown it to be as good a way of writing programs. Why?
It may be difficult to say why the old method fails, but that it does fail, anyone can see. When is software delivered on time? Experienced programmers know that no matter how carefully you plan a program, when you write it the plans will turn out to be imperfect in some way. Sometimes the plans will be hopelessly wrong.
Yet few of the victims of the plan-and-implement method question its basic soundness. Instead they blame human failings: if only the plans had been made with more foresight, all this trouble could have been avoided. Since even the very best programmers run into problems when they turn to implementation, perhaps it’s too much to hope that people will ever have that much foresight. Perhaps the plan-and-implement method could be replaced with another approach which better suits our limitations.
We can approach programming in a different way, if we have the right tools. Why do we plan before implementing? The big danger in plunging right into a project is the possibility that we will paint ourselves into a corner. If we had a more flexible language, could this worry be lessened? We do, and it is. The flexibility of Lisp has spawned a whole new style of programming.
In Lisp, you can do much of your planning as you write the program.
Why wait for hindsight? As Montaigne found, nothing clarifies your ideas like trying to write them down. Once you’re freed from the worry that you’ll paint yourself into a corner, you can take full advantage of this possibility.
The ability to plan programs as you write them has two momentous consequences:
So long as you maintain a certain discipline while searching for your program’s destiny—so long as you always rewrite mistaken parts as soon as it becomes clear that they’re mistaken—the final product will be a program more elegant than if you had spent weeks planning it beforehand.
Lisp’s versatility makes this kind of programming a practical alternative. Indeed, the greatest danger of Lisp is that it may spoil you. Once you’ve used Lisp for a while, you may become so sensitive to the fit between language and application that you won’t be able to go back to another language without always feeling that it doesn’t give you quite the flexibility you need.
Next: Programming Bottom-Up, Up: The Extensible Language