Index

A

Abstraction

clarifying levels of, 201

Dijkstra’s development of, 317319, 320

polymorphism for, 225

stepdown rule for, 202

underlying, 235236

Acceptance tests, 14, 18, 246249

Accidental duplication, 237238

Accounting, 2022, 23

Accurate estimates, 360361, 365367

Ada, Countess of Lovelace, 5, 280. See also N345TS

Adaptability, inexpensive, 256257

Ader, Clément, 2

Aeronautics, 14

Aggregate estimates, 369370

Agile methods

readiness via, 258, 259

story points, 275

test automation via, 226

XP as, 14

ALGOL, 6, 7, 282

Algorithms

bowling game scoring, 6279

bubble sorting, 8287

to find prime factors, 5262

incremental derivation of, 61, 82, 86

integer stacking, 3652

proving correctness of, 316323

quick sorting, 9495

sine calculation, 127138

text wrapping, 95103

video store rentals, 164183

API function, 269

Architecture, 143145

Arrange/Act/Assert test pattern, 103104, 247, 267

Authenticator interface, 111

Automated tests, 246, 267269, 340

Automatic Computing Engine (ACE), 6, 280

B

Babbage, Charles, 45, 280

Backus, John, 6, 282, 333

Balance, 20

Beck, Kent

design principles of, 226, 239

Extreme Programming, 14

on making it right, 306

on refactoring, 219

on simple design, 224, 228

Behavior

anticipating, 300

refactoring to preserve, 199

vs. structure, 72, 303304, 307, 311

Behavior-Driven Development (BDD), 104105, 107

Bergensten, Jens, 289

Best work, 306315

Boeing, 4

Boundaries, 143144

Bowling score computation, 6279, 104, 203

Branches, toggles vs., 338340

Bubble sort algorithms, 87, 164

Bugs. See also Debugging

accumulation of, 314

as found by QA, 266, 267

quick patches for, 302

quick tests for, 218

as unacceptable, 264

Builds

continuous, 249, 341342

speeding up, 347348

Business analysis (BA) teams, 246, 248

Business rules

decoupling databases from, 148

isolated from tests, 268269

testing the, 150

user interface vs., 141, 142

C

C language, 284

Cascading Style Sheets (CSS) code, 255256

Catastrophes, 291293

Cayley, Sir George, 2

CCU-CMU, 364

Certainty

cost of, 358, 370

fragile tests and, 139, 140

London school of, 141

Changes

fear of making, 3132, 219, 263

inexpensive, 256257, 262

keeping up with, 373374

learning to prepare for, 277

as software necessity, 303304, 307

to user interface, 268

via git, 335

via good structure, 308310

Chicago school of TDD, 142

Chief Technical Officer (CTO), 252

Church, Alonzo, 5, 62

Circle of Life, 1415

Clean Agile (Martin), 358

Clean Architecture (Martin), 143, 145

Clean Code (Martin), 198

Clean Craftsmanship (Martin), xxv–xxvi

COBOL, 282, 283

Code

building blocks of, 321

cleaning of, 3234, 306, 342, 345

decoupled, 3031, 232

decoupling tests from, 161184, 218, 232

designing testable, 30

do no harm to, 302303

early example of, 233

expressive, 233235

fear of broken, 3132, 219

fragile tests and, 160161

by the inexperienced, 910

proving correctness of, 316323

structural vs behavioral changes, 72

test and code communication, 236

test coverage of, 230

two schools of TDD, 140142

Coding

history of, 280286

specific tests for generic code, 59, 82, 183184

test suite holes, 2829

and three laws of TDD, 2326

transformations, 185

Collaborating components, 144145

Collaborative programming

discipline of, 242244

improvement via, 356

remotely, 357

to replace yourself, 272, 273

as XP practice, 14, 1718

COLT (Central Office Line Tester), 361

Commitments, 368369, 370372

Competence, fearless, 263264

Compilation tests, 3652

Complexity, incremental, 92

Components, 144145

Computers

history of, 49, 280286

in pop culture, 287

Concurrent Versions System (CVS), 333, 334, 336

Constant to variable transformation, 187188

Continuous build, 249, 341342

Continuous integration, 337

Continuous learning, 277278, 373374

Controllers

in component hierarchy, 144145

and GUI input tests, 153154

in Humble Object test pattern, 159

testing, 153

Countess. See Ada

Coupling. See also Decoupling

