freeprogrammingbooks.com

How to Design Programs, Second Edition

By Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, Shriram Krishnamurthi (2023)

How to Design Programs, Second Edition book cover

Computer science education is undergoing a transformation. As AI tools reshape how code is written and reviewed, educators and industry leaders agree on one thing: the fundamentals of program design matter more than ever.

Understanding how to break down problems, structure solutions, and reason about program behavior remains the core skill that separates competent developers from those who merely stitch together AI-generated snippets.

How to Design Programs (HTDP) has been a cornerstone of introductory computer science education since its first edition in 2001. The second edition, released in 2023, updates the classic approach for a new generation of learners. Unlike conventional introductions that focus on syntax or a specific language, HTDP teaches a systematic design process that transfers across languages and paradigms. This makes it particularly valuable in an era where the programming landscape changes faster than any single textbook can track.

About the book

How to Design Programs, Second Edition is an introduction to programming and computing that places the design process at the center of learning. Written by Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram Krishnamurthi — a team of computer scientists with deep expertise in programming languages and software engineering — the book presents a disciplined approach to program construction.

The book does not use an industrial language. Instead, it introduces a tailor-made teaching language that grows with the reader. Starting with simple arithmetic and basic data types, it progresses through structured data, lists, abstractions, recursive algorithms, and accumulators. Along the way, readers learn design recipes: step-by-step guidelines that transform a problem statement into a working program. Each recipe covers how to analyze the problem, formulate goals, create examples, develop a solution outline, write the code, and test the result.

The intended audience is beginners with no prior programming experience. However, the systematic approach also benefits self-taught developers who want to formalize their understanding of program construction. The book assumes only basic high school mathematics and a willingness to think carefully about structure and design.

What you will learn

Readers will develop a transferable skill set for program design that includes:

  • Systematic problem analysis: How to break down a problem statement into precise data definitions and function signatures
  • Design recipes: Proven templates for common programming patterns, from simple functions to complex algorithms with backtracking
  • Data-driven design: How the structure of data dictates the structure of programs, including self-referential data like lists and trees
  • Abstraction techniques: Recognizing patterns across functions and data definitions, and capturing them with higher-order functions and local definitions
  • Generative recursion: Algorithms that do not follow the shape of the input data, including fractals, binary search, and graph traversal
  • Testing and verification: A rigorous approach to testing that goes beyond running a few examples
  • Interactive and event-driven programming: Building programs that respond to user input and model real-world phenomena
  • Accumulator-style programming: Understanding when and why to introduce accumulators for efficiency and correctness

Table of contents

  • Preface
  • Prologue: How to Program
  • Part I: Fixed-Size Data — Arithmetic, Functions and Programs, How to Design Programs, Intervals and Itemizations, Structures, Itemizations and Structures
  • Intermezzo 1: Beginning Student Language
  • Part II: Arbitrarily Large Data — Lists, Self-Referential Data Definitions, More on Lists, Design by Composition, Projects
  • Intermezzo 2: Quote, Unquote
  • Part III: Abstraction — Similarities Everywhere, Designing Abstractions, Using Abstractions, Nameless Functions
  • Intermezzo 3: Scope and Abstraction
  • Part IV: Intertwined Data — S-expressions and Trees, Iterative Refinement, Refining Interpreters, XML, Simultaneous Processing
  • Intermezzo 4: The Nature of Numbers
  • Part V: Generative Recursion — Non-standard Recursion, Designing Algorithms, Variations, Mathematical Examples, Backtracking
  • Intermezzo 5: The Cost of Computation
  • Part VI: Accumulators — The Loss of Knowledge, Designing Accumulator-Style Functions, More Uses of Accumulation
  • Epilogue: Moving On

Book details

  • Title: How to Design Programs, Second Edition
  • Author(s): Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, Shriram Krishnamurthi
  • Publication year: 2023
  • Publisher: The MIT Press
  • Pages: 981
  • PDF size: N/A (available as HTML)
  • Estimated reading time: ~24 h 32 min
  • Level: Beginner to Intermediate
  • Main category: Programming
  • Subcategory: (general)
  • Language: English
  • License: CC BY-NC-ND 4.0 (Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International)

More books in: Programming


Legal notice: This book is shared for educational purposes only. The content is distributed under Creative Commons licenses or with explicit permission from the author. FreeProgrammingBooks may host files that comply with their respective licenses.

Want more free books?

Join our channels and receive free books, courses and tech news.