Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the author
OK
The Practice of Programming (Addison-Wesley Professional Computing Series) 1st Edition
Purchase options and add-ons
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.
- ISBN-10020161586X
- ISBN-13978-0201615869
- Edition1st
- PublisherAddison-Wesley
- Publication dateFebruary 4, 1999
- LanguageEnglish
- Dimensions8.98 x 7.64 x 0.52 inches
- Print length288 pages
Frequently bought together

Similar items that may deliver to you quickly
The AWK Programming Language (Addison-Wesley Professional Computing Series)Alfred AhoPaperbackFREE Shipping by AmazonGet it as soon as Friday, Apr 17
Advanced Programming in the UNIX Environment, 3rd EditionPaperbackFREE Shipping by AmazonGet it as soon as Friday, Apr 17
C Programming: A Modern ApproachPaperbackFREE Shipping by AmazonGet it as soon as Friday, Apr 17Only 4 left in stock - order soon.
The Art of UNIX Programming (The Addison-Wesley Professional Computng Series)PaperbackFREE Shipping by AmazonGet it as soon as Friday, Apr 17
Customers also bought or read
- Coders at Work: Reflections on the Craft of Programming
Paperback$39.61$39.61FREE delivery Fri, Apr 17 - The Unix Programming Environment (Prentice-Hall Software Series)
Paperback$83.99$83.99FREE delivery Fri, Apr 17 - Mythical Man-Month, The: Essays on Software Engineering, Anniversary Edition
Paperback$29.14$29.14Delivery Apr 28 - May 1 - C Programming Language, 2nd Edition#1 Best SellerC Programming Language
Paperback$60.30$60.30FREE delivery Fri, Apr 17 - Operating Systems: Three Easy Pieces#1 Best SellerComputer Operating Systems Theory
Paperback$28.27$28.27Delivery Fri, Apr 17 - Structure and Interpretation of Computer Programs - 2nd Edition (MIT Electrical Engineering and Computer Science)#1 Best SellerCompiler Design
Paperback$60.21$60.21FREE delivery Apr 20 - 22 - The Pragmatic Programmer: Your Journey To Mastery, 20th Anniversary Edition (2nd Edition)#1 Best SellerSoftware Design & Engineering
Hardcover$41.64$41.64FREE delivery Fri, Apr 17 - Design Patterns: Elements of Reusable Object-Oriented Software#1 Best SellerObject-Oriented Design
Hardcover$30.47$30.47Delivery Apr 22 - 25 - The AWK Programming Language (Addison-Wesley Professional Computing Series)
Paperback$37.41$37.41FREE delivery Fri, Apr 17 - Art of Computer Programming, The, Volumes 1-4B, Boxed Set
Hardcover$276.99$276.99FREE delivery Fri, Apr 17 - Effective C++: 55 Specific Ways to Improve Your Programs and Designs (Addison-Wesley Professional Computing Series)
Paperback$27.93$27.93Delivery Apr 22 - 24 - More Programming Pearls: Confessions of a Coder: Confessions of a Coder
Paperback$34.95$34.95Delivery May 2 - 5 - Tour of C++, A (C++ In-Depth Series)#1 Best SellerC++ Programming Language
Paperback$39.99$39.99FREE delivery Fri, Apr 17 - C Interfaces and Implementations: Techniques for Creating Reusable Software
Paperback$51.72$51.72FREE delivery Fri, Apr 17 - Bare-Metal Embedded C Programming: Develop high-performance embedded systems with C for Arm microcontrollers#1 Best SellerComputer Hardware Design & Architecture
Paperback$33.59$33.59Delivery Fri, Apr 17 - Working Effectively with Legacy Code (Robert C. Martin Series)
Paperback$53.46$53.46FREE delivery Fri, Apr 17 - The Algorithm Design Manual (Texts in Computer Science)
Hardcover$64.85$64.85FREE delivery Fri, Apr 17 - Fundamentals of Software Architecture: A Modern Engineering Approach#1 Best SellerComputer Programming Logic
Paperback$57.40$57.40FREE delivery Fri, Apr 17 - Systems Performance (Addison-Wesley Professional Computing Series)#1 Best SellerComputer Performance Optimization
Paperback$65.95$65.95FREE delivery Fri, Apr 17
Editorial Reviews
Amazon.com Review
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 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
From the Back Cover
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.
020161586XB04062001
About the Author
Brian W. Kernighan works in the Computing Science Research Center at Bell Laboratories, Lucent Technologies. He is Consulting Editor for Addison-Wesley's Professional Computing Series and the author, with Dennis Ritchie, of The C Programming Language.
Rob Pike works in the Computing Science Research Center at Bell Laboratories, Lucent Technologies. He was a lead architect and implementer of the Plan 9 and Inferno operating systems. His research focuses on software that makes it easier for people to write software.020161586XAB04062001
Product details
- Publisher : Addison-Wesley
- Publication date : February 4, 1999
- Edition : 1st
- Language : English
- Print length : 288 pages
- ISBN-10 : 020161586X
- ISBN-13 : 978-0201615869
- Item Weight : 1 pounds
- Dimensions : 8.98 x 7.64 x 0.52 inches
- Part of series : Addison-Wesley Professional Computing
- Best Sellers Rank: #171,389 in Books (See Top 100 in Books)
- #61 in Computer Programming Languages
- #99 in Programming Languages (Books)
- #347 in Computer Software (Books)
- Customer Reviews:
About the author

