SOFTWARE DESIGN: A PARABLE

PROFESSOR C. A. R. HOARE, University of Belfast

(From Software World, Vol. 5, Nos. 9 & 10, 1975, pp 53-56)

This document is available on the following URLs:
In PDF format (optimized for printing): http://dsv.su.se/jpalme/s1/hoare.pdf
In HTML format (optimized for screen reading): http://dsv.su.se/jpalme/s1/hoare.html

 

Introduction by Professor Jacob Palme, Stockholm University and KTH Technical University, 1999:

There are few texts which have had as much influence on my thinking and understanding than this. Even though it was written more than 25 years ago, its ideas are as valid today as then. I have put it up on the web to make it available to more people.

The pictures have been added by Jacob Palme, they were not part of the original paper by C. A. R. Hoare.

 

In earlier times, and in primitive societies, the prosperity of a community depended heavily (as it does today) on the skill and dedication of its experts. The expert of those days was the craftsman, the cobbler, the blacksmith, the joiner, the thatcher. A craftsman possesses skills which are specialised, and not possessed by the whole population. His skill consists in his familiarity with his task, his understanding of its nature and its objectives, his facility with a few simple tools, and his ingenuity in applying them to a wide variety of familiar and new circumstances. And the competent craftsman has little difficulty in persuading his clients of the merits of his methods and his products.
   Today in advanced societies the old skills are no longer required, and they are dying out; the craftsmen are being replaced by experts of a new kind, the architect, the doctor, the social worker, the civil engineer, and many other professional men and women. These inherit many of the attributes of the craftsman - skill, experience, adaptability, ingenuity, understanding, and the ability to make themselves understood and appreciated by their clients and customers, who do not share their expertise.
   In primitive societies there is often to be seen another class of specialist. Like the craftsman he is dedicated to his profession; like the craftsman he is consulted by the layman in his hour of need; like the craftsman, he is regarded with respect, and perhaps even with awe; and like the craftsman he has numbers of satisfied clients. The member of this class of specialist may be known as a seer, a soothsayer, a magician, an oracle, a witchdoctor, a sorcerer, a wizard, and so on. I shall use the word "high priest" to refer to them all. This term is intended to apply only to a pagan priesthood, and not to the ministers of any religion of the present day.
   There are many differences between the craftsman and the high priest. One of the most striking is that the high priest is the custodian of a weighty set of sacred books, or magician's manuals, which he alone is capable of reading. When he is consulted by his client with some new problem, he refers to his sacred books to see whether he can find some spell or incantation which has proved efficacious in the past, and having found it, he tells his client to copy it carefully and use it in accordance with a set of elaborate instructions. If the slightest mistake is made in copying or in following the instructions, the spell may turn to a curse, and bring misfortune to the client. The client has no hope of understanding the nature of the error or why it has evoked the wrath of his deity - the high priest himself has no inner understanding of the ways of god. The best the client can hope is to go right back to the beginning, and start the spell again; and if this does not work, he goes back to the high priest to get a new spell.
   And that is another feature of the priesthood - when something goes wrong, as it quite often does, it somehow always turns out to be the ignorance or stupidity or impurity or wickedness of the client; it is never the fault of the high priest or his god. It is notable that when the harvest fails, it is the high priest who sacrifices the king, never the other way round.
   Now there is a great temptation for any body of professional men and
   women today to turn themselves into a priesthood. The mantle of the priest has many advantages to the wearer.
   Firstly he no longer has the obligation to explain himself, his methods, and his objectives to his clients - indeed, it is actually better to increase their mystification. As a consequence, when things go wrong, as they often do, the client himself is willing to accept the blame. The high priest no longer needs to embark on the uncertain and painful activity of thinking. All that is required is the ability to consult the sacred books and copy them carefully; for if a remedy is not to be found in the books, there is little hope that it can be constructed merely by the exercise of skill and ingenuity.
   But I believe that the insidious temptation for professionals to turn themselves into a priesthood must be rejected with all the strength at our disposal. Let us extend our parable into the future, and see what would happen if our medical profession were to become a priesthood. The walls of the waiting room of our general practitioner are now covered by volumes of the sacred book - the manuals supplied by a prosperous and public-spirited drug company. The doctor's duty has been reduced to consulting these volumes to find a case which seems similar to that of his client, and finding which drug was efficacious in that case, and giving the necessary elaborate instructions for administration of the drug. There is no need for the doctor to understand his client's complaint or even the method of operation of the drug upon it. In fact the drugs and their interrelations and their descriptions have got so complicated that it would be impossible for anyone to understand that, even the manufacturers of the drugs themselves, and the writers of the manuals which describe them.
   Apart from the obvious benefits to the doctors, there are a number of other desirable consequences that would flow from this development. Firstly, it would be highly beneficial to the larger drug companies, and prejudicial to smaller companies, which would not have the resources to construct, maintain, sell, and service such a large catalogue of products. Secondly, the ardours of university education in medicine would obviously become largely irrelevant to the needs of practising doctors and their patients, although perhaps a stylised form of this education would be maintained as a form of initiation to the priesthood. Professors of Medicine would confine their research activities to theoretical studies, and to theological wrangling; or those who wished to climb down from their ivory tower would confine themselves to historical and textual exegesis of the sacred books. And finally, the general public, the patients, would be entirely satisfied with the arrangement, and would look back at the profession of medicine as it is practised today as backward, if not barbarous.
   I sincerely hope that this study of the future will not come true for the profession of medicine or architecture or law or social work, or engineering. One reason is that I do not believe that all of professional practice can be codified in any set of books; nor do I believe that it is so far beyond the scope of human intellect and understanding that it needs such codification. Finally, I do not believe that any single manufacturer of supplies and equipment will have the temerity, let alone the commercial power, to construct and propagate the necessary catalogue and manuals.
   But in the case of my own profession, that of computer science, I very much fear that it has already gone a long way on the path towards a priesthood The analogies are too close for comfort. Our altars are hidden from the general public in a superbly air-conditioned holy of holies; ministered to day and night by a devoted team of acolytes, and regarded by the general public with feelings of mystical awe, which has been nourished in our own interests by those specialists who should have put forward all their efforts to dispel it.
   These analogies are dangerous; but I believe that the most dangerous aspect of all is the increasing dominance of our sacred books , the software manuals which have become essential to our every approach to the computer, and whose size and complexity seems to be increasing at an unbelievable rate. I have recently attempted to study a slim volume from the library provided by one manufacturer. It was rather over a hundred pages of close type. At the beginning, it frankly told me that an understanding of the text would depend on prior familiarity with three other volumes not available to me. It also admitted that the practical application of the knowledge contained therein would depend on a knowledge of some other volumes, depending on the size and nature of my computer and its software configuration.
   Nevertheless, I persevered in my study of this single volume. I found in it some extremely well written and well presented case studies of several example problems which could be solved with the aid of particular incantations displayed therein. Indeed, I had a very strong impression that I had understood the methods described, until I tried to apply them to a new and different example problem of my own. Then I realised that I had no knowledge of the actual capabilities of the software described - what was the range and limits of its adaptability. In fact, the only way of solving the new problem was to try to copy the incantations carefully from the manual, making as few adaptations as possible to meet the needs of the new problem. Naturally, this involved a great deal of guesswork, since there was no way of finding in advance whether the changes would have the desired effect, or indeed, whether they would be acceptable to the deity at all. The only recourse is to try them out; if successful, I will praise the lord from whom all good things do flow; if not, I will attribute my failure to my own errors, sins of commission and omission, and resolve to do better next time. Any idea that I have control or responsibility for the efficient and effective use of the computer has disappeared entirely.
   There is another and rarer class of person whose activities are recorded by history, and whose successors are still active today - these are the prophets of doom. They are inclined to point out that the priesthood has gotten fat and idle and self-seeking; that they are leading the people in the worship of false gods, and that the only hope of avoiding disaster is a widespread return to the simple virtues of earlier times. Naturally, they make themselves very unpopular with the priesthood, and usually even more so with the population; it is not the priests but the population which drives such men and women into the wilderness.In spite of this, I can see that prophets of doom are still needed today, and still persist in their unpopular messages. An outstanding example is Rachel Carson, who pointed out that the growing use of chemical insecticides is even more damaging to crops and people than the insects which they were increasingly failing to kill. And I hope that even in the future, if a profession ever degenerates into a priesthood, there will be those who continue to fight against it. In the future as in the past, we will have doctors who persist in pointing out that fashionable remedies are useless, or even damaging, that the drugs are worse than the disease, that many of them are addictive, that their effectiveness decreases with repeated use, that their side-effects induce even worse diseases, which need yet more drugs for their cure; until the problems caused by the drugs are many times more severe than the original problems which the drugs were designed to cure.
   This situation has occurred again and again the history of medicine and there have always been doctors brave enough to point it out. It has occurred in the development of artificial fertilisers and weedckillers. And let us not be ashamed to admit that it has occurred in the development of computer software designs, which were originally intended to simplify computer usage and make it more accessible, and which have now become a major barrier to both understanding and access.
   So it is among the prophets of doom that I wish to enrol myself. I believe that the current situation in software design is bad, and that it is getting worse. I do not expect that this will be recognised by the designers, manufacturers, sellers, or even the users of software, who will regard the increase in complexity as a sign of progress, or at least an inevitable concomitant thereof; and may even welcome it as a tribute to their intelligence, or at least a challenge. The larger manufacturers are not only set in their ways, but they have actually profited from the increase in complexity of their software, and the resulting decrease in the efficiency and effectiveness of their customers' use of hardware. And everything is now so complicated, that any particular attack on the problem of low quality software design can always be evaded by appeals to tradition, to standards, to customer prejudice, to compensating advantages, and even to promises to mend the fault in future issues.
   So it will be a long tine before there is even any recognition of the problem which faces our profession. But even if the problem were widely recognised and deplored, its solution is going to present extremely difficult technical problems. The pursuit of complexity is easy, and the implementation of complexity can safely be delegated to competent managers. But the pursuit of simplicity is one of the most difficult and challenging activities of the human mind. Progress is likely to be extremely slow, where each complexity eliminated must be hailed as a breakthrough. We need not only brilliance of intellect but breadth of experience, nicety of judgement, excellence of taste, and even more than our fair share of good luck. And finally we need a puritanical rejection of the temptations of features and facilities, and a passionate devotion to the principles of purity, simplicity and elegance.
   And so my final message too has strong religious overtones. I 
hope that the reformation in software design that I advocate will be peaceful and prosperous.

Other documents of interest

(This section was not part of the original paper by C. A. R. Hoare,
they were added by Jacob Palme when putting up the page on the web.)

User influence on software design may give less good software
Can computers decide what is right and wrong?