57 of 59 people found the following review helpful
on March 1, 1999
I've long recommended Pike's "Notes on Programming in C" on my web page. This book includes most of the content from that essay and much more, but is still thin and concise.
What I like most about this book is that they justify all of their recommendations, show both good and bad examples, and keep the discussion grounded in actual code (rather than abstract principles).
Other things I liked:
- begins with a discussion of programming style and aesthetics
- they critique some of the designs that they have been involved in, such as C's stdio and string handling libraries
- they discuss the unique design issues presented by library design
- they give examples in C, C++ and Java, and give an honest appraisal of the tradeoffs involved in each language.
- FINALLY, excellent single chapter descriptions of systematic approaches to debugging and testing!
- they face up to some of the tough design choices that must be made outside the UNIX Ivory Tower (rare for these authors). For example, they sacrifice UNIX consistency in one application so that the application will behave consistently across UNIX and Windows.
- still skirts around tough design issues in error recovery and reporting; they advocate the "print a diagnostic and exit" approach (which is totally inappropriate for library code), and don't discuss the tradeoffs
- a few of the principles they cover will be trivial or obvious for experienced programmers
62 of 66 people found the following review helpful
In computing, the learning curve is doubly steep. Not only do we have to learn very complex operations, but we have to learn them at a pace unrivaled in any other field. Furthermore, the equipment improves at a rate that simply boggles the mind. In this frantic environment, we rarely have time to read our code twice, much less read a book about code. Therefore, when we do read, we must make every minute count. This is one book where your count of wasted minutes would be a very small one.
Some of the tips in this book are obvious in retrospect, yet ones that you probably would not think of. My favorite is the fact that due to the changes in processors, a double precision floating point arithmetic operation can be faster than the equivalent one for integers. In the "old" days, the gospel was that you must avoid floating point operations unless absolutely necessary, to avoid the degradation of performance.
Other tips, such as methods to assure you comment what is necessary, taking a few minutes to learn simple performance features, debugging and testing guidelines; portability issues and basic algorithm analysis should cause you to pause for a moment. Even in our hectic development environments, stopping and analyzing your code is a necessity.
It is difficult to conceive of someone who will not find a tip in here that will justify the cost of the book. Unless of course, you are one of the authors. I listed it as one of the top books of the year in my On Books column that appeared in the September, 1999 issue of _Journal of Object-Oriented Programming_.
46 of 50 people found the following review helpful
on January 18, 2001
I am bemused by the disparaging comments of my fellow readers in regard to this book. Kernighan and Pike make clear their intent in the first paragraph of the preface to this book; it is about simplicity, clarity, and generality.
To be sure, there is tinder here for short tempers and delicate egos. If you're under the gun, trying to duct-tape together the fifth release of some huge, unwieldy application, this book does not contain the short-term quick fixes you've been hoping for. If you're righteously convinced of your own sound practices and don't care to look at someone else's methods, this book may irk you.
Kernighan and Pike have written a book about the most basic habits and outlook that a programmer should have. They have not tried to address all facets of programming. Instead, they sacrifice scope to make their points stand out all the more clearly.
Would this be a better book if they had cast their net wider? Hardly. If you start off by applying the carefully thought out, methodical approaches described clearly throughout this book, your code will still hit abstruse bumps and strange circumstances. But most problems will succumb to the same analytical ways of thinking and tools that Kernighan and Pike have laboured to describe with such clarity.
But don't imagine that I think this book is perfect; the authors have been doing many things in the same ways for a long time. Most often, this is because their methods are effective, but sometimes they are far too close to being cop-outs. For example, the idea that it's OK to just print an error message and bomb out if something goes wrong is laughable outside of the Unix command line environment, and is rarely appropriate even there.
Fundamentally, though, if you can't solve the problems at the ends of the chapters (they're easy), or you think you can't possibly benefit from reading a book that troubles to describe quicksort (which you probably learned in CS-201), then there is likely nothing for you here. At least until you think to question your perspectives. Until then, I'll confess to a sense of relief that I don't have to work with you :-)
12 of 13 people found the following review helpful
on February 23, 1999
The book covers topics such as style, design, interfaces, notation, debugging, testing, performance tuning, and portability. Each of these topics gets its own chapter and is covered pretty throughly.
The writing is generally very interesting though at times it does get a little too much into details. It must have been interesting. I have finished reading it in less than 24 hours after having received it. This is something I've never done with a computer book before!!
The book does live up to its goal. I think any programmer (even with 20 years of experience) who reads this book will gain something from reading it.
Before you think that I think the book is perfect, I will point out some areas where I think it could be improved. First, I think the book is too focused on C. This is not surprising given that Kernighan is one of the authors. Personally, I have always believed that C is a language that encourages bad programming practices. In a few places in the book, I see some of those in the code that is presented. The other area I was disappointed in was that there was not much on object-oriented programming practices. Beyond that, I saw something I do not believe should be in any good OO program. That something was a public instance variable. A few places I disagreed with the authors on style issues. However, all of these problems are fairly minor and will hopefully be corrected in the next edition.
In conclusion, I think this is a book that all programmers should read at least once. I know I will keep my copy on my shelf for those times when I have questions like "how can I optimize this code?". It really is the best general programming book that has been published in years.
12 of 13 people found the following review helpful
on March 29, 2002
This book is basically all the "common sense" stuff that you learn after programming for years and years.. most proffessional programmers already know this stuff--or should! This is a perfect book for a college graduate who is good, but needs some pointers in the real world, or for those who just want to freshen up their skills, etc. Beware though, this book is not "Programming for Dummies" you must already be well familiar with C/C++ and some algorithms and data structures to fully understand what the author is trying to convey, at times. But even if you don't, it's still a great book... it is (or will be) one of those classics like The C Programming Language, which every programmer has on their bookshelf. Pretty much any book written by Kernighan or published by A-W (Professional series) is a worthwhile read...
In a nutshell, as they say in the book: this is what most people should have learned in college, but couldn't or didn't. Get it if only to read the first chapter on style... I for one hate rewriting or reading people's code who didn't know how to write it well/clear, or comment it well.
11 of 12 people found the following review helpful
on September 20, 1999
When the book was published I liked the title and knowing the authors assumed it would be a good book to have. The emphasis is more on C, less on C++ and Java and OOP in general. The chapters: Debugging, Testing, Performance and Portability describe real world examples and in concise way points out important practical aspects of software development. It is useful for practicing programmers with C,C++ or Java background. It is complementing what most other books do not cover. That is why I bought it. It is worth the price. Would be happier if the book covered the OOP traps and pitfalls more deeply.
6 of 6 people found the following review helpful
on August 30, 1999
I was surprised by some unfavourable reviews of this book, but they were probably by people expecting something different. This is not a handbook or cookbook. This book is about how to do things wisely... it is about long-lasting principles about how to program in practice. It is not a book about how to program in the latest version of a given compiler and windowing system.
I am not a professional programmer, but I do a fair bit of programming and lately software design for our research work. I have also read some of the earlier books by the same authors. Not everything was new to me, but nontheless it was never boring reading...
I do not mind paying for a book full of ideas, and few instructions. This is a book I will not open every day, but having read it has made me a better and wiser programmer every day.
8 of 9 people found the following review helpful
on February 16, 2002
For the facts I have nothing substantial to add to the January 2001 reviews.
I do programming since 1983. Started with Fortran, Pascal, Modula 2 and C. Read Bertrand Meyer's "O-O Software Construction" which opened my eyes how to design interfaces. I created code and rewrote code. I worked together with programmers of many kinds of personalities.
Comparing my experiences with what Kernighan and Pike's book tells is, that this book really discloses the fundamentals of effective software development to produce maintainable software systems:
simplicity, clarity, generality.
And working with programmers who are on the way to discover or yet have discovered these pearls of wisdom is fun!
BTW: "The Pragmatic Programmer" written by Andrew Hunt and David Thomas is another great book to consider.
10 of 12 people found the following review helpful
on May 24, 1999
I found the book enjoyable. Best parts are stories of the old days, and some good chunks of code. Bad things: 1. Apparently written to "cash-in" on trendy lore-of-programming books ("Code Complete" etc.). 2. Chapters end with exercises that *aren't answered*. Even on their web page; some are obviously speculative but some clearly have correct answers which I thought I was paying-for when I bought the book. 3. So I'm stupid: the Markov chain chapters left me confused about the algorithm itself. 4. The C++ Java "interface" etc. stuff seems tacked-on to a basically C-language orientation (see #1 above). There is virtually *no* treatment of GUIs. This could be a plus of course.
But I still enjoyed the book....
7 of 8 people found the following review helpful
on November 6, 2004
Simplicity, Clarity and Generality are indeeds the qualities of fine code. This is one of the few books that strives to make you a better programmer. Most books are about how-to, this is a book that goes beyond that and gives you information that can make you better. The other two books that do this for me are "Programming Pearls" by Jon Bentley and "Refactoring: Improving the Design of Existing Code" by Martin Fowler.
The pedigree of the authors is something that you should not dismiss lightly, after all, Brian Kernighan is the "K" in the K&R book, and also with Rob Pike the author of "The Unix Programming Environment".
Lots of good stuff.