fragile test problem and, 139

high- and low-level details, 152, 218, 224225

minimizing, 184

one-to-one, 161162

Courage, 271278

Coverage, test, 229231, 239, 343344

Craftsmanship

in the aeronautics industry, 4

defined, xxi–xxii

as developer responsibility, 303

foundation disciplines of, 1418, 293

history of computer, 49

by programmers, 910

provable code as, 324325

Craig, Philip, 108

D

Dahl, Ole-Johann, 283

Database testing, 148150

DaVinci, Leonardo, 2

Debugging

avoiding, 199

commitment to total, 264, 266

minimizing, 2627

by QA, 265267

speeding up, 349

Decidability problem, 62

Decision matrix, Eisenhower’s, 310312

Decision problem, 280

Decomposition, functional, 322323

Decoupling

code, for testability, 232

databases, 148

high- and low-level details, 236, 308

importance of, 224225

production code/test, 161184, 218

Degenerate tests

solutions via, 8384, 9899

stairstep tests as, 66

as TDD rule, 5354

Dependencies

dependency inversion principle, 143

eliminating unnecessary, 112113, 114

management of, via SOLID, 309310

with production data, 116

Dependency Rule, 144145

Deployment

and best work, 307

continuous, 340341

readiness for, 258

speeding up, 349

for startups, 304305

and structural changes, 308

Derivation, incremental. See Incremental derivation

Design

changes to, 232

four principles of, 239

fragility as problematic, 160161

high test coverage, 230232

holes, 2829

minimal size in, 239

outside-in vs. inside-out, 141142

prompt fixing of flaws, 7071

simple, 17, 224226, 228229

smells, 308, 309

test design, 160184

YAGNI, 226228

Development, test-driven. See Test-driven development (TDD)

Digital Equipment Corporation, 284

Digital switching, 364

Dijkstra, Edsger, 7, 282, 316323

Diophantine equation, 62

Disciplines

acceptance tests, 18, 248249

Alan Turing on, 281

in Clean Craftsmanship, xxv

collaborative programming, 1718

failing at, 255, 256

focus and, 13

refactoring, 16, 217221

self- vs. other-imposed, xxv

simple design, 17

test-driven development (TDD), 1516

YAGNI, 227

Distractions, managing, 349354

Double-entry bookkeeping, 2022

Dummies, 111114

Duplication

accidental, 238

duplicate tests, 66

minimizing code, 237238

E

Eisenhower’s decision matrix, 310312

Elements variable, 47, 51

Emotional stress, 351

“Endo-Testing: Unit Testing with Mock Objects” (Freeman, McKinnon, Craig), 108

Engineering practices, 14

Enigma machine, 5

Entangled software, 224

Enumeration, 317, 321

Errors, 70, 71

Estimates, honest and fair, 274275, 358372

Ethics

in Clean Craftsmanship, xxvi

oath of, 293

single vs. multiple, xxii

Expectations, 252

Explanatory variables, 204

Exploratory testing, 267

Expressivity

code language for, 233234

as design principle, 239

and real vs. accidental duplicates, 238

role of code and tests in, 236

External services, 108, 110

Extract Field refactoring, 204216

Extract Method refactoring, 68, 201202, 208

Extract Superclass refactoring, 214

Extract Variable refactoring, 202204

Extreme Programming Explained (Beck), 228

Extreme Programming (XP), 1314, 219, 226, 258

F

Factors variable, 5455

Failure tests

algorithms via, 82

input/output (IO), 108

for integer sort algorithm, 83

in integer stack example, 3652

multiple solutions to, 88

in prime factors example, 5262

Fakes, 124126

Fear

of broken code, 3132, 219

fearless competence, 263264

Fibonacci kata, 191194

Finite state machines, 105107

First-in-last-out (FILO) behavior test, 50, 52

FitNesse, 247, 337

Flaws, design, 7071

Flexibility, 141, 142, 345

Flight, history of, 14

Flow, the, 352

Fortran, 282, 319320

Fowler, Martin

Chicago school of TDD, 142

on refactoring, 164, 198, 221

on simple design, 229

Fragile tests

certainty and, 139, 140

as design problem, 160161

mocks and, 139140

refactoring to prevent, 218

test specificity to prevent, 59, 232

user interface links and, 268

Fragility, software, 308

Freeman, Steve, 108, 141

Fun, 30

Functional decomposition, 322323

Functional programming, 62, 196

