The Philosophy of Programs
Translated from Russian. Originally published on Nov 21, 2007 as “Философия программ”.
Perhaps language determines what a person is able to think about at all. A bad language limits; such a language usually has no inner beauty and, of course, brings no aesthetic pleasure. Without doubt, all this applies to programming languages too. Many of them have long outgrown themselves and stopped being mere tools. It's no accident that phrases like "the philosophy of C++" or "the philosophy of Java" sometimes come up in conversation…
The creator of C++, Bjarne Stroustrup, is an incredible person — if only because he really did build a whole philosophical system under his brainchild. You can read about it in his book The Design and Evolution of C++. Here is a quote (required reading for programmers ;)
/*
It is said that the structure of a system reflects the structure of the organization that created it. By and large I support this view. It also follows that if a system is the work of one person, it reflects his personality. Looking back, I think that my worldview has left as much of an imprint on the overall structure of C++ as the scientific concepts underlying its individual parts.
I studied mathematics, including applied mathematics, so my Danish candidate's thesis was on mathematics and computer science. As a result, I learned to love the beauty of mathematics, but I preferred to look at it as a tool for solving practical problems. I sincerely sympathized with the student whom Euclid, according to legend, threw out for asking "But what is mathematics for?" In the same way, my interest in computers and programming languages is mainly pragmatic. Computers and programming languages can be judged as works of art, but aesthetic factors should complement and enhance their useful properties, not replace them.
I have been interested in history for more than 25 years. I have also spent a fair amount of time studying philosophy. Hence a quite conscious view of the origins of my intellectual preferences. As for philosophical schools, I am closer to the empiricists than to the idealists; mystics I simply don't understand. So I prefer Aristotle to Plato, Hume to Descartes, and I bow my head before Pascal. All-embracing "systems" such as those of Plato or Kant captivate me but seem fundamentally flawed, because, in my opinion, they are very far from everyday experience and from the particularities of the concrete individual.
Kierkegaard's almost fanatical interest in the individual and his subtle understanding of psychology seem to me far more interesting than the grandiose schemes and concern for all of mankind characteristic of Hegel or Marx. Respect for a group that does not imply respect for its members I do not consider respect at all. Many decisions in C++ are rooted in my unwillingness to force users to do anything in a rigidly prescribed way. History teaches us that the blame for many terrible tragedies lies with idealists who tried to make people "do what is good for them". Besides, I believe idealists tend to ignore inconvenient experience and facts that contradict their dogmas or theory. Whenever ideals come into conflict, and sometimes even in situations where learned men have reached unanimous agreement, I prefer to give the programmer a choice.
My literary tastes once again confirm my unwillingness to make decisions on the basis of theory and logic alone. In this sense C++ owes much to novelists and essayists such as Martin A. Hansen, Albert Camus and George Orwell, who never saw a computer, and to scientists such as David Gries, Donald Knuth and Roger Needham. Often, when tempted to ban some feature that I personally disliked, I stopped myself, because I did not consider myself entitled to impose my point of view on other people. I know that much can be achieved relatively quickly by consistently following logic and ruthlessly condemning "wrong, outdated and illogical ways of thinking". But under such a model the human cost becomes very high. For me, accepting the fact that people think and act differently is worth much more.
I prefer to persuade people slowly — sometimes very slowly — to try new techniques and to adopt those that fit their needs and inclinations. Effective methods of "conversion" and "revolution" exist, but I fear them and strongly doubt they are all that effective in the long run and on the whole. Often, when someone is easily converted to religion X, the subsequent conversion to religion Y turns out to be just as easy, and the gain is ephemeral. I prefer skeptics to "true believers". A small but irrefutable fact is worth more to me than most theories, and an experimentally demonstrated result is more important than a heap of logical arguments.
Such a view of things can easily lead to a fatalistic acceptance of the status quo. After all, you can't make an omelet without breaking eggs — many people simply don't want to change if it is inconvenient for their daily lives, or at least try to postpone change "until Monday". This is where one must show respect for facts... and a dash of idealism.
The state of affairs in programming, as in the world in general, is far from ideal, and much can be improved. I designed C++ to solve a particular problem, not to prove something to someone, and as a result the language turned out to be useful. Its philosophy rested on the conviction that improvements can be achieved through gradual change. Of course, one would like to maintain the maximum pace of changes that improve people's well-being. But the hardest part is to understand what progress actually consists of, to work out a method of gradual transition to something better, and to avoid the excesses caused by excessive enthusiasm.
I am prepared to work hard at getting ideas accepted that I am deeply convinced will benefit people. Moreover, I believe that scientists and intellectuals should help spread their ideas in society, so that people apply them rather than leaving them as a game of a sophisticated mind. However, I am not prepared to sacrifice people in the name of these ideas. In particular, I don't want to impose a single design style by means of a narrowly defined programming language. People's thoughts and actions are so individual that any attempt to reduce everyone to a common denominator will do more harm than good. That is why C++ is deliberately designed to support a variety of styles rather than to show the one "true way".
Yes, a programming language is an unusually important thing, but it is only a tiny part of the real world, and so one shouldn't take it too seriously. One needs a sense of proportion and — even more important — a sense of humor. Among the major programming languages, C++ is the richest source of jokes and anecdotes. And this is no accident.
When discussing philosophical questions, as well as language features, it is easy to slip into an overly serious and moralizing tone. If that has happened to me, please accept my apologies, but I wanted to explain my intellectual preferences, and I think this is harmless — well, almost harmless. By the way, my literary tastes are not limited to the works of the authors named above; it's just that they are the ones who influenced the creation of C++.
*/
(The quotation is translated from the Russian edition of the book that the original post cited.)