| |||||||||||||||
Modularize. Use subroutines.
This book addresses programming style, with more emphasis on programming-in-the-large, and is restricted to the domain of C++ programs. It is written for the programmer who has learned the mechanics of C++, but is experiencing difficulty in applying the language features - particularly the object-oriented features - to programming problems. Though the discussion is limited to C++, many of the observations about programming are true of other languages. I leave the treatment of language-independent style in-the-large to more ambitious authors.
I have adopted Kernighan and Plauger's method of distilling rules of programming style from the critical reading and rewriting of programs. All the programs used here are taken from textbooks, magazine articles and tutorials on C++ programming. None was created artificially for this work. Some programs are presented exactly as originally published, while others have been altered cosmetically. The alterations range from the correction of in-the-small bugs, which would only distract, to structure-preserving transformations of programs for which copyright was not obtained.
The spirit in which to approach the material is that of an "egoless" code review. We all learn by reading and reviewing each other's programs. The material is not a criticism of individual programmers - it seeks only to differentiate between good and bad programs. No doubt the programs that are presented here as "better" versions have their own shortcomings. The reader is encouraged to examine these programs critically, looking for further improvements in programming style.
0201563657P04062001
C++ supports programming-in-the-large, allowing relationships between different parts of a program to be expressed. The scope of C++ programming style therefore goes beyond traditional in-the-small issues which relate to the details of line-by-line coding. This book examines the use of the in-the-large language features of C++, which sometimes confuse even experienced programmers. The author demonstrates that unwarranted use of the more powerful language features may lead to cluttered programs which are harder to comprehend and sometimes less efficient than more straightforward alternatives. Cargill rewrites several programs, using techniques that range from improving consistency to removing redundant inheritance. The presentation simulates a code review, in which readers may independently evaluate and criticize alternative approaches to programming problems, and then compare their analyses with those of the author.
Design and coding style rules are distilled from the examples. Understanding and following these rules will help professional programmers design and write better C++ programs.
A chapter is devoted to each of the following topics:
0201563657B04062001
Product Details
Would you like to update product info or give feedback on images?
|
|
Share your thoughts with other customers:
|
||||||||||||||||||||||
|
Most Helpful Customer Reviews
10 of 10 people found the following review helpful:
4.0 out of 5 stars
A Wonderful Surprise,
By A Customer
This review is from: C++ Programming Style (Paperback)
I've understood the syntax of C++ and the basic ideas of OO for some time now, but I have not used these tools professionally because OO design is so hard, and I have little experience. I have often wished I had a book that would help me evaluate an OO design, and determine what its weaknesses were. This is that book.I especially like the format; the author presents an OO class and then step by step tears it down and shows you what's broken about it. For each problem and its corresponding solution, the author presents a rule of thumb that can help you avoid similar design mistakes in the future. Some of the material is specific to C++, but a lot of it is applicable to any OO language.
12 of 13 people found the following review helpful:
4.0 out of 5 stars
Cargill's classic book on quality C++,
By
Amazon Verified Purchase(What's this?)
This review is from: C++ Programming Style (Paperback)
It is unfair to judge this book from the perspective of the "average" C++ programmer. Tom goes at least three steps further to treat programmers/readers as intelligent beings of the same species who already have the fundamental programming language "mechanics" skills. The reviewer who spewed forth about "coding style" really doesn't "get it." The whole issue of "where you put your braces" and naming conventions isn't what Tom or Tom's book is about. He already assumes that if you're programming C++ you have some idea of when you're going to press enter on the keyboard. (To make whitespace, in case you were wondering...)The inferior thinking that confounds the world of programming is that C++ is an easy language to master. Very few programmers have much hope of aspiring to learn even 80% of the language and use it effectively. Thinking otherwise is like saying that everyone who wants to run a foot race can be Jessie Owens. Tom starts by treating readers as programming peers. That alone is an incredible benefit anytime programming is being done. Prima donas and those guys who always seem too busy to provide their "public interface" are the ones to avoid in learning anything of use regarding C++. I pick up Tom's book every couple of months and browse it. His noted "brevity" is like a good RPG that gives subtle hints that incite thinking for yourself without following what many other books do by drawing a roadmap to one solution that worked for this one situation but may never again apply to anything useful. In my opinion, Tom's "lessons" are appropriately concise. If you haven't read Tom's book, buy it, read it...if you're serious about your C++ skills. There is a *good* reason why Scott Meyers recommends Tom's book. It is something of a unique and interesting perspective on C++, which is really all that any of us can hope to give back to the language. The book is an interesting, insightful perspective that has pragmatic commentary that will help you be a better C++ programmer. At the last (ever?) C++ World conference in December of 1999, a discussion of which books to read evolved out of some other spew. Cargill's book came up as necessary reading, as it always seems to, for the simple fact that it comes from a respected industry professional with an uncany ability to boil out the meat of the topic without overcooking the stew. C++ is, at least, also an art form. Tom's ability with the art of C++ is inspiring. Scott Meyers is another artist. So is Angelika Langer and Herb Sutter, and Andy Koenig, Stan Lippman, Doug Lea and Erich Gamma and Jim Copelien and numerous others. But, for each of them, there are 10,000 very so-so programmers out there spewing forth complete nonsense. Help de-nonsense your world with Tom's book. One person indicated that it is somewhat stale. It is really like fine wine. It just gets better with age.
5 of 5 people found the following review helpful:
3.0 out of 5 stars
Informative but...,
By Avneesh Bhatnagar (Ithaca, NY United States) - See all my reviews
This review is from: C++ Programming Style (Paperback)
I bought this book after reading through Effective C++ and More Effective C++ by Scott Meyers following the suggested reading by the author. I think that I should have read this book before purchasing the Effective C++ books. Basically it touches some fundamental issues, but due to the fact that it is slightly old, some topics such as templates are not covered very well. Meyers also gives a thorough overview of smart pointers, member function templates etc. My recommendation is that if you really want to start improving your C++ skills, forget about this book, read Scott Meyers' books and pick up Design Patterns by Erich Gamma and others.
Share your thoughts with other customers: Create your own review
|
|
Tags Customers Associate with This Product(What's this?)Click on a tag to find related items, discussions, and people.
|
|
This product's forum
Active discussions in related forums
Search Customer Discussions
|
Related forums
|