systems analysis
8 Calling the Shot
8 Calling the Shot
Practice is the best of all instructors.
PUBUUUS
Experience is a dear teacher, but fools will learn at no other.
POOR RICHARD'S ALMANAC
Douglass Crockwell, "Ruth calls his shot," World Series, 1932 Reproduced by permission of Esquire Magazine and Douglass Crockwell, © 1945 (renewed 1973) by Esquire, Inc., and courtesy of the National Baseball Museum.
87
88 Calling the Shot
How long will a system programming job take? How much effort will be required? How does one estimate?
I have earlier suggested ratios that seem to apply to planning time, coding, component test, and system test. First, one must say that one does not estimate the entire task by estimating the coding portion only and then applying the ratios. The coding is only one-sixth or so of the problem, and errors in its estimate or in the ratios could lead to ridiculous'results.
Second, one must say that data for building isolated small programs are not applicable to programming systems products. For a program averaging about 3200 words, for example, Sackman, Erikson, and Grant report an average code-plus-debug time of about 178 hours for a single programmer, a figure which would extrapolate to give an annual productivity of 35,800 statements per year. A program half that size took less than one-fourth as long, and extrapolated productivity is almost 80,000 statements per year.1 Planning, documentation, testing, system integration, and training times must be added. The linear extrapolation of such sprint figures is meaningless. Extrapolation of times for the hun- dred-yard dash shows that a man can run a mile in under three minutes.
Before dismissing them, however, let us note that these num- bers, although not for strictly comparable problems, suggest that effort goes as a power of size even when no communication is involved except that of a man with his memories.
Figure 8.1 tells the sad story. It illustrates results reported from a study done by Nanus and Farr2 at System Development Corpo- ration. This shows an exponent of 1.5; that is,
effort = (constant) X (number of instructions)15.
Another SDC study reported by Weinwurm3 also shows an expo- nent near 1.5.
A few studies on programmer productivity have been made, and several estimating techniques have been proposed. Morin has prepared a survey of the published data.4 Here I shall give only a few items that seem especially illuminating.
Portman's Data 89
Fig. 8.1 Programming effort as a function of program size
Portman's Data
Charles Portman, manager of ICL's Software Division, Computer Equipment Organization (Northwest) at Manchester, offers an- other useful personal insight.5
He found his programming teams missing schedules by about one-half—each job was taking approximately twice as long as estimated. The estimates were very careful, done by experienced teams estimating man-hours for several hundred subtasks on a PERT chart. When the slippage pattern appeared, he asked them to keep careful daily logs of time usage. These showed that the estimating error could be entirely accounted for by the fact that his teams were only realizing 50 percent of the working week as actual programming and debugging time. Machine downtime, higher-priority short unrelated jobs, meetings, paperwork, com-
Thousands of machine instructions
90 Calling the Shot
pany business, sickness, personal time, etc. accounted for the rest. In short, the estimates made an unrealistic assumption about the number of technical work hours per man-year. My own experi- ence quite confirms his conclusion.6
Aron's Data
Joel Aron, manager of Systems Technology at IBM in Gaithers- burg, Maryland, has studied programmer productivity when working on nine large systems (briefly, large means more than 25 programmers and 30,000 deliverable instructions).7 He divides such systems according to interactions among programmers (and system parts) and finds productivities as follows:
Very few interactions 10,000 instructions per man-year Some interactions 5,000 Many interactions 1,500
The man-years do not include support and system test activi- ties, only design and programming. When these figures are diluted by a factor of two to cover system test, they closely match Harr's data.
Harr's Data
John Hair, manager of programming for the Bell Telephone Labo- ratories' Electronic Switching System, reported his and others' experience in a paper at the 1969 Spring Joint Computer Confer- ence.8 These data are shown in Figs. 8.2, 8.3, and 8.4.
Of these, Fig. 8.2 is the most detailed and the most useful. The first two jobs are basically control programs; the second two are basically language translators. Productivity is stated in terms of debugged words per man-year. This includes programming, com- ponent test, and system test. It is not clear how much of the planning effort, or effort in machine support, writing, and the like, is included.
Han's Data 91
Operational Maintenance Compiler Translator (Data assembler)
units
50 36 13 15
Number of programmers
S3 60 9
13
Years
4 4
•2'A 2%
Maa- years
101 81 1? 11
Program words
52,OQG 51,000 38,000 25,000
Words/' man-yf
515 630
2270
Fig. 8.2 Summary of four No. 1 ESS program jobs
The productivities likewise fall into two classifications; those for control programs are about 600 words per man-year; those for translators are about 2200 words per man-year. Note that all four programs are of similar size—the variation is in size of the work groups, length of time, and number of modules. Which is cause and which is effect? Did the control programs require more people because they were more complicated? Or did they require more modules and more man-months because they were assigned more people? Did they take longer because of the greater complexity, or because more people were assigned? One can't be sure. The control programs were surely more complex. These uncertainties aside, the numbers describe the real productivities achieved on a large system, using present-day programming techniques. As such they are a real contribution.
Figures 8.3 and 8.4 show some interesting data on program- ming and debugging rates as-compared to predicted rates.
Fig. 8.3 ESS predicted and actual programming rates
Fig. 8.4 ESS predicted and actual debugging rates
92 Calling the Shot
Corbatd's Data 93
OS/360 Data IBM OS/360 experience, while not available in the detail of Hair's data, confirms it. Productivities in range of 600-800 debugged instructions per man-year were experienced by control program groups. Productivities in the 2000-3000 debugged instructions per man-year were achieved by language translator groups. These include planning done by the group, coding component test, sys- tem test, and some support activities. They are comparable to Han's data, so far as I can tell.
Aron's data, Hair's data, and the OS/360 data all confirm striking differences in productivity related to the complexity and difficulty of the task itself. My guideline in the morass of estimat- ing complexity is that compilers are three times as bad as normal batch application programs, and operating systems are three times as bad as compilers.9
Corbato's Data Both Hair's data and OS/360 data are for assembly language pro- gramming. Little data seem to have been published on system programming productivity using higher-level languages. Corbato of MIT's Project MAC reports, however, a mean productivity of 1200 lines of debugged PL/I statements per man-year on the MULTICS system (between 1 and 2 million words).10
This number is very exciting. Like the other projects, MUL- TICS includes control programs and language translators. Like the others, it is producing a system programming product, tested and documented. The data seem to be comparable in terms of kind of effort included. And the productivity number is a good average between the control program and translator productivities of other projects.
But Corbato's number is lines per man-year, not wordsl Each statement in his system corresponds to about three to five words of handwritten code! This suggests two important conclusions.
94 Calling the Shot
Productivity seems constant in tenns of elementary state- ments, a conclusion that is reasonable in terms of the thought a statement requires and the errors it may include." Programming productivity may be increased as much as five times when a suitable high-level language is used.18
•
•
9 Ten Pounds in a Five-Pound Sack
9 Ten Pounds in a Five-Pound Sack
The author should gaze at Noah, and . . . learn, as they did in the Ark, to crowd a great deal of matter into a very small compass.
SYDNEY SMITH. EDINBURGH REVIEW
Engraved_ from a painting by Heywood Hardy The Bettman Archive
97
98 Ten Pounds in a Five-Pound Sack
Program Space as Cost How big is it? Aside from running time, the space occupied by a program is a principal cost. This is true even for proprietary pro- grams, where the user pays the author a fee that is essentially a share of the development cost. Consider the IBM APL interactive software system. It rents for $400 per month and, when used, takes at least 160 K bytes of memory. On a Model 165, memory rents for about $12 per kilobyte per month. If the program is available full-time, one pays $400 software rent and $1920 memory rent for using the program. If one uses the APL system only four hours a day, the costs are $400 software rent and $320 memory rent per month.
One frequently hears horror expressed that a 2 M byte ma- chine may have 400 K devoted to its operating system. This is as foolish as criticizing a Boeing 747 because it costs $27 million. One must also ask, "What does it do?" What does one get in ease-of- use and in performance (via efficient system utilization) for the dollars so spent? Could the $4800 per month thus invested in memory rental have been more fruitfully spent for other hard- ware, for programmers, for application programs?
The system designer puts part of his total hardware resource into resident-program memory when he thinks it will do more for the user in that form than as adders, disks, etc. To do otherwise would be grossly irresponsible. And the result must be judged as a whole. No one can criticize a programming system for size per se and at the same time consistently advocate closer integration of hardware and software design.
Since size is such a large part of the user cost of a programming system product, the builder must set size targets, control size, and devise size-reduction techniques, just as the hardware builder sets component-count targets, controls component count, and devises count-reduction techniques. Like any cost, size itself is not bad, but unnecessary size is.
Size Control 99
Size Control
For the project manager, size control is partly a technical job and partly a managerial one. One has to study users and their applica- tions to set the sizes of the systems to be offered. Then these systems have to be subdivided, and each component given a size target. Since size-speed trade-offs come in rather big quantum jumps, setting size targets is a tricky business, requiring knowl- edge of the available trade-offs within each piece. The wise man- ager also saves himself a kitty, to be allocated as work proceeds.
In OS/360, even though all of this was done very carefully, still other lessons had to be painfully learned.
First, setting size targets for core is not enough; one has to budget all aspects of size. In most previous operating systems, systems residence had been on tape, and the long search times of tape meant that one was not tempted to use it casually to bring in program segments. OS/360 was disk-resident, like its immedi- ate predecessors, the Stretch Operating System and the 1410-7010 Disk Operating System. Its builders rejoiced in the freedom of cheap disk accesses. The initial result was disastrous to perfor- mance.
In setting core sizes for each component, we had not simulta- neously set access budgets. As anyone with 20-20 hindsight would expect, a programmer who found his program slopping over his core target broke it into overlays. This process in itself added to the total size and slowed execution down. Most seri- ously, our management control system neither measured nor caught this. Each man reported as to how much core he was using, and since he was within target, no one worried.
Fortunately, there came a day early in the effort when the OS/360 performance simulator began to work. The first result indicated deep trouble. Fortran H, on a Model 65 with drums, simulated compiling at five statements per minute! Digging-in showed that the control program modules were each making
100 Ten Pounds in a Five-Pound Sack
many, many disk accesses. Even high-frequency supervisor modules were making many trips to the well, and the result was quite analogous to page thrashing.
The first moral is clear: Set total size budgets as well as resi- dent-space budgets; set budgets on backing-store accesses as well as on sizes.
The next lesson was very similar. The space budgets were set before precise functional allocations were made to each module. As a result, any programmer in size trouble examined his code to see what he could throw over the fence into a neighbor's space. So buffers managed by the control program became part of the user's space. More seriously, so did all kinds of control blocks, and the effect was utterly compromising to the security and protection of the system.
So the second moral is also clear: Define exactly what a module must do when you specify how big it must be.
A third and deeper lesson shows through these experiences. The project was large enough and management communication poor enough to prompt many members of the team to see them- selves as contestants making brownie points, rather than as build- ers making programming products. Each suboptimized his piece to meet his targets; few stopped to think about the total effect on the customer. This breakdown in orientation and communication is a major hazard for large projects. All during implementation, the system architects must maintain continual vigilance to ensure con- tinued system integrity. Beyond this policing mechanism, how- ever, lies the matter of attitude of the implementers themselves. Fostering a total-system, user-oriented attitude may well be the most important function of the programming manager.
Space Techniques
No amount of space budgeting and control can make a program small. That requires invention and craftsmanship.
Space Techniques 101
Obviously, more function means more space, speed being held constant. So the first area of craftsmanship is in trading function for size. Here there comes an early and deep policy question. How much of that choice shall be reserved for the user? One can design a program with many optional features, each of which takes a little space. One can design a generator that will take an option Jist and tailor a program to it. But for any particular set of options, a more monolithic program would take less space. It's rather like a car; if the map light, cigarette lighter, and clock are priced together as a single option, the package will cost less than if one can choose each separately. So the designer must decide how fine-grained the user choice of options will be.
In designing a system for a range of memory sizes, another basic question arises. A limiting effect keeps the range of suitabil- ity from being made arbitrarily wide, even with fine-grained modularity of function. In the smallest system, most modules will be overlaid. A substantial part of the smallest system's resident space must be set aside as a transient or paging area into which other parts are fetched. The size of this determines the size of all modules. And breaking functions into small modules costs both performance and space. So a large system, which can afford a transient area twenty times as large, only saves accesses thereby. It still suffers in both speed and space because the module size is so small. This effect limits the maximum efficient system that can be generated from the modules of a small system.
The second area of craftsmanship is space-time trade-offs. For a given function, the more space, the faster. This is true over an amazingly large range. It is this fact that makes it feasible to set space budgets.
The manager can do two things to help his team make good space-time trade-offs. One is to ensure that they are trained in programming technique, not just left to rely on native wit and previous experience. For a new language or machine this is espe- cially important. The peculiarities of its skillful use need to be
102 Ten Pounds in a Five-Pound Sack
learned quickly and shared widely, perhaps with special prizes or praises for new techniques.
The second is to recognize that programming has a technol- ogy, and components need to be fabricated. Every project needs a notebook full of good subroutines or macros for queuing, search- ing, hashing, and sorting. For each such function the notebook should have at least two programs, the quick and the squeezed. The development of such technology is an important realization task that can be done in parallel with system architecture.
Representation Is the Essence of Programming Beyond craftsmanship lies invention, and it is here that lean, spare, fast programs are born. Almost always these are the result of stategic breakthrough rather than tactical cleverness. Some- times the strategic breakthrough will be a new algorithm, such as the Cooley-Tukey Fast Fourier Transform or the substitution of an n log n sort for an n* set of comparisons.
Much more often, strategic breakthrough will come from redoing the representation of the data or tables. This is where the heart of a program lies. Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won't usually need your flowcharts; they'll be obvious.
It is easy to multiply examples of the power of representa- tions. I recall a young man undertaking to build an elaborate console interpreter for an IBM 650. He ended up packing it onto an incredibly small amount of space by building an interpreter for the interpreter, recognizing that human interactions are slow and infrequent, but space was dear. Digitek's elegant little Fortran compiler uses a very dense, specialized representation for the com- piler code itself, so that external storage is not needed. That time lost in decoding this representation is gained back tenfold by avoiding input-output. (The exercises at the end of Chapter 6 in Brooks and Iverson, Automatic Data Processing1 include a collection of such examples, as do many of Knuth's exercises.2)
Representation Is the Essence of Programming 103
The programmer at wit's end for lack of space can often do best by disentangling himself from his code, rearing back, and contemplating his data. Representation is the essence of program- ming.
10 The Documentary Hypothesis
The hypothesis:
Amid a wash of paper, a small number of documents become the critical pivots around which every project's management revolves. These are the manager's chief personal tools.
W. Bengough, "Scene in the old Congressional Library," 1897 The Bettman Archive
107
108 The Documentary Hypothesis
The technology, the surrounding organization, and the traditions of the craft conspire to define certain items of paperwork that a project must prepare. To the new manager, fresh from operating as a craftsman himself, these seem an unmitigated nuisance, an unnecessary distraction, and a white tide that threatens to engulf him. And indeed, most of them are exactly that.
Bit by bit, however, he comes to realize that a certain small set of these documents embodies and expresses much of his manage- rial work. The preparation of each one serves as a major occasion for focusing thought and crystallizing discussions that otherwise would wander endlessly. Its maintenance becomes his surveillance and warning mechanism. The document itself serves as a check list, a status control, and a data base for his reporting.
In order to see how this should work for a software project, let us examine the specific documents useful in other contexts and see if a generalization emerges.
Documents for a Computer Product Suppose one is building a machine. What are the critical docu- ments? Objectives. This defines the need to be met and the goals, desiderata, constraints, and priorities. Specifications. This is a computer manual plus performance specifications. It is one of the first documents generated in propos- ing a new product, and the last document finished. Schedule Budget. Not merely a constraint, the budget is one of the mana- ger's most useful documents. Existence of the budget forces tech- nical decisions that otherwise would be avoided; and, more important, it forces and clarifies policy decisions. Organization chart Space allocations
Documents for a University Department 109
Estimate, forecast, prices. These three have cyclic Interlocking, which determines the success or failure of the project:
To generate a market forecast, one needs performance specifi- cations and postulated prices. The quantities from the forecast combine with component counts from the design to determine the manufacturing cost estimate, and they determine the per-unit share of development and fixed costs. These costs in turn deter- mine prices.
If the prices are below those postulated, a joyous success spiral begins. Forecasts rise, unit costs drop, and prices drop yet further.
If the prices are above those postulated, a disastrous spiral begins, and all hands must struggle to break it. Performance must be squeezed up and new applications developed to support larger forecasts. Costs must be squeezed down to yield lower estimates. The stress of this cycle is a discipline that often evokes the best work of marketer and engineer.
It can also bring about ridiculous vacillation. I recall a machine whose instruction counter popped in or out of memory every six months during a three-year development cycle. At one phase a little more performance would be wanted, so the instruction coun- ter was implemented in transistors. At the next phase cost reduc- tion was the theme, so the counter would be implemented as a memory location. On another project the best engineering man- ager I ever saw served often as a giant flywheel, his inertia damp- ing the fluctuations that came from market and management people.
Documents for a University Department In spite of the immense differences in purpose and activity, a similar number of similar documents form the critical set for the
110 The Documentary Hypothesis
chairman of a university department. Almost every decision by dean, faculty meeting, or chairman is a specification or change of these documents:
Objectives Course descriptions Degree requirements Research proposals (hence plans, when funded) Class schedule and teaching assignments Budget Space allocation Assignment of staff and graduate students
Notice that the components are very like those of the com- puter project: objectives, product specifications, time allocations, money allocations, space allocations, and people allocations. Only the pricing documents are missing; here the legislature does that task. The similarities are not accidental—the concerns of any man- agement task are what, when, how much, where, and who.
Documents for a Software Project In many software projects, people begin by holding meetings to debate structure; then they start writing programs. No matter how small the project, however, the manager is wise to begin immedi- ately to formalize at least mini-documents to serve as his data base. And he turns out to need documents much like those of other managers. What: objectives. This defines the need to be met and the goals, desiderata, constraints, and priorities. What: product specifications. This begins as a proposal and ends up as the manual and internal documentation. Speed and space specifications are a critical part.
Why Have Formal Documents? 111
When: schedule
How much: budget
Where: space allocation
Who: organization chart. This becomes intertwined with the interface specification, as Conway's Law predicts: "Organizations which design systems are constrained to produce systems which are copies of the communication structures of these organiza- tions."1 Conway goes on to point out that the organization chart will initially reflect the first system design, which is almost surely not the right one. If the system design is to be free to change, the organization must be prepared to change.
Why Have Formal Documents?
First, writing the decisions down is essential. Only when one writes do the gaps appear and the inconsistencies protrude. The act of writing turns out to require hundreds of mini-decisions, and it is the existence of these that distinguishes clear, exact policies from fuzzy
Second, the documents will communicate the decisions to oth- ers. The manager will be continually amazed that policies he took for common knowledge are totally unknown by some member of his team. Since his fundamental job is to keep everybody going in the same direction, his chief daily task will be communication, not decision-making, and his documents will immensely lighten this load.
Finally, a manager's documents give him a data base and checklist. By reviewing them periodically he sees where he is, and he sees what changes of emphasis or shifts in direction are needed.
I do not share the salesman-projected vision of the "manage- ment total-information system," wherein the executive strokes an inquiry into a computer, and a display screen flashes his answer. There are many fundamental reasons why this will never happen.
112 The Documentary Hypothesis
One reason is that only a small part—perhaps 20 percent—of the executive's time is spent on tasks where he needs information from outside his head. The rest is communication: hearing, report- ing, teaching, exhorting, counseling, encouraging. But for the frac- tion that is data-based, the handful of critical documents are vital, and they will meet almost all needs.
The task of the manager is to develop a plan and then to realize it. But only the written plan is precise and communicable. Such a plan consists of documents on what, when, how much, where, and who. This small set of critical documents encapsulates much of the manager's work. If their comprehensive and critical nature is rec- ognized in the beginning, the manager can approach them as friendly tools rather than annoying busywork. He will set his direction much more crisply and quickly by doing so.
11 Plan toThrow One Away
11 Plan toThrow One Away
There is nothing in this world constant but inconstancy.
SWIFT
It is common sense to take a method and try it. If it fails, admit it frankly and try another. But above all try
FRANKLIN D. ROOSEVELT
Collapse of the aerodynamically misdesigned Tacoma Narrows Bridge, 1940 UPI Photo/The Bettman Archive
115
116 Plan to Throw One Away
Pilot Plants and Scaling Up Chemical engineers learned long ago that a process that works in the laboratory cannot be implemented in a factory in only one step. An intermediate step called the pilot plant is necessary to give experience in scaling quantities up and in operating in nonprotec- tive environments. For example, a laboratory process for desalting water will be tested in a pilot plant of 10,000 gallon/day capacity before being used for a 2,000,000 gallon/day community water system.
Programming system builders have also been exposed to this lesson, but it seems to have not yet been learned. Project after project designs a set of algorithms and then plunges into construc- tion of customer-deliverable software on a schedule that demands delivery of the first thing built.
In most projects, the first system built is barely usable. It may be too slow, too big, awkward to use, or all three. There is no alternative but to start again, smarting but smarter, and build a redesigned version in which these problems are solved. The dis- card and redesign may be done in one lump, or it may be done piece-by-piece. But all large-system experience shows that it will be done.2 Where a new system concept or new technology is used, one has to build a system to throw away, for even the best plan- ning is not so omniscient as to get it right the first time.
The management question, therefore, is not whether to build a pilot system and throw it away. You will do that. The only question is whether to plan in advance to build a throwaway, or to promise to deliver the throwaway to customers. Seen this way, the answer is much clearer. Delivering that throwaway to custom- ers buys time, but it does so only at the cost of agony for the user, distraction for the builders while they do the redesign, and a bad reputation for the product that the best redesign will find hard to live down.
Hence plan to throw one away; you will, anyhow.
Plan the System for Change 117
The Only Constancy Is Change Itself
Once one recognizes that a pilot system must be built and dis- carded, and that a redesign with changed ideas is inevitable, it becomes useful to face the whole phenomenon of change. The first step is to accept the fact of change as a way of life, rather than an untoward and annoying exception. Cosgrove has perceptively pointed out that the programmer delivers satisfaction of a user need rather than any tangible product. And both the actual need and the user's perception of that need will change as programs are built, tested, and used.3
Of course this is also true of the needs met by hardware products, whether new cars or new computers. But the very exis- tence of a tangible object serves to contain and quantize user demand for changes. Both the tractability and the invisibility of the software product expose its builders to perpetual changes in requirements.
Far be it from me to suggest that all changes in customer objectives and requirements must, can, or should be incorporated in the design. Clearly a threshold has to be established, and it must get higher and higher as development proceeds, or no product ever appears.
Nevertheless, some changes in objectives are inevitable, and it is better to be prepared for them than to assume that they won't come. Not only are changes in objective inevitable, changes in development strategy and technique are also inevitable. The throw-one-away concept is itself just an acceptance of the fact that as one learns, he changes the design.4
Plan the System for Change
The ways of designing a system for such change are well known and widely discussed in the literature—perhaps more widely dis-
118 Plan to Throw One Away
cussed than practiced. They include careful modularization, ex- tensive subroutining, precise and complete definition of intermodule interfaces, and complete documentation of these. Less obviously one wants standard calling sequences and table- driven techniques used wherever possible.
Most important is the use of a high-level language and self- documenting techniques so as to reduce errors induced by changes. Using compile-time operations to incorporate standard declarations helps powerfully in making changes.
Quantization of change is an essential technique. Every prod- uct should have numbered versions, and each version must have its own schedule and a freeze date, after which changes go into the next version.
Plan the Organization for Change Cosgrove advocates treating all plans, milestones, and schedules as tentative, so as to facilitate change. This goes much too far—the common failing of programming groups today is too little manage- ment control, not too much.
Nevertheless, he offers a great insight. He observes that the reluctance to document designs is not due merely to laziness or time pressure. Instead it comes from the designer's reluctance to commit himself to the defense of decisions which he knows to be tentative. "By documenting a design, the designer exposes himself to the criticisms of everyone, and he must be able to defend everything he writes. If the organizational structure is threatening in any way, nothing is going to be documented until it is com- pletely defensible."
Structuring an organization for change is much harder than designing a system for change. Each man must be assigned to jobs that broaden him, so that the whole force is technically flexible. On a large project the manager needs to keep two or three top programmers as a technical cavalry that can gallop to the rescue wherever the battle is thickest.
Plan the Organization for Change 119
Management structures also need to be changed as the system changes. This means that the boss must give a great deal of atten- tion to keeping his managers and his technical people as inter- changeable as their talents allow.
The barriers are sociological, and they must be fought with constant vigilance. First, managers themselves often think of se- nior people as "too valuable" to use for actual programming. Next, management jobs carry higher prestige. To overcome this problem some laboratories, such as Bell Labs, abolish all job titles. Each professional employee is a "member of the technical staff." Oth- ers, like IBM, maintain a dual ladder of advancement, as Fig. 11.1 shows. The corresponding rungs are in theory equivalent.
Senior Associate Programmer
Fig. 11.1 IBM dual ladder of advancement
It is easy to establish corresponding salary scales for rungs. It is much harder to give them corresponding prestige. Offices have to be of equal size and appointment. Secretarial and other support services must correspond. A reassignment from the technical lad- der to a corresponding level on the managerial one should never be accompanied by a raise, and it should be announced always as
122 Plan to Throw One Away
The fundamental problem with program maintenance is that fixing a defect has a substantial (20-50 percent) chance of intro- ducing another. So the whole process is two steps forward and one step back.
Why aren't defects fixed more cleanly? First, even a subtle defect shows itself as a local failure of some kind. In fact it often has system-wide ramifications, usually nonobvious. Any attempt to fix it with minimum effort will repair the local and obvious, but unless the structure is pure or the documentation very fine, the far-reaching effects of the repair will be overlooked. Second, the repairer is usually not the man who wrote the code, and often he is a junior programmer or trainee.
As a consequence of the introduction of new bugs, program maintenance requires far more system testing per statement writ- ten than any other programming. Theoretically, after each fix one must run the entire bank of test cases previously run against the system, to ensure that it has not been damaged in an obscure way. In practice such regression testing must indeed approximate this theoretical ideal, and it is very costly.
Clearly, methods of designing programs so as to eliminate or at least illuminate side effects can have an immense payoff in maintenance costs. So can methods of implementing designs with fewer people, fewer interfaces, and hence fewer bugs.
One Step Forward and One Step Back
Lehman and Belady have studied the history of successive releases in a large operating system.8 They find that the total number of modules increases linearly with release number, but that the num- ber of modules affected increases exponentially with release num- ber. All repairs tend to destroy the structure, to increase the entropy and disorder of the system. Less and less effort is spent on fixing original design flaws; more and more is spent on fixing flaws introduced by earlier fixes. As time passes, the system becomes less and less well-ordered. Sooner or later the fixing
One Step Forward and One Step Back 123
ceases to gain any ground. Each forward step is matched by a backward one. Although in principle usable forever, the system has worn out as a base for progress. Furthermore, machines change, configurations change, and user requirements change, so the system is not in fact usable forever. A brand-new, from-the- ground-up redesign is necessary.
And so from a statistical mechanical model, Belady and Leh- man arrive for programming-systems at a more general conclusion supported by the experience of all the earth. "Things are always at their best in the beginning," said Pascal. C. S. Lewis has stated it more perceptively:
That is the key to history. Terrific energy is expended—civilizations are built up—excellent institutions devised; but each time something goes wrong. Some fatal flaw always brings the selfish and cruel people to the top, and then it all slides back into misery and ruin. In fact, the machine conks. It seems to start up all right and runs a few yards, and then it breaks down."1
Systems program building is an entropy-decreasing process, hence inherently metastable. Program maintenance is an entropy- increasing process, and even its most skillful execution only delays the subsidence of the system into unfixable obsolescence.
12 Sharp Tools
12 Sharp Tools
A good workman is known by his tools.
PROVERB
A. Pisano, "Lo Scultore," from the Campanile di Santa Maria del Fiore, Florence, c. 1335 Scala/Art Resource, NY
127
128 Sharp Tools
Even at this late date, many programming projects are still oper- ated like machine shops so far as tools are concerned. Each master mechanic has his own personal set, collected over a lifetime and carefully locked and guarded—the visible evidences of personal skills. Just so, the programmer keeps little editors, sorts, binary dumps, disk space utilities, etc., stashed away in his file.
Such an approach, however, is foolish for a programming project. First, the essential problem is communication, and indi- vidualized tools hamper rather than aid communication. Second, the technology changes when one changes machines or working language, so tool lifetime is short. Finally, it is obviously much more efficient to have common development and maintenance of the general-purpose programming tools.
General-purpose tools are not enough, however. Both special- ized needs and personal preferences dictate the need for special- ized tools as well; so in discussing programming teams I have postulated one toolmaker per team. This man masters all the com- mon tools and is able to instruct his client-boss in their use. He also builds the specialized tools his boss needs.
The manager of a project, then, needs to establish a philoso- phy and set aside resources for the building of common tools. At the same time he must recognize the need for specialized tools, and not begrudge his working teams their own tool-building. This temptation is insidious. One feels that if all those scattered tool builders were gathered in to augment the common tool team, greater efficiency would result. But it is not so.
What are the tools about which the manager must philoso- phize, plan, and organize? First, a computer facility. This requires machines, and a scheduling philosophy must be adopted. It re- quires an operating system, and service philosophies must be estab- lished. It requires language, and a language policy must be laid down. Then there are utilities, -debugging aids, test-case generators, and a text-processing system to handle documentation. Let us look at these one by one.1
Target Machines 129
Target Machines Machine support is usefully divided into the target machine and the vehicle machines. The target machine is the one for which software is being written, and on which it must ultimately be tested. The vehicle machines are those that provide the services used in build- ing the system. If one is building a new operating system for an old machine, it may serve not only as the target, but as the vehicle as well.
What kind of target facility? Teams building new supervisors or other system-heart software will of course need machines of their own. Such systems will need operators and a system programmer or two who keeps the standard support on the machine current and serviceable.
If a separate machine is needed, it is a rather peculiar thing— it need not be fast, but it needs at least a million bytes of main storage, a hundred million bytes of on-line disk, and terminals. Only alphanumeric terminals are needed, but they must go much faster than the 15 characters per second that characterizes type- writers. A large memory adds greatly to productivity by allowing overlaying and size trimming to be done after functional testing.
The debugging machine, or its software, also needs to be in- strumented, so that counts and measurements of all kinds of pro- gram parameters can be automatically made during debugging. Memory-use patterns, for instance, are powerful diagnostics of the causes of weird logical behavior or unexpectedly slow perfor- mance.
Scheduling. When the target machine is rtew, as when its first operating system is being built, machine time is scarce, and sched- uling it is a major problem. The requirement for target machine time has a peculiar growth curve. In OS/360 development we had good System/360 simulators and other vehicles. From previous experience we projected how many hours of S/360 time we would need, and began to acquire early machines from factory produc-
130 Sharp Tools
tion. But they sat idle, month after month. Then all at once all 16 systems were fully loaded, and rationing was the problem. The utilization looked something like Fig. 12.1. Everyone began to debug his first components at the same time, and thereafter most of the team was constantly debugging something.
Model 40 hours per month
Jan '65 '66
Fig. 12.1 Growth in use of target machines
We centralized all our machines and tape library and set up a professional and experienced machine-room team to run them. To maximize scarce S/360 time, we ran all debugging runs in batch on whichever system was free and appropriate. We tried for four shots per day (two-and-one-half-hour turnaround) and de- manded four-hour turnaround. An auxiliary 1401 with terminals was used to schedule runs, to keep track of the thousands of jobs, and to monitor turnaround time.
But all that organization was quite overdone. After a few months of slow turnaround, mutual recriminations, and other agony, we went to allocating machine time in substantial blocks.
Vehicle Machines and Data Services 131
The whole fifteen-man sort team, for example, would be given a system for a four-to-six-hour block. It was up to them to schedule themselves on it. If it sat idle, no outsider could use it.
That, it develops, was a better way to allocate and schedule. Although machine utilization may have been a little lower (and often it wasn't), productivity was way up. For each man on such a team, ten shots in a six-hour block are far more productive than ten shots spaced three hours apart, because sustained concentra- tion reduces thinking time. After such a sprint, a team usually needed a day or two to catch up on the paperwork before asking for another block. Often as few as three programmers can fruit- fully share and subschedule a block of time. This seems to be the best way to use a target machine when debugging a new operating system.
It has always been so in practice, though never in theory. System debugging has always been a graveyard-shift occupation, like astronomy. Twenty years ago, on the 701,1 was initiated into the productive informality of the predawn hours, when all the machine-room bosses are fast asleep at home, and the operators are disinclined to be sticklers for rules. Three machine generations have passed; technologies have changed totally; operating systems have arisen; and yet this preferred method of working hasn't changed. It endures because it is most productive. The time has come to recognize its productivity and embrace the fruitful prac- tice openly.
Vehicle Machines and Data Services
Simulators. If the target computer is new, one needs a logical simulator for it. This gives a debugging vehicle long before the real target exists. Equally important, it gives access to a dependable debugging vehicle even after one has a target machine available.
Dependable is not the same as accurate. The simulator will surely fail in some respect to be a faithful and accurate implemen-
132 Sharp Tools
tation of the new machine's architecture. But it will be the same implementation from one day to the next, and the new hardware will not.
We are accustomed nowadays to having computer hardware work correctly almost all the time. Unless an application program- mer sees a system behaving inconsistently from run to identical run, he is well advised to look for bugs in his code rather than in his engine.
This experience, however, is bad training for the programming of support for a new machine. Lab-built, preproduction, or early hardware does not work as defined, does not work reliably, and does not stay the same from day to day. As bugs are found, engineering changes are made in all machine copies, including those of the programming group. This shifting base is bad enough. Hardware failures, usually intermittent, are worse. The uncer- tainty is worst of all, for it robs one of incentive to dig diligently in his code for a bug—it may not be there at all. So a dependable simulator on a well-aged vehicle retains its usefulness far longer than one would expect.
Compiler and assembler vehicles. For the same reasons, one wants compilers and assemblers that run on dependable vehicles but compile object code for the target system. This can then start being debugged on the simulator.
With high-level language programming, one can do much of the debugging by compiling for and testing object code on the vehicle machine before beginning to test target-machine code at all. This gives the efficiency of direct execution, rather than that of simulation, combined with the dependability of the stable ma- chine.
Program libraries and accounting. A very successful and im- portant use of a vehicle machine in the OS/360 development effort was for the maintenance of program libraries. A system developed under the leadership of W. R. Crowley had two 7010's connected, sharing a large disk data bank. The 7010's also provided an S/360
Vehicle Machines and Data Services 133
assembler. All the code tested or under test was kept in this li- brary, both source code and assembled load modules. The library was in fact divided into sublibraries with different access rules.
First, each group or programmer had an area where he kept copies of his programs, his test cases, and the scaffolding he needed for component testing. In this playpen area there were no restrictions on what a man could do with his own programs; they were his.
When a man had his component ready for integration into a larger piece, he passed a copy over to the manager of that larger system, who put this copy into a system integration Now the original programmer could not change it, except by permission of the integration manager. As the system came together, the latter would proceed with all sorts of system tests, identifying bugs and getting fixes.
From time to time a system version would be ready for wider use. Then it would be promoted to the current version sublibrary. This copy was sacrosanct, touched only to fix crippling bugs. It was available for use in integration and testing of all new module versions. A program directory on the 7010 kept track of each version of each module, its status, its whereabouts, and its changes.
Two notions are important here. The first is control, the idea of program copies belonging to managers who alone can authorize their change. The"second is that of formal separation and progression from the playpen, to integration, to release.
In my opinion this was one of the best-done things in the OS/360 effort. It is a piece of management technology that seems to have been independently developed on several massive pro- gramming projects including those at Bell Labs, ICL, and Cam- bridge University.8 It is applicable to documentation as well as to programs. It is an indispensable technology.
Program tools. As new debugging techniques appear, the old ones diminish but do not vanish. Thus one needs dumps, source- file editors, snapshot dumps, even traces.
134 Sharp Tools
Likewise one needs a full set of utilities for putting decks on disks, making tape copies, printing files, changing catalogs. If one commissions a project toolmaker early in the process, these can be done once and can be ready by time they are needed. Documentation system. Among all tools, the one that saves the most labor may well be a computerized text-editing system, oper- ating on a dependable vehicle. We had a very handy one, devised by J. W. Franklin. Without it I expect OS/360 manuals would have been far later and more cryptic. There are those who would argue that the OS/360 six-foot shelf of manuals represents verbal diarr- hea, that the very voluminosity introduces a new kind of incom- prehensibility. And there is some truth in that.
But I respond in two ways. First, the OS/360 documentation is overwhelming in bulk, but the reading plan is carefully laid out; if one uses it selectively, he can ignore most of the bulk most of the time. One must consider the OS/360 documentation as a li- brary or an encyclopedia, not a set of mandatory texts.
Second, this is far preferable to the severe underdocumenta- tion that characterizes most programming systems. I will quickly agree, however, that the writing could be vastly improved in some places, and that the result of better writing would be reduced bulk. Some parts (e.g., Concepts and Facilities) are very well-written now. Performance simulator. Better have one. Build it outside-in, as we will discuss in the next chapter. Use the same top-down design for the performance simulator, the logical simulator, and the prod- uct. Start it very early. Listen to it when it speaks.
High-Level Language and Interactive Programming The most important two tools for system programming today are two that were not used in OS/360 development almost a decade ago. They are still not widely used, but all evidence points to their power and applicability. They are (1) high-level language and (2) interactive programming. I am convinced that only inertia and
High-Level Language and Interactive Programming 135
sloth prevent the universal adoption of these tools; the technical difficulties are no longer valid excuses.
High-level language. The chief reasons for using a high-level language are productivity and debugging speed. We have dis- cussed productivity earlier (Chapter 8). There is not a lot of nu- merical evidence, but what there is suggests improvement by integral factors, not just incremental percentages.
The debugging improvement comes from the fact that there are fewer bugs, and they are easier to find. There are fewer because one avoids an entire level of exposure to error, a level on which one makes not only syntactic errors but semantic ones, such as misusing registers. The bugs are easier to find because the compiler diagnostics help find them and, more important, because it is very easy to insert debugging snapshots.
For me, these productivity and debugging reasons are over- whelming. I cannot easily conceive of a programming system I would build in assembly language.
Well, what about the classical objections to such a tool? There are three: It doesn't let me do what I want. The object code is too big. The object code is too slow.
As to function, I believe the objection is no longer valid. All testimony indicates that one can do what he needs to do, but that it takes work to find out how, and one may occasionally need unlovely artifices.3'4
As to space, the new optimizing compilers are beginning to be very satisfactory, and this improvement will continue.
As to speed, optimizing compilers now produce some code that is faster than most programmer's handwritten code, Further- more, one can usually solve speed problems by replacing from one to five percent of a compiler-generated program by handwritten substitute after the former is fully debugged.5
What high-level language should one use for system program- ming? The only reasonable candidate today is PL/I.8 It has a very
136 Sharp Tools
full set of functions; it is matched to operating system environ- ments; and a variety of compilers are available, some interactive, some fast, some very diagnostic, and some producing highly opti- mized code. I myself find it faster to work out algorithms in APL; then I translate these to PL/I for matching to the system environ- ment.
Interactive programming. One of the justifications for MIT's Multics project was its usefulness for building programming sys- tems. Multics (and following it, IBM's TSS) differs in concept from other interactive computing systems in exactly those respects nec- essary for systems programming: many levels of sharing and pro- tection for data and programs, extensive library management, and facilities for cooperative work among terminal users. I am con- vinced that interactive systems will never displace batch systems for many applications. But I think the Multics team has made its most convincing case in the system-programming application.
There is not yet much evidence available on the true fruitful- ness of such apparently powerful tools. There is a widespread recognition that debugging is the hard and slow part of system programming, and slow turnaround is the bane of debugging. So the logic of interactive programming seems inexorable.7
Fig. 12.2 Comparative productivity under batch and conversational pro- gramming
High-Level Language and Interactive Programming 137
Further, we hear good testimonies from many who have built little systems or parts of systems in this way. The only numbers I have seen for effects on programming of large systems were reported by John Harr of Bell Labs. They are shown in Fig. 12.2. These numbers are for writing, assembling, and debugging pro- grams. The first program is mostly control program; the other three are language translators, editors, and such. Hair's data suggest that an interactive facility at least doubles productivity in system pro- gramming.8
The effective use of most interactive tools requires that the work be done in a high-level language, for teletype and typewriter terminals cannot be used to debug by dumping memory. With a high-level language, source can be easily edited and selective printouts easily done. Together they make a pair of sharp tools indeed.