THE READING ROOM / BOOK GUIDE
The Practice of Programming
A short guide to writing code that other people can read, debug and maintain, built around small examples and the decisions working programmers face.
About the book
The Practice of Programming sets out the habits behind reliable code: clear naming, careful testing, sensible debugging, workable interfaces and disciplined performance work. Brian W. Kernighan writes for programmers who already know a language and want to use it well.
The method is concrete. Kernighan starts from fragments of code, asks what is wrong with them, then rewrites them. That keeps the discussion tied to daily decisions, from how to structure a loop to how to design a small library. The prose is plain and direct, closer to a craftsman's notebook than a textbook.
Most examples come from C and C++, with occasional excursions into other languages. Readers should expect pointer arithmetic, memory management and Unix-style tooling. The principles travel further than the syntax, though the examples anchor the argument in a particular era of systems programming.
How to read it
Read it with a text editor open. The value comes from trying the rewrites yourself before reading Kernighan's version. The chapters on style and interfaces reward slow attention because they concern judgment, not rules. The debugging and testing material can be applied to a current project within a day.
The book is short, roughly two hundred pages, and moves briskly. Some sections assume comfort with C idioms, so readers new to the language may need to pause. Treat the performance chapter as a lesson in measurement discipline rather than a set of benchmarks to memorize. The examples are small enough to type in and modify.
Who it suits
This suits programmers who can already write working code and want to make it clearer and more reliable. It helps team leads who review code and need language for discussing style and design. Students who have finished an introductory course will find it a bridge between passing assignments and writing software others can maintain. Engineers moving into C or C++ from higher-level languages will get a useful tour of the idioms and pitfalls.
Reading considerations
The examples lean heavily on C and C++, and modern languages and tooling have changed some of the specifics. A reader working mainly in Python or JavaScript should translate the principles rather than copy the syntax. The book says little about version control, continuous integration or collaborative workflows that now shape everyday practice.
Follow the HN conversation
90 different recommenders are recorded in the upstream dataset. These are AI-classified source counts, not an independent rating.
Search HN comments about this book ↗
Explore videos on the same subject ↗
Book notes prepared with DeepSeek, using catalogue records and Open Library subject information. They are reading guidance, not a personal review or a verified chapter-by-chapter account. Book details can vary by edition. HN data methodology · Book metadata and covers.