Functions

extract refactoring of, 201

function to nil transformation, 186187

harm to, 299301

minimizing size of, 239

misplaced responsibility of, 71

replacing comments with, 75

testing query, 148150

tests as constraining, 127

tests tied to implementation of, 120

uncertainty principle in, 132

and underlying abstraction, 235

vs. cleaning code, 306

G

Gateway interface, 149

Generalization, 59, 183184

Generic code, 59

Git, 334336

Git reset —hard, 220

Given-When-Then (GWT), 104, 105, 248

Goethe, Johann Wolfgang von, 21

GOTO statements, 320, 321, 322

Green step

as transformative, 185

in video rental algorithm, 165, 166, 167, 169, 173

GUI (graphic user interface)

inputs, 153154

testing, 150153

H

Haines, Corey, 229

Handwashing, 1213

Harm, do no

to function, 299301

to society, 296297

to structure, 302303

via easy changeability, 303304

via tests, 305306

HealthCare.gov, 297298

Hendrickson, Chet, 224

History of flight, 14

Honest estimates, 274275, 360364, 370372

Hooks, 226, 227228

Hopper, Grace, 6, 282

Horn, Michael, 289

Humble Object pattern, 157160

I

IBM, 6, 7, 282, 283

If statements, 58, 60, 202

Immobility, 309

Implement Interface command, 114

Implementation, function, 120

Improvement, continuous, 262, 342346

Incremental derivation

as solution to getting stuck, 95, 98

solving failing tests as, 86

TDD as technique for, 61, 82

writing tests via, 103

Induction, 317, 321

Inflexible software, 256257

Inside-out design, 142

Integration tests, 182183

Integrity

via high productivity, 346354

via relentless improvement, 342346

via small cycles, 328342

Interactors

in component hierarchy, 144145

GUI, 152, 154

Iteration, 321

J

JBehave, 104

Jennings, Jean, 282

JUnit Recipes (Rainsberger and Stirling), 154

K

Keogh, Liz, 105

Knight Capital Group, 299300, 302

Koss, Bob, 6279

L

Languages

continuous learning of, 277, 373374

expressive code, 233234

first programming, 7, 282284

Law of trichotomy, 89

Learning

continuous, 277278, 373374

from mentors, 278, 286

via cleaning code, 345

Lies, estimates as, 359

Login test, 348

London school of TDD, 141

Loops, unwound, 57

Lovelace, Countess of, 5. See also Ada

M

MacKinnon, Tim, 108, 120

Managers

commitments to, 370372

emotional confrontation by, 276

information for, xxvi

perspective of, 252

Manual testing, 267, 270

Marick, Brian, 305

Matz, Chris, 104

McCarthy, John, 282

Mean and sigma, 365367

Meetings, 350

Memory, core, 6

Mentoring, 278, 286

Merges, 332, 334, 336, 337

Meszaros, Gerard, 110, 154

Minimizing size, 237, 239

Misplaced responsibility, 71

Mob programming, 242, 244, 357

Mock objects

defined, 109

fragility of testing with, 139

in test doubles, 108110, 121123

when to use, 126

Mojang, 289

Mood, 351

Music, 350351

Mutation testing, 344

N

Nil to constant transformation, 187

“No,” saying, 276, 371

North, Dan, 104

N345TS. See Ada

Nygard, Kristen, 283

O

Object-oriented models, 64

One-to-one correspondences, 161162, 218

Open offices, 356358

Optimistic locking, 333

Outside-in design, 141

P

Pair programming, 242, 244, 352, 357

Parent-child algorithms, 299

Patterns, test, 155160

Perspective, 252

Pessimistic locking, 334

Polymorphism, 110, 225

Pomodoro technique, 242, 352354

Power Peg code, 299, 302

Precise estimates, 360361, 367369

Presenters

in component hierarchy, 144145

defined, 151

GUI, 151152

in Humble Object test pattern, 157159

Pride, 3334

Prime factors algorithm, 5262, 185

Probability distributions, 365

Procedural Programming, 62

Production data, 116

Production releases, 340

Productivity

high, 346354

inexpensive adaptability in, 256257

perpetual readiness in, 258259

quality standard for, 254256

stable, 259260

Program Evaluation and Review Technique (PERT), 369370

Programmer tests, 182

Programmers

continuous improvement by, 262

as craftsmen, xxi

demographics of, 284286

Edsger Dijkstra, 316323

