Contents

Foreword

Preface

Acknowledgments

About the Author

Chapter 1 Craftsmanship

PART I The Disciplines

Extreme Programming

The Circle of Life

Test-Driven Development

Refactoring

Simple Design

Collaborative Programming

Acceptance Tests

Chapter 2 Test-Driven Development

Overview

Software

The Three Laws of TDD

The Fourth Law

The Basics

Simple Examples

Stack

Prime Factors

The Bowling Game

Conclusion

Chapter 3 Advanced TDD

Sort 1

Sort 2

Getting Stuck

Arrange, Act, Assert

Enter BDD

Finite State Machines

BDD Again

Test Doubles

Dummy

Stub

Spy

Mock

Fake

The TDD Uncertainty Principle

London versus Chicago

The Certainty Problem

London

Chicago

Synthesis

Architecture

Conclusion

Chapter 4 Test Design

Testing Databases

Testing GUIs

GUI Input

Test Patterns

Test-Specific Subclass

Self-Shunt

Humble Object

Test Design

The Fragile Test Problem

The One-to-One Correspondence

Breaking the Correspondence

The Video Store

Specificity versus Generality

Transformation Priority Premise

{} → Nil

Nil → Constant

Unconditional → Selection

Value → List

Statement → Recursion

Selection → Iteration

Value → Mutated Value

Example: Fibonacci

The Transformation Priority Premise

Conclusion

Chapter 5 Refactoring

What Is Refactoring?

The Basic Toolkit

Rename

Extract Method

Extract Variable

Extract Field

Rubik’s Cube

The Disciplines

Tests

Quick Tests

Break Deep One-to-One Correspondences

Refactor Continuously

Refactor Mercilessly

Keep the Tests Passing!

Leave Yourself an Out

Conclusion

Chapter 6 Simple Design

YAGNI

Covered by Tests

Coverage

An Asymptotic Goal

Design?

But There’s More

Maximize Expression

The Underlying Abstraction

Tests: The Other Half of the Problem

Minimize Duplication

Accidental Duplication

Minimize Size

Simple Design

Chapter 7 Collaborative Programming

Chapter 8 Acceptance Tests

The Discipline

The Continuous Build

PART II The Standards

Your New CTO

Chapter 9 Productivity

We Will Never Ship S**T

Inexpensive Adaptability

We Will Always Be Ready

Stable Productivity

Chapter 10 Quality

Continuous Improvement

Fearless Competence

Extreme Quality

We Will Not Dump on QA

The QA Disease

QA Will Find Nothing

Test Automation

Automated Testing and User Interfaces

Testing the User Interface

Chapter 11 Courage

We Cover for Each Other

Honest Estimates

You Must Say NO

Continuous Aggressive Learning

Mentoring

PART III The Ethics

The First Programmer

Seventy-Five Years

Nerds and Saviors

Role Models and Villains

We Rule the World

Catastrophes

The Oath

Chapter 12 Harm

First, Do No Harm

No Harm to Society

Harm to Function

No Harm to Structure

Soft

Tests

Best Work

Making It Right

What Is Good Structure?

Eisenhower’s Matrix

Programmers Are Stakeholders

Your Best

Repeatable Proof

Dijkstra

Proving Correctness

Structured Programming

Functional Decomposition

Test-Driven Development

Chapter 13 Integrity

Small Cycles

The History of Source Code Control

Git

Short Cycles

Continuous Integration

Branches versus Toggles

Continuous Deployment

Continuous Build

Relentless Improvement

Test Coverage

Mutation Testing

Semantic Stability

Cleaning

Creations

Maintain High Productivity

Viscosity

Managing Distractions

Time Management

Chapter 14 Teamwork

Work as a Team

Open/Virtual Office

Estimate Honestly and Fairly

Lies

Honesty, Accuracy, Precision

Story 1: Vectors

Story 2: pCCU

The Lesson

Accuracy

Precision

Aggregation

Honesty

Respect

Never Stop Learning

Index