Journal Article10.1145/356635.356641
Programming Style: Examples and Counterexamples
Brian W. Kernighan,P. J. Plauger +1 more
36
TL;DR: Kernighan and Plauger as discussed by the authors presented a summary of the Elements of Programming Style (e.g., expressing individual statements so that they read clearly, structure (organizing larger blocks of code so that the program "hangs together"), robustness (writing code that can defend itself against bad data from the outside world), and efficiency.
read more
Abstract: The following paper by Kernighan and Plauger is one of three chosen from the December 1974 issue of ACM Computing Surveys. It's considerably shorter and less theoretical than the companion papers by Knuth [Paper 20] and Wirth [Paper 13]; indeed, it's less theoretical and more down to earth than most of the papers in this book! For that reason, many readers will view it as a breath of fresh air, and will rejoice at the presence of real FORTRAN examples and real PL/I examples.
The paper is largely excerpted from Kernighan and Plauger's first book, The Elements of Programming Style, providing a nice, concise, 21-page summary that you can read in less than an hour. One of the themes of this paper is that structured programming is, in a sense, a secondary issue; the primary concern of programming, according to the authors, is style. The elements of programming style consist of such things as expression (organizing individual statements so that they read clearly), structure (organizing larger blocks of code so that the program "hangs together"), robustness (writing code that can "defend itself against bad data from the outside world"), and, finally, efficiency.
As I've said, there are examples to illustrate these elements of programming style --- examples that are "real," from the kind of programs that one would expect to find in an actual scientific or business-oriented EDP shop. Indeed, the examples are real, but in a very special sense: Kernighan and Plauger have taken all of their examples verbatim from other programming textbooks. Although the examples don't include any COBOL or assembler code, the enterprising reader can generalize from the FORTRAN examples so as to apply the lessons to his own work.
There is one other theme in this paper, one that I think is particularly important in these days of elegant programming languages like ALGOL and PASCAL. Rather than trying to restate Kernighan and Plauger's point, let me quote them directly:
" . . . many people try to excuse badly written programs by blaming inadequacies of the language that must be used. We have seen repeatedly that even Fortran can be tamed with proper discipline. The presence of bad features is not an invitation to use them, nor is .the absence of good features an excuse to avoid simulating them as cleanly as possible. Good languages are nice, but not vital."
FORTRAN and COBOL programmers, take heed!
read more
Chat with Paper
AI Agents for this Paper
Find similar papers on Google Scholar, PubMed and Arxiv
Write a critical review of this paper
Analyze citations of this paper to find unaddressed research gaps
Citations
Graph grammars and global program data flow analysis
R. Farrow,Ken Kennedy,L. Zucconi +2 more
- 25 Oct 1976
TL;DR: If a given graph is generated by the grammar, repeated application of the reductions will result in a single node regardless of the order in which they are applied, which gives rise to an algorithm that parses a given program flow graph in time linear in the size of the graph.
62
Debugging effort estimation using software metrics
TL;DR: Some of the characteristics shown to correlate significantly with debug time are GOTO usage, structuring of the IF-ELSE construct, level 88 item usage, paragraph invocation pattern, and data name length.
38
Applications of a graph grammar for program control flow analysis
Ken Kennedy,Linda Zucconi +1 more
- 01 Jan 1977
TL;DR: This paper studies the applicability of a grammatical approach to describing the set of control flow graphs which arise from "good" programs in the sense proposed by many programming practitioners and addresses several new questions.
30
Ifs and thens: Is nesting just for the birds?
TL;DR: Experiment suggests that indeed the unnested form is only slightly better in the best conditions and is much worse in unsuitable conditions, and that a much more important principle seems to be to provide perceptual cues that will make program structure manifest rather than latent.
25
Nested IF-THEN-ELSE constructs in end-user computing: personality and aptitude as predictors of programming ability
Houn-Gee Chen,Robert P. Vecchio +1 more
TL;DR: A model is proposed and empirical findings suggest that performance in programming tasks can be partially accounted for by a consideration of personality and aptitude constructs.
15
References
Recursive functions of symbolic expressions and their computation by machine, Part I
TL;DR: A programming system called LISP (for LISt Processor) developed for the IBM 704 computer by the Artificial Intelligence group at M.I.T. was designed to facilitate experiments with a proposed system called the Advice Taker, whereby a machine could be instructed to handle declarative as well as imperative sentences and could exhibit "common sense" in carrying out its instructions.
•Book
Structured Programming
O. J. Dahl,Edsger W. Dijkstra,C. A. R. Hoare +2 more
- 01 Jan 1972
TL;DR: The first monograph has suggested that in analysing a problem and groping towards a solution, a programmer should take advantage of abstract concepts such as sets, sequences, and mappings; and judiciously postpone decisions on representation until he is constructing the more detailed code of the program.
1.2K
Recursive Functions of Symbolic Expressions and their Computation by Machine
John J. McCarthy
- 01 Mar 1959
TL;DR: A programming system called LISP (for LISt Processor) has been developed for the IBM 704 computer by the Artificial Intelligence group at M.I.T. as mentioned in this paper, where a machine could be instructed to handle declarative as well as imperative sentences and could exhibit "common sense" in carrying out its instructions.
1.1K
Letters to the editor: go to statement considered harmful
TL;DR: My considerations are that, although the programmer's activity ends when he has constructed a correct program, the process taking place under control of his program is the true subject matter of his activity, and that his intellectual powers are rather geared to master static relations and his powers to visualize processes evolving in time are relatively poorly developed.
1K
•Book
The humble programmer
Edsger W. Dijkstra
- 01 Jan 1979
TL;DR: As a result of a long sequence of coincidences I entered the programming profession officially on the first spring morning of 1952, and as far as I have been able to trace, I was the first Dutchman to do so in my country.
729
Related Papers (5)
O. J. Dahl,Edsger W. Dijkstra,C. A. R. Hoare +2 more
- 01 Jan 1972
Scott W. Ambler,Alan Vermeulen,Greg Bumgardner +2 more
- 01 Jan 2000