as heroes and villains, 289290

history of, 59, 280286

inexperience of, 910

as nerds and saviors, 287288

one path for, xxii

perspective of, 252

pop culture depictions of, 287288

responsibility of. See Responsibility

senior, 297

senior/junior partnerships, 244

as stakeholders, 312313

teaching new, 278

undisciplined, 256

Programming

collaborative, 1718, 242244, 356

decidability problem in, 62

as finite state transitions, 107

functional, 196

history of, 280286

London school of, 141

modular, 330332

procedural and functional, 62

structured, 319322

Proof, repeatable, 316

Property testing, 140

Pryce, Nat, 141

Public class stack, 3652

Public trust, xxiv–xxv

Push function, 41

Q

Quality

continuously improved, 262

definition of poor, 255

extreme, 264

fearless competence on, 263264

readiness for QA review, 265267

test automation, 267269

testing the user interface, 269270

Quality assurance (QA) department

acceptance test readability by, 246

readiness for review by, 265267

tests by, 248

Queries, testing, 148150

Quick sort algorithm, 9495

Quick tests, 218, 324

R

Rainsberger, J.B., 154

Readiness, 258259

RealAuthenticator, 111112, 116

Recursion, 100

Red/Green/Refactor loop

cleanup via, 39

as continuous, 219

as fourth TDD law, 3435

as functional decomposition, 323

moral foundation for, 312

as refactor cycle, 199

transformative priorities and, 185

Red step

as additive, 185

in video rental algorithm, 165, 166, 168169, 172

Refactor step

as restorative, 185

in video rental algorithm, 165166

Refactoring

basic toolkit for, 200217

basis of, 232233

cleaning as, 345

code generalization via, 184

consistent, 219

defined, 72, 199

disciplines of, 16, 217221

as fourth TDD law, 3435

and fragile tests, 139

IDE’s Extract Method, 68

Red/Green/Refactor loop, 3435, 39, 185

restorative, 185

as Rubik’s cube solutions, 215

in video rental algorithm, 164183

vs. placing hooks, 227

as XP practice, 14

Refactoring (Fowler), 198, 221

Remote work, 357

Rename refactoring, 200201

Respect, 372373

Responsibility

and collaborative programming, 243

of continuous learning, 374

to do no harm, 296303

misplaced, 71

of programmers, 290293, xxiv

recognition of, 306

to replace yourself, 273

single responsibility principle, 201, 214

of software developers, xxiv

as a stakeholder, 312313

Revision Control System, 333

Rigidity, 308

Ritchie, Dennis, 284

Rochkind, Marc, 333

Role Models, 289

RSpec, 104

Rubik’s cube, 215

S

Science, software, 323324

Scrum, 258

Selection, 321

Selection to iteration transformation, 190

Self-Shunt pattern, 156

Semantic stability, 344345

Semmelweis, Ignaz, 13

Sequence, 321

Setup method, 103

Short cycles, 334336

Sieve of Eratosthenes, 53, 61

Sigma, 366, 369

Simplicity

design, 14, 17, 224226

fundamental aspect of, 235

incremental derivation, 61, 82, 86

rule of test, 9596, 103

via expressive language, 233234

via technology advances, 227

Simula 67, 7, 283

Sine calculation, 127138

Single responsibility principle, 201, 214, 239, 246

Small cycles, 328342

Smalltalk, 108

Society

dependence on software, 9, 291, 306

harm to, 297298

responsibility to, 292

views on programmers, 286288

Software

catastrophes, 291293

changes to, 224, 226, 303304

failed estimates on, 358

GUI, 150151

invention of, 5

messy, harmful, 302

pervasiveness of, 290291

proofs, 316323

public trust in, xxiv–xxv

rigid, fragile, immobile, 256, 308309, 345

as a science, 323324

similarity to accounting, 23

tests as documentation of, 2628

untangled, 224

SOLID principles, 17, 143, 309310

Sorting algorithms

bubble sort, 8287, 95

quick sort, 9495

Source code

continuous build of, 249

control, 328334

dependencies, 143, 153, 225

editors, 237

harm to, 303

Source Code Control System (SCCS), 333

Specificity, 183184, 202

Spies

fragility of testing with, 138, 139

mocks as, 121

in sine calculation algorithm, 133135

in test doubles, 118120

for testing across boundaries, 144

Stabilization sprints, 258

Stack of integers, writing a, 3652

StackTest, 37

