Home :: Books :: Computers & Internet  

Arts & Photography
Audio CDs
Audiocassettes
Biographies & Memoirs
Business & Investing
Children's Books
Christianity
Comics & Graphic Novels
Computers & Internet

Cooking, Food & Wine
Entertainment
Gay & Lesbian
Health, Mind & Body
History
Home & Garden
Horror
Literature & Fiction
Mystery & Thrillers
Nonfiction
Outdoors & Nature
Parenting & Families
Professional & Technical
Reference
Religion & Spirituality
Romance
Science
Science Fiction & Fantasy
Sports
Teens
Travel
Women's Fiction
Persuasive Programming

Persuasive Programming

List Price: $35.00
Your Price: $35.00
Product Info Reviews

<< 1 >>

Rating: 3 stars
Summary: Uses only a small C++ subset; Marred by careless errors
Review: As a manager of other programmers I am looking for books to recommend that will teach improvements of style. This book has a worthy goal of teaching a more rigorous approach to documenting one's reasoning with assertive comments.

Many of the introductory examples are small, tedious, and unrealistic, but perhaps unavoidably so in such basic pedagogy, so I don't hold that as a fault. There are examples of reasoning from intuitively written code to assertive comments, and vice-versa from assertions as specifications to code: this is valuable. The programming-as-contract idea is mentioned for functions: this is a very important idea for keeping complexity of large systems comprehensible.

However, the numerous erroneously stated or ambiguously underparenthesized comments, uncompilable C++ solecisms (e.g. p. 143), and outright programming errors, combined with a narrow view of the language that emphasizes the imperative side but says too little about the data-hiding side (another great aid to comprehensibility of large systems), cause me to withhold recommendation. Perhaps the forthcoming Java-language version of this book may remedy some of these errors, but I get the impression that these authors give modern languages a very outdated treatment as just Pascal pronounced with a funny accent.

The previous reviewer "engineersoftware" says this book lacks an instructive example of buggy code that could be set right by application of these reasoning techniques. I beg to differ: the authors, in their haste, inadvertently supply such code, leaving the alert reader to detect and apply this remediation. On pp. 138-139 there is an example of insertion into the middle of an array, where they reason from assertions to code, claiming that the code almost writes itself. But what they present as final code makes the error of copying the old value at the insertion point over all following items, destroying the old data! If the authors practiced their own preaching more carefully, they, and the reader, could have profited here.

Equally glaring is their linked-list version of the same problem on p. 205, which takes the head pointer by value instead of reference and thus leaks memory in case of insertion at the head.

These are enough strikes against such a short book.


Rating: 3 stars
Summary: Techniques for illustrating program correctness
Review: Persuasive programming steps in the direction of formal methods while not requiring a proof. These techniques are presented as a solution to "programming by approximation" which can afflict students. The primary technique presented is adding assertions, preconditions, postconditions, and invariants to existing programs as embedded comments. A precise postcondition for a complete program can be deduced using the persuasive programming process. The derived postcondition, representing the inherent semantics of the program, can be compared to the original postcondition, which represents the intended semantics. If they are the same then confidence in the program's correctness has been established.

Chapter 14 presents a full program with the persuasive programming style. Chapters 3-13 present the methods of asserting building blocks, simple statements, selection, repetition, and abstraction. Deducing code from assertions is briefly covered as an advanced technique. The appendix contains an excellent description of Boolean logic. The authors provided minimal coverage of asserting C++ classes, did not present a C++ class in the persuasive style, and did not present any examples with bugs where the expected postcondition and persuasively derived postcondition don't match. In my opinion, persuasive programs are difficult to read. These persuasive assertions can repeat information that is already evident from the code. One alternative is to use persuasive programming as a code review exercise and then trim down the assertion comments to their minimal form.


<< 1 >>

© 2004, ReviewFocus or its affiliates