Naur Programming as Theory Building
Peter Naur: Programming as Theory Building
Alistair Cockburn intro, from Agile Software Development: This article is, to my mind, the most accurate account of what goes on in designing and coding a program. I refer to it regularly when discussing how much documentation to create, how to pass along tacit knowledge, and the value of the XP’s metaphor-setting exercise. It also provides a way to examine a methodology’s economic structure...Using Naur’s ideas, the designer’s job is not to pass along “the design” but to pass along “the theories” driving the design
Introduction
programmers form or achieve a certain kind of insight, a theory, of the matters at hand
Programming and the Programmers’ Knowledge
Case 1 concerns a compiler. It has been developed by a group A for a Language L and worked very well on computer X. Now another group B has the task to write a compiler for a language L + M, a modest extension of L, for computer Y. Group B decides that the compiler for L developed by group A will be a good starting point for their design, and get a contract with group A that they will get support in the form of full documentation, including annotated program texts and much additional written design discussion, and also personal advice.
the significant issue is the importance of the personal advice from group A in the matters that concerned how to implement the extensions M to the language.
solutions suggested by group B were found by group A to make no use of the facilities that were not only inherent in the structure of the existing compiler but were discussed at length in its documentation, and to be based instead on additions to that structure in the form of patches that effectively destroyed its power and simplicity. The members of group A were able to spot these cases instantly and could propose simple and effective solutions
Case 2 concerns the installation and fault diagnosis of a large real-time system for monitoring industrial production activities. The system is marketed by its producer, each delivery of the system being adapted individually to its specific environment of sensors and display devices.
The relevant experience from the way this kind of system is handled concerns the role and manner of work of the group of installation and fault finding programmers. The facts are, first that these programmers have been closely concerned with the system as a full time occupation over a period of several years, from the time the system was under design
traced to inadequate understanding of the existing documentation
The conclusion seems inescapable that at least with certain kinds of large programs, the continued adaptation, modification, and correction of errors in them, is essentially dependent on a certain kind of knowledge possessed by a group of programmers who are closely and continuously connected with them
the programmers’ knowledge properly should be regarded as a theory, in the sense of [[Gilbert Ryle
It may be noted that Ryle’s notion of theory appears as an example of what Karl Popper [Popper, and Eccles, 1977] calls unembodied World 3 objects and thus has a defensible philosophical standing. In the present section we shall describe Ryle’s notion of theory in more detail.
Ryle [1949] develops his notion of theory as part of his analysis of the nature of intellectual activity, particularly the manner in which intellectual activity differs from, and goes beyond, activity that is merely intelligent. In intelligent behaviour the person displays, not any particular knowledge of facts, but the ability to do certain things, such as to make and appreciate jokes, to talk grammatically, or to fish. More particularly, the intelligent performance is characterized in part by the person’s doing them well, according to certain criteria, but further displays the person’s ability to apply the criteria so as to detect and correct lapses, to learn from the examples of others, and so forth
What characterizes intellectual activity, over and beyond activity that is merely intelligent, is the person’s building and having a theory, where theory is understood as the knowledge a person must have in order not only to do certain things intelligently but also to explain them, to answer queries about them, to argue about them, and so forth.
Even quite unambitious activities of everyday life may give rise to people’s theorizing, for example in planning how to place furniture or how to get to some place by means of certain means of transportation.
The dependence of a theory on a grasp of certain kinds of similarity between situations and events of the real world gives the reason why the knowledge held by someone who has the theory could not, in principle, be expressed in terms of rules. In fact, the similarities in question are not, and cannot be, expressed in terms of criteria, no more than the similarities of many other kinds of objects, such as human faces, tunes, or tastes of wine, can be thus expressed.
The Theory to Be Built by the Programmer
In terms of Ryle’s notion of theory, what has to be built by the programmer is a theory of how certain affairs of the world will be handled by, or supported by, a computer program
the programmer’s knowledge transcends that given in documentation in at least three essential areas:
1) The programmer having the theory of the program can explain how the solution relates to the affairs of the world that it helps to handle
the affairs of the world, both in their overall characteristics and their details, are, in some sense, mapped into the program
2) The programmer having the theory of the program can explain why each part of the program is what it is, in other words is able to support the actual program text with a justification of some sort.
3) The programmer having the theory of the program is able to respond constructively to any demand for a modification
Problems and Costs of Program Modifications
One thing seems to be agreed by everyone, that software will be modified
The question of program modifications is closely tied to that of programming costs
The expectation that program modifications at low cost ought to be possible is one that calls for closer analysis. First it should be noted that such an expectation cannot be supported by analogy with modifications of other complicated manmade constructions
Second, the expectation of the possibility of low cost program modifications conceivably finds support in the fact that a program is a text held in a medium allowing for easy editing. For this support to be valid it must clearly be assumed that the dominating cost is one of text manipulation.
On the Theory Building View this whole argument is false
A further closely related issue is that of program flexibility
a flexible program is able to handle certain classes of changes of external circumstances without being modified
flexibility can in general only be achieved at a substantial cost.
It must be obvious that built-in program flexibility is no answer to the general demand for adapting programs to the changing circumstances of the world.
Program Life, Death, and Revival
A main claim of the Theory Building View of programming is that an essential part of any program, the theory of it, is something that could not conceivably be expressed, but is inextricably bound to human beings
as the building of the theory of it by and in the team of programmers. During the program life a programmer team possessing its theory remains in active control of the program, and in particular retains control over all modifications. The death of a program happens when the programmer team possessing its theory is dissolved. A dead program may continue to be used for execution in a computer and to produce useful results. The actual state of death becomes visible when demands for modifications of the program cannot be intelligently answered. Revival of a program is the rebuilding of its theory by a new programmer team.
For a new programmer to come to possess an existing theory of a program it is insufficient that he or she has the opportunity to become familiar with the program text and other documentation
This problem of education of new programmers in an existing theory of a program is quite similar to that of the educational problem of other activities where the knowledge of how to do certain things dominates over the knowledge that certain things are the case, such as writing and playing a music instrument
Theory Building View is that program revival, that is reestablishing the theory of a program merely from the documentation, is strictly impossible
In preference to program revival, the Theory Building View suggests, the existing program text should be discarded and the new-formed programmer team should be given the opportunity to solve the given problem afresh
Method and Theory Building
Here a programming method will be taken to be a set of work rules for programmers, telling what kind of things the programmers should do, in what order, which notations or languages to use, and what kinds of documents to produce at various stages
In building the theory there can be no particular sequence of actions, for the reason that a theory held by a person has no inherent division into parts and no inherent ordering
It follows that on the Theory Building View, for the primary activity of the programming there can be no right method
Two such apparent contradictions shall be taken up here
The first argument is that software development should be based on scientific manners, and so should employ procedures similar to scientific methods. The flaw of this argument is the assumption that there is such a thing as scientific method and that it is helpful to scientists. This question has been the subject of much debate in recent years, and the conclusion of such authors as Feyerabend
The second argument that may seem to contradict the dismissal of method of the Theory Building View is that the use of particular methods has been successful, according to published reports. To this argument it may be answered that a methodically satisfactory study of the efficacy of programming methods so far never seems to have been made
Most published reports on such methods merely describe and recommend certain techniques and procedures, without establishing their usefulness or efficacy in any systematic way.
Programmers’ Status and the Theory Building View
The areas where the consequences of the Theory Building View contrast most strikingly with those of the more prevalent current views are those of the programmers’ personal contribution to the activity and of the programmers’ proper status
much current discussion of programming seems to assume that programming is similar to industrial production, the programmer being regarded as a component of that production, a component that has to be controlled by rules of procedure and which can be replaced easily
Instead the programmer must be regarded as a responsible developer and manager of the activity in which the computer is a part.
The raising of the status of programmers suggested by the Theory Building View will have to be supported by a corresponding reorientation of the programmer education. While skills such as the mastery of notations, data representations, and data processes, remain important, the primary emphasis would have to turn in the direction of furthering the understanding and talent for theory formation. To what extent this can be taught at all must remain an open question. The most hopeful approach would be to have the student work on concrete problems under guidance, in an active and constructive environment
Cockburn: APPLYING “THEORY BUILDING”
Viewing programming as theory building helps us understand “metaphor building” activity in Extreme Programming (XP), and the respective roles of tacit knowledge and documentation in passing along design knowledge.
The Metaphor as a Theory
Kent Beck suggested that it is useful to a design team to simplify the general design of a program to match a single metaphor
If the metaphor is good, the many associations the designers create around the metaphor turn out to be appropriate to their programming situation. That is exactly Naur’s idea of passing along a theory of the design
The value of a good metaphor increases with the number of designers. The closer each person’s guess is “close” to the other people’s guesses, the greater the resulting consistency in the final system design. Imagine 10 programmers working as fast as they can, in parallel, each making design decisions and adding classes as she goes
Tacit Knowledge and Documentation
The documentation is almost certainly behind the current state of the program, but people are good at looking around. What should you put into the documentation? That which helps the next programmer build an adequate theory of the program
The purpose of the documentation is to jog memories in the reader, set up relevant pathways of thought about experiences and metaphors
They can even use multiple metaphors, if they don’t find one that is adequate for the entire program
Experienced designers often start their documentation with just • The metaphors • Text describing the purpose of each major component • Drawings of the major interactions between the major components
Documentation cannot—and so need not—say everything. Its purpose is to help the next programmer build an accurate theory about the system.
Edited: | Tweet this! | Search Twitter for discussion