Stairstep tests, 66

Stakeholders, 312313

Standards

in Clean Craftsmanship, xxvi

courage, 271278

defined, 252

differing perspectives on, 252

productivity, 253260

provable code, 324325

quality, 261270

responsibility and, xix

single vs. multiple, xxii

Startups, 304

State/Transition diagram, 105106

Statement to recursion transformation, 189190

Stepdown rule, 202

Stevenson, Chris, 104

Stirling, Scott, 154

Story points, 275

Structure

behavior vs., 303304, 307, 311

and collaborative programming, 244

duplication and, 237

good, 308310

harm to, 302303

Structured programming, 7, 319323

Stubs

and business rule isolation, 269270

spies as, 118119

in test double process, 115117

Subversion, 334

Subway turnstiles, 105106

Sullenberger, Chesley, 4

Surviving mutations, 344

T

Taylor series, 128, 130, 132133

Teamwork

collaborative programming, 242244

continuous integration and, 337

covering for each other, 272

honest/fair estimates as, 358372

knowledge sharing via, 356

open/virtual offices, 356358

respect, 372373

Technological advances, 227228

Teradyne, 361

Test doubles

boundary crossing and, 144

dummies, 111114

fakes, 124126

mock objects, 108110, 121123

spies, 118120

structure of, 109110

stubs, 115117

Test-driven development (TDD)

algorithm simplicity via, 6162, 7879

Arrange/Act/Assert pattern in, 104

BDD as, 105

benefits of, 2634

continuous integration and, 337

as design technique, 312

documentation in, 2628

as double-entry bookkeeping, 23

examples, 3679

as foundational discipline, 14, 1516

four laws of, 2335

fragile test problem and, 160161

getting stuck with, 95103

incremental complexity in, 92

long-term mastery of, 148

necessity for, 305306

proofs of, 323325

test suite holes, 2829

two schools of, 140143

uncertainty principle, 126139

Test-Specific Subclass pattern, 155156

Tests

acceptance, 18, 246249

Arrange/Act/Assert pattern, 103104

assertions and spy behavior, 123

automated, 246, 267269, 340

code and test communication, 236

continuous running of, 249

coverage by, 229231, 239, 343344

for databases, 148150

decoupling production code from, 161184, 218

degenerate, 5354, 57, 66

deleting stairstep, 66

design of, 160184

excluding production data from, 116

as finite state transitions, 107

fragile, 59, 139140, 160161

functions constrained by, 127

for GUIs, 150154

historic, 226

integration, 182183

mutation testing, 344

patterns, 100, 155160

to prevent harm, 305306

programmer, 182183

as refactoring discipline, 218, 219220, 221

rule of simplicity for, 9596

semantic stability of, 344345

specificity of, for generic code, 59, 82, 183184

speeding up, 348349

streamlining, 113

as theories, 323

transformations for passing, 184196

vs. placing hooks, 227

written by/for BA and QA, 248249

Thompson, Ken, 284

ThoughtWorks, 142

Tichy, Walter, 333

Time management, 352354

Toggles, branches vs., 338340

Toyota, 300301, 302

Transformation priority premise, 195196

Transformations, 184196

Transistors, 6

Transition triplets, 106

Traversal code, 237238

Trim call, 101

Turing, Alan, 56, 62, 280281

U

UML diagrams, 64, 73, 144

Uncertainty principle, 126139, 140

Unconditional to selection transformation, 188189

Underflow exceptions, 47

UNIX, 284

Untangling software, 224

Unwound loops, 57, 60

User interface

and the Chicago school, 142

and the London school, 141

product as changed via, 304, 308

and test automation, 268269

testing the, 269270, 348

User perspective, 252

V

Vacuum tube computer, 6

Values

testing, 140

value to list transformation, 189

value to mutated value transformation, 190191

Variables, 202204, 235

View model, 151

Virtual teamwork, 356358

Viscardi, Stacia, xix

Viscosity, 347349

Volkswagen, 289, 296, 297

Von Neumann, Jon, 282

W

Wake, Bill, 103

While statements, 58, 60, 202

Whitehead, Gustave, 3

Work, best, 306315

Work breakdown structure (WBS), 366367

World War II, 3, 5

Wrap call, 100

Wright brothers, 3

X

XRay class, 155

XUnit Test Patterns (Meszaros), 110, 154

Y

YAGNI, 226228

Z

Zuse, Konrad, 5