Discover more of the author’s books, see similar authors, read book recommendations and more.
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonCustomers say
Generated from the text of customer reviewsSelect to learn more
Top reviews from the United States
There was a problem filtering reviews. Please reload the page.
- Reviewed in the United States on March 4, 2026Format: PaperbackVerified PurchaseBrian Kernighan is a very, very good writer, probably the best to have ever tackled the topic of computer programming. This book is essentially a collection of topics he and Rob thought were interesting to write about and it's not clear who the audience of this book is. I.e., it is basically a blog in book form. By the time someone is a freshman or sophomore in college he or she should know a lot of the material or be able to immediately grasp the true solution to the problems posed and wonder what the point of the sub-optimal discussion (e.g., around the spam filter) is. So in one respect, the book is almost completely pointless -- though let it be said, I do appreciate the perspectives on what constitutes good programming style. On the other hand, the book exists to be appreciated and to be a model for other writers.
- Reviewed in the United States on December 31, 2011Format: PaperbackVerified PurchaseKernighan & Pike's "The Practice of Programming" (TPOP) is a short book in the general-advice-on-everything-related-to-programming genre. Both authors have impressive pedigrees, predisposing one to expect much from them. This book delivers: though the focus on C and the text's conciseness might put off some readers, this is a volume that is worth reading and re-reading.
The Good: it is a sad fact that even though a work like E. H. Gombrich's "Story of Art" attracts favorable reviews from young readers and accomplished artists alike, there are many programmers who feel the need to point out that they already know everything covered in Kernighan & Pike's TPOP. Let there be no doubt about this: "The Practice of Programming" is a masterful work, containing distilled wisdom. TPOP belongs to a very short list of programming books that deserve careful reading of even the minutest detail and amply reward such effort (Jon Bentley's "Programming Pearls" is another text on this list). Kernighan & Pike's text covers every aspect of practical programming, from style, through data structures, design, debugging, testing, performance, portability, up to special-purpose languages. It authoritatively covers a huge variety of topics, bringing to mind another important text, Steve McConnell's "Code Complete", which is easier to read, more detailed, and therefore 3.5 times longer. Even so, it's interesting to note that, unlike TPOP, "Code Complete" does not include exercises and does not discuss topics like tail recursion or endianness. On a different note, any book addressing the totality of programming is bound to disappoint a fraction of its potential readers by not using the language du jour. Kernighan & Pike have tried to preempt such complaints by including some mention of C++, Java, awk, and Perl, but in its core this book is C-oriented. C is still the lingua franca of programming, so this seems appropriate; as the authors put it, C "gives the programmer complete control over implementation, and programs written in it tend to be fast." Despite the conciseness and technical nature of TPOP, the authors manage to keep things flowing without mincing their words, e.g. "a lot of quick and dirty code ends up in widely-used software, where it remains dirty and often not as quick as it should have been anyway". Intriguingly, they are equally direct when discussing C-related issues, e.g. "rather than having memcpy for speed and memmove for safety, it would be better to have one function that was always safe, and fast when it could be." They also sneak in a joke or two, e.g. an enumerator in Plan 9's errors.h is called Egreg, which would have been funny even if it wasn't followed by the inimitable comment "It's all Greg's fault".
The Bad: parts of this book are non-trivial, e.g. the interplay of split() and advquoted() in the second C version of the CSV library. I'm bringing this up in the section on "The Bad" only because it's customary to expect a lot of filler in books on programming. In reality, this is one of the good aspects of TPOP: even when things get intricate it's worth putting in the effort to figure out what's going on. To quote Faulkner's (alleged) admonition in response to the complaint that some of his works are difficult to understand even after two or three readings: "read it a fourth time!" Of course, even though Kernighan & Pike are much more competent than the average programming author, they're still human, so they do sometimes produce phrases like this one: "Well-written programs are better than badly-written ones". At a more detailed level, I did notice a few minor issues. For example, in chapter 1 the authors rewrite a Java class and then say that the new version is better because "it leads to statements like queue.capacity++". However, directly accessing and changing a member variable violates encapsulation. Still at a fine-grained level, I spotted only one issue regarding the C code (other than the need to keep a reference handy at all times). In chapter 3 the authors say that the programs they show are production code and they also state that "the C programmer must do more of the work, allocating and reclaiming memory, creating hash tables and linked lists, and the like". Given both these points, one would expect that best practices imply that malloc'ed memory should be explicitly free'd, out of respect for the maintenance programmers to follow. However, the Markov chain C program does not do this. Finally, some of what this text has to say on C++ is non-idiomatic (though almost always still correct). Kernighan & Pike matter-of-factly mention or use int main(void), strcpy, strstr, and realloc in C++. A C++ aficionado might even go so far as to note that when they do use std::string (instead of C-style strings, as in the rest of the text) they get the number of characters from [the strlen() descendant] length() instead of [the STL mainstay] size().
In a nutshell, this book is a classic and is destined to remain one. This should come as no surprise to those who've read Kernighan & Pike's earlier "The Unix Programming Environment". Highly recommended.
Alex Gezerlis
- Reviewed in the United States on December 7, 2005Format: PaperbackVerified PurchaseAn excellent book covering all of the essential areas of knowledge necessary to become a professional programmer and should be required reading for those without a formal computer science background. The examples are brief but rich in content. Major topics covered include: style, algorithms, design, implementation, optimization, interfaces, debugging, testing, performance, portability, and notation (languages). Each topic is discussed with emphasis on content and application of knowledge, not a lot of extraneous verbiage, just simple, solid content. This text is also great as a quick refresher for information on lists, hash tables, trees, algorithmic design and implementation, and good interface design rules. Provided are good "rules of thumb" for debugging and thoughts on portability along with ideas for writing code generators.
Some of the examples can be somewhat terse and break the authors rules for clarity and following standard language idioms. However, it is highly recommended to take the time to fully understand the examples in order to extract the most benefit. One final note, while working on a large re-engineering project we have proven that the "bear" technique really works, you'll have to read the text for the answer, it deals with auditory versus visual triggers and thinking.
- Reviewed in the United States on November 24, 2015Format: PaperbackVerified PurchaseThis book gets to the heart of a number of important, readily understood and (sadly) often dismissed factors affecting software development quality. Although the concepts are agnostic, the presentation is C centric and probably less valuable to those who don't know C. I've started using this book (again) with less experienced C developers or those that have never had the opportunity to consider code as an organizational asset where quality of construction has a tangible organizational value in the long term.
- Reviewed in the United States on January 4, 2021Format: PaperbackVerified PurchaseI wish this book came out 50 years ago when I started coding. It would have made my lifer easier. I noticed right off if the principles, set out in this book, were put to use in ones life one would have a simpler and easier walk through this world. The main principles are:
1.keep the solution simple
2. write the code so others can understand it
3. annotate your code.
4. do not use fancy tricks just to show off
Good book buy it and live by it.
- Reviewed in the United States on September 14, 2021Format: PaperbackVerified PurchaseBrian Kernighan demonstrates conciseness in communication and clarity in his writing. The same has been true of software he's designed as well as examples in his books. In a world of 1,200 page forest killers, this 265p book contains as much with higher value. Broadly applicable, but most examples are in C. The more experienced you are, the more you'll appreciate it: Simplicity, Clarity, Generality
Top reviews from other countries
SergioReviewed in Canada on January 16, 20165.0 out of 5 stars Five Stars
Format: PaperbackVerified PurchaseThe best book
-
PaulaReviewed in Spain on June 1, 20155.0 out of 5 stars Pratice of programmng
Format: PaperbackVerified PurchaseHa cumplido mis espectativas con creces, muy contenta con el resultado del envio y de la compra
muy amables, paula
-
Lorenzo BerettaReviewed in Italy on December 12, 20245.0 out of 5 stars Uno dei libri tecnici migliori in assoluto
Format: PaperbackVerified PurchaseQua e là alcuni specifici dettagli sono datati (hash moltiplicativi... ma anche no).
Ma non importa, perchè nel complesso il libro è ottimo.
Avete presente quando vi trovate a osservare come lavora un collega più esperto, e imparate per osmosi una serie di abitudini e magari qualche trucco sparso? Ecco, questo libro è praticamente la versione cartacea; utilissimo per chi è alle prime armi, godibilissimo per chi si è già fatto le ossa.
Anche se non credo che riuscirò mai ad affrontare l'esercizio 1.3...
Laurent RosenfeldReviewed in France on March 6, 20175.0 out of 5 stars A very good book
Format: PaperbackVerified PurchaseA very good book that I had read on-line, but thought it was good to have in a paper version.
Amazon KundeReviewed in Germany on January 3, 20215.0 out of 5 stars A classic
Format: PaperbackVerified PurchaseFor me a classic. Although I could use the direct C oriented examples direktly, the topics are general enough to standnthe test od time. I could recognise quite a lot of the principles in the Go programming language design decisions.



















