阿博的书架
home

阿博的书架

The Practice of Programming
Brian W. Kernighan and Rob Pike

Cover

The Practice of Programming

Summary

Series: Book 3 in the 编程/技术 series

Summary:

With the same insight and authority that made their book The Unix Programming Environment a classic, Brian Kernighan and Rob Pike have written The Practice of Programming to help make individual programmers more effective and productive. This book is full of practical advice and real-world examples in C, C++, Java, and a variety of special-purpose languages. Kernighan and Pike have distilled years of experience writing programs, teaching, and working with other programmers to create this book. Anyone who writes software will profit from its principles and guidance.

Amazon.com Review

Coauthored by Brian Kernighan, one of the pioneers of the C programming language, The Practice of Programming is a manual of good programming style that will help any C/C++ or Java developer create faster, more maintainable code.

Early sections look at some of the pitfalls of C/C++, with numerous real-world excerpts of confusing or incorrect code. The authors offer many tips and solutions, including a guide for variable names and commenting styles. Next, they cover algorithms, such as binary and quick sorting. Here, the authors show how to take advantage of the built-in functions in standard C/C++. When it comes to data structures, such as arrays, linked lists, and trees, the authors compare the options available to C, C++, Java, and even Perl developers with a random-text-generation program (using a sophisticated Markov chain algorithm) written for each language.

Subsequent sections cover debugging tips (including how to isolate errors with debugging statements) and testing strategies (both white-box and black-box testing) for verifying the correctness of code. Final sections offer tips on creating more portable C/C++ code, with the last chapter suggesting that programmers can take advantage of interpreters (and regular expressions) to gain better control over their code. A handy appendix summarizes the dozens of tips offered throughout the book.

With its commonsense expertise and range of examples drawn from C, C++, and Java, The Practice of Programming is an excellent resource for improving the style and performance of your code base. --Richard Dragan

Review

"The book fills a critical need by providing insight into pragmatic designand coding issues so that programmers become better at their craft...Programmers just out of school should be given this book on their first day of work. It will save employers thousands of dollars due to lost productivity and "mindless" debugging." -- Paul McNamee, Computer Scientist, Johns Hopkins University Applied Physics Laboratory

"The examples are just about right. Chapter 3's example (markov) is stellar; it is simple, thought-provoking, elegant, and most importantly, provides an opportunity to analyze good design... It is the most concise book of its kind and offers the most useful, no-nonsense treatment of how to program from authors who know a great deal about the topic." -- Peter Memishian, Member of Technical Staff, Sun Microsystems

"There is a tendency for many books to be in the high hundreds of pages long these days with very little justification. This text is well-written, and is not overly interdependent, thus allowing the reader to "skip around" as interests motivate.... I found [the examples] to be interesting. I like it when I don't have to spend time figuring out an example and I can concentrate on the lesson the example is trying to teach. Too many books have overly-complex examples, and this one doesn't." -- Chris Cleeland, Technical Lead, IONA Technologies, Inc.

"A great candidate to fill this widely perceived lack in the literature... Very solid and very educational, this manual is one I highly recommend to all programmers." -- Dr. Dobb's Electronic Review of Computer Books

"An outstanding book... a readable and well-written style combined with their experience and valuable expertise." -- Sys Admin

"This book is full of good common sense. In addition it is written in highly readable English. Pick up a copy, choose any chapter and start reading. I think you will then feel motivated to buy yourself a copy... Whatever language you program in, I think you will benefit from reading this book." -- Association of C & C++ Users

Rating 9/10: "Practical and enjoyable, this book captures its authors' considerable wisdom and experience." -- Slashdot.org

Read the full review for this book.

To be honest, there are quite a few books around that teach algorithms and the fundamentals of computer programming. The problem is that those books are commonly designed to support academic classes in computer science, and consequently shine on the theoretical side but leave something to be desired on the pragmatic front.

The Practice of Programming is a great candidate to fill this widely perceived lack in the literature that I commonly refer to as "for the industry." Authored by two experienced researchers of the Computing Science Research Center at the well-known Bell Labs (the name Brian Kernighan will ring a bell to the millions of C programmers), this manageable text conveys a fantastic quantity of suggestions and guidelines that will come in useful to all the neophytes of programming, and at the same time provides some sound tips and principles to the more seasoned among us. The first chapter approaches the delicate topic of good coding style; while the opinions on this are always subjective, those expressed by the authors seem generally acceptable and worth following. --Davide Marcato, Dr. Dobb's Electronic Review of Computer Books -- Dr. Dobb's Electronic Review of Computer Books