Book

The Elements of Programming Style

📖 Overview

The Elements of Programming Style, published in 1974 by Brian W. Kernighan and P. J. Plauger, established fundamental principles for writing clear, maintainable computer programs. The book draws inspiration from Strunk & White's The Elements of Style and applies similar principles to the realm of software development. The text analyzes real programming examples from published textbooks, including the authors' own work, to demonstrate both effective and problematic coding practices. Each chapter concludes with concrete maxims that summarize key lessons about writing readable, efficient code. The book's approach transformed how programmers think about code readability and maintenance. Its influence led to numerous language-specific adaptations, including versions for C, Java, C#, and MATLAB. The enduring impact of this work stems from its practical focus on making programs comprehensible to humans rather than just computers. Its principles continue to shape modern software development practices and programming education.

👀 Reviews

Readers describe the book as practical and timeless, with programming principles that remain relevant decades after publication. The code examples use older languages like PL/I and FORTRAN, but the core concepts translate to modern programming. Readers appreciated: - Clear explanations of why certain code is good or bad - Short chapters focused on specific concepts - Real examples taken from student programs - Memorable rules and guidelines Common criticisms: - Dated programming language examples - Some concepts feel basic for experienced developers - Brief treatment of each topic - Hard to find copies of newer editions Ratings: Goodreads: 4.14/5 (504 ratings) Amazon: 4.6/5 (31 ratings) One reader noted: "The examples may be old but the principles are eternal." Another said: "Changed how I think about writing code, though took me multiple reads to absorb everything." Common comparison: "Like Strunk & White's Elements of Style, but for code."

📚 Similar books

Code Complete by Steve McConnell The book examines programming construction in detail through case studies and examples, expanding on many principles introduced in Elements of Programming Style.

Clean Code by Robert C. Martin This text provides specific coding practices and patterns that build upon Kernighan's foundational principles of code clarity and maintenance.

Structure and Interpretation of Computer Programs by Harold Abelson, Gerald Jay Sussman The book presents programming concepts through practical examples and emphasizes the importance of program design and structure.

Programming Pearls by Jon Bentley Through columns and essays, this work explores programming problems and solutions while focusing on code efficiency and elegance.

The Practice of Programming by Brian W. Kernighan This book extends the principles from Elements of Programming Style into modern programming contexts with practical examples and techniques.

🤔 Interesting facts

🔹 The book's title and approach were directly inspired by "The Elements of Style" by Strunk & White, mirroring its concise, rule-based format for programming instead of writing. 🔹 Brian Kernighan also co-authored the first book on C programming language ("The C Programming Language") and helped create AWK, a text-processing language still used in Unix systems today. 🔹 Many of the code examples in the book were taken from actual student programming assignments, making the lessons particularly relevant and practical for real-world learning. 🔹 The book introduced several programming maxims that became industry standards, including the famous "Write clearly - don't be too clever" and "Say what you mean, simply and directly." 🔹 Though originally written when FORTRAN and PL/I were dominant languages, the book's principles have been successfully adapted for modern languages like Python, Java, and C++, proving the timelessness of its core concepts.