جزییات کتاب
from PREFACE to the First EditionGood programming cannot be taught by preaching generalities. The way tolearn to program well is by seeing, over and over, how real programs can beimproved by the application of a few principles of good practice and a little commonsense. Practice in critical reading leads to skill in rewriting, which in turn leads tobetter writing.This book is a study of a large number of “ real” programs, each of which pro¬vides one or more lessons in style. We discuss the shortcomings of each example,rewrite it in a better way, then draw a general rule from the specific case. Theapproach is pragmatic and down-to-earth; we are more interested in improvingcurrent programming practice than in setting up an elaborate theory of how pro¬gramming should be done. Consequently, this book can be used as a supplement ina programming course at any level, or as a refresher for experienced programmers.The examples we give are all in Fortran and PL/I, since these languages arewidely used and are sufficiently similar that a reading knowledge of one means thatthe other can also be read well enough. (We avoid complicated constructions ineither language and explain unavoidable idioms as we encounter them.) The princi¬ples of style, however, are applicable in all languages, including assembly codes.Our aim is to teach the elements of good style in a small space, so we concen¬trate on essentials. Rules are laid down throughout the text to emphasize the les¬sons learned. Each chapter ends with a summary and a set of “ points to ponder,”which provide exercises and a chance to investigate topics not fully covered in thetext itself. Finally we collect our rules in one place for handy reference.from PREFACE to the Second EditionThe practice of computer programming has changed since The Elements of Pro¬gramming Style first appeared. Programming style has become a legitimate topic ofdiscussion. After years of producing “ write-only code,” students, teachers, andcomputing professionals now recognize the importance of readable programs. Therehas also been a widespread acceptance of structured programming as a valuable cod ¬ing discipline, and a growing recognition that program design is an important phase,too often neglected in the past.We have revised The Elements of Programming Style extensively to reflect thesechanges. The first edition avoided any direct mention of the term “ structured pro¬gramming,” to steer well clear of the religious debates then prevalent. Now that thefervor has subsided, we feel comfortable in discussing structured coding techniquesthat actually work well in practice.The second edition devotes a whole new chapter to program structure, showinghow top-down design can lead to better organized programs. Design issues are dis¬cussed throughout the text. We have made considerable use of pseudo-code as aprogram development tool.We have also rewritten many of the examples presented in the first edition, toreflect (we hope) a greater understanding of how to program well. There are newexamples as well, including several from the first edition which now serve as modelsof how not to do things. New exercises have been added. Finally, we haveextended and generalized our rules of good style.