Programming Books C Java PHP Python Learn more Browse Programming Books
The Practice of Programming and over one million other books are available for Amazon Kindle. Learn more

Sorry, this item is not available in
Image not available for
Image not available

To view this video download Flash Player


Sign in to turn on 1-Click ordering
Sell Us Your Item
For a $2.00 Gift Card
Trade in
More Buying Choices
Have one to sell? Sell yours here
Start reading The Practice of Programming on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

The Practice of Programming (Addison-Wesley Professional Computing Series) [Paperback]

by Brian W. Kernighan, Rob Pike
4.0 out of 5 stars  See all reviews (59 customer reviews)

Buy New
$35.78 & FREE Shipping. Details
Only 7 left in stock (more on the way).
Ships from and sold by Gift-wrap available.
In Stock.
Rented by RentU and Fulfilled by Amazon.
Want it tomorrow, April 25? Choose One-Day Shipping at checkout. Details
Free Two-Day Shipping for College Students with Amazon Student


Amazon Price New from Used from
Kindle Edition $22.99  
Paperback $35.78  
Sell Us Your Books
Get up to 80% back when you sell us your books, even if you didn't buy them at Amazon. Learn more

Book Description

February 14, 1999 020161586X 978-0201615869 1

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.

The practice of programming is more than just writing code. Programmers must also assess tradeoffs, choose among design alternatives, debug and test, improve performance, and maintain software written by themselves and others. At the same time, they must be concerned with issues like compatibility, robustness, and reliability, while meeting specifications.

The Practice of Programming covers all these topics, and more. This book is full of practical advice and real-world examples in C, C++, Java, and a variety of special-purpose languages. It includes chapters on:

  • debugging: finding bugs quickly and methodically
  • testing: guaranteeing that software works correctly and reliably
  • performance: making programs faster and more compact
  • portability: ensuring that programs run everywhere without change
  • design: balancing goals and constraints to decide which algorithms and data structures are best
  • interfaces: using abstraction and information hiding to control the interactions between components
  • style: writing code that works well and is a pleasure to read
  • notation: choosing languages and tools that let the machine do more of the work

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 the principles and guidance in The Practice of Programming .

Frequently Bought Together

The Practice of Programming (Addison-Wesley Professional Computing Series) + C Programming Language, 2nd Edition
Price for both: $84.77

Buy the selected items together
  • C Programming Language, 2nd Edition $48.99

Customers Who Bought This Item Also Bought

Editorial Reviews 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


"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." --

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

Product Details

  • Paperback: 288 pages
  • Publisher: Addison-Wesley; 1 edition (February 14, 1999)
  • Language: English
  • ISBN-10: 020161586X
  • ISBN-13: 978-0201615869
  • Product Dimensions: 9 x 7.6 x 0.5 inches
  • Shipping Weight: 14.4 ounces (View shipping rates and policies)
  • Average Customer Review: 4.0 out of 5 stars  See all reviews (59 customer reviews)
  • Amazon Best Sellers Rank: #157,518 in Books (See Top 100 in Books)

More About the Author

Discover books, learn about writers, read author blogs, and more.

Customer Reviews

Most Helpful Customer Reviews
60 of 63 people found the following review helpful
5.0 out of 5 stars No waste of time here January 7, 2000
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_.
Comment | 
Was this review helpful to you?
51 of 53 people found the following review helpful
5.0 out of 5 stars Best book of its kind 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.
Minor gripes:
- 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
Comment | 
Was this review helpful to you?
44 of 48 people found the following review helpful
5.0 out of 5 stars Simple and excellent 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.
Read more ›
Comment | 
Was this review helpful to you?
11 of 11 people found the following review helpful
5.0 out of 5 stars Great book for intermediate programmers/hackers March 29, 2002
By Boris S
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.
Comment | 
Was this review helpful to you?
Most Recent Customer Reviews
5.0 out of 5 stars A++++
Just as described, excellent communication and delivery...
No regrets will buy again i would recommend this store and product to anybody looking for similar products
Published 13 days ago by angel mendoza
4.0 out of 5 stars good in style, somewhat antiquated in content
Kernighan's books on programming are exemplary in their style for clarity. I wish I had read this book when I just started programming; it would have saved me a lot of wasted... Read more
Published 11 months ago by davez
5.0 out of 5 stars It is a masterpiece.
It is a masterpiece.

It is a sublime distillation, decades of high-level programming (the authors Kernighan and Pike are part of the history of computer science)... Read more
Published 12 months ago by Iskandar
4.0 out of 5 stars very helpful
This book helped me get beyond individual languages, op systems, and tools, into the heart of programming. Read more
Published 15 months ago by mykl-s
5.0 out of 5 stars The practice of Programming
This is a classic text from one of the founding fathers of programming. Easy to read and easy to follow.
Published 15 months ago by Robert Cotter
5.0 out of 5 stars A masterful work on programming
Kernighan & Pike's "The Practice of Programming" (TPOP) is a short book in the general-advice-on-everything-related-to-programming genre. Read more
Published on December 30, 2011 by Alexandros Gezerlis
5.0 out of 5 stars Classic top notch guide not only for the C developer
"Simplicity, clarity, generality" is the secret of an excellent program, of an excellent piece of work. This book tries to help you, to further approach this aim. Read more
Published on June 15, 2011 by ws__
4.0 out of 5 stars Class was full
Not sure, the course that used this book was full, so I had to go for some other course. However, I flicked through and had a cursory glance at the material and found that the... Read more
Published on October 6, 2010 by HumanComplex
4.0 out of 5 stars Good book to read
I think this is a good book to read. Recall a joke about programming:
1. Learn all the theories about computer science.
2. Pick up a style.
3. Read more
Published on February 28, 2009 by Yuanchyuan Sheu
5.0 out of 5 stars Great Book!!!
This book is perfect for any computer engineer who wants to get more information about programming.
Published on June 9, 2008 by T. Christy
Search Customer Reviews
Only search this product's reviews

What Other Items Do Customers Buy After Viewing This Item?


There are no discussions about this product yet.
Be the first to discuss this product with the community.
Start a new discussion
First post:
Prompts for sign-in

Look for Similar Items by Category