Index

A

Abstraction

clarifying levels of, 201

Dijkstra’s development of, 317–319, 320

polymorphism for, 225

stepdown rule for, 202

underlying, 235–236

Acceptance tests, 14, 18, 246–249

Accidental duplication, 237–238

Accounting, 20–22, 23

Accurate estimates, 360–361, 365–367

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

Adaptability, inexpensive, 256–257

Ader, Clément, 2

Aeronautics, 1–4

Aggregate estimates, 369–370

Agile methods

readiness via, 258, 259

story points, 275

test automation via, 226

XP as, 14

ALGOL, 6, 7, 282

Algorithms

bowling game scoring, 62–79

bubble sorting, 82–87

to find prime factors, 52–62

incremental derivation of, 61, 82, 86

integer stacking, 36–52

proving correctness of, 316–323

quick sorting, 94–95

sine calculation, 127–138

text wrapping, 95–103

video store rentals, 164–183

API function, 269

Architecture, 143–145

Arrange/Act/Assert test pattern, 103–104, 247, 267

Authenticator interface, 111

Automated tests, 246, 267–269, 340

Automatic Computing Engine (ACE), 6, 280

B

Babbage, Charles, 4–5, 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, 303–304, 307, 311

Behavior-Driven Development (BDD), 104–105, 107

Bergensten, Jens, 289

Best work, 306–315

Boeing, 4

Boundaries, 143–144

Bowling score computation, 62–79, 104, 203

Branches, toggles vs., 338–340

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, 341–342

speeding up, 347–348

Business analysis (BA) teams, 246, 248

Business rules

decoupling databases from, 148

isolated from tests, 268–269

testing the, 150

user interface vs., 141, 142

C

C language, 284

Cascading Style Sheets (CSS) code, 255–256

Catastrophes, 291–293

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, 31–32, 219, 263

inexpensive, 256–257, 262

keeping up with, 373–374

learning to prepare for, 277

as software necessity, 303–304, 307

to user interface, 268

via git, 335

via good structure, 308–310

Chicago school of TDD, 142

Chief Technical Officer (CTO), 252

Church, Alonzo, 5, 62

Circle of Life, 14–15

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, 32–34, 306, 342, 345

decoupled, 30–31, 232

decoupling tests from, 161–184, 218, 232

designing testable, 30

do no harm to, 302–303

early example of, 233

expressive, 233–235

fear of broken, 31–32, 219

fragile tests and, 160–161

by the inexperienced, 9–10

proving correctness of, 316–323

structural vs behavioral changes, 72

test and code communication, 236

test coverage of, 230

two schools of TDD, 140–142

Coding

history of, 280–286

specific tests for generic code, 59, 82, 183–184

test suite holes, 28–29

and three laws of TDD, 23–26

transformations, 185

Collaborating components, 144–145

Collaborative programming

discipline of, 242–244

improvement via, 356

remotely, 357

to replace yourself, 272, 273

as XP practice, 14, 17–18

COLT (Central Office Line Tester), 361

Commitments, 368–369, 370–372

Competence, fearless, 263–264

Compilation tests, 36–52

Complexity, incremental, 92

Components, 144–145

Computers

history of, 4–9, 280–286

in pop culture, 287

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

Constant to variable transformation, 187–188

Continuous build, 249, 341–342

Continuous integration, 337

Continuous learning, 277–278, 373–374

Controllers

in component hierarchy, 144–145

and GUI input tests, 153–154

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, 224–225

minimizing, 184

one-to-one, 161–162

Courage, 271–278

Coverage, test, 229–231, 239, 343–344

Craftsmanship

in the aeronautics industry, 4

defined, xxi–xxii

as developer responsibility, 303

foundation disciplines of, 14–18, 293

history of computer, 4–9

by programmers, 9–10

provable code as, 324–325

Craig, Philip, 108

D

Dahl, Ole-Johann, 283

Database testing, 148–150

DaVinci, Leonardo, 2

Debugging

avoiding, 199

commitment to total, 264, 266

minimizing, 26–27

by QA, 265–267

speeding up, 349

Decidability problem, 62

Decision matrix, Eisenhower’s, 310–312

Decision problem, 280

Decomposition, functional, 322–323

Decoupling

code, for testability, 232

databases, 148

high- and low-level details, 236, 308

importance of, 224–225

production code/test, 161–184, 218

Degenerate tests

solutions via, 83–84, 98–99

stairstep tests as, 66

as TDD rule, 53–54

Dependencies

dependency inversion principle, 143

eliminating unnecessary, 112–113, 114

management of, via SOLID, 309–310

with production data, 116

Dependency Rule, 144–145

Deployment

and best work, 307

continuous, 340–341

readiness for, 258

speeding up, 349

for startups, 304–305

and structural changes, 308

Derivation, incremental. See Incremental derivation

Design

changes to, 232

four principles of, 239

fragility as problematic, 160–161

high test coverage, 230–232

holes, 28–29

minimal size in, 239

outside-in vs. inside-out, 141–142

prompt fixing of flaws, 70–71

simple, 17, 224–226, 228–229

smells, 308, 309

test design, 160–184

YAGNI, 226–228

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

Digital Equipment Corporation, 284

Digital switching, 364

Dijkstra, Edsger, 7, 282, 316–323

Diophantine equation, 62

Disciplines

acceptance tests, 18, 248–249

Alan Turing on, 281

in Clean Craftsmanship, xxv

collaborative programming, 17–18

failing at, 255, 256

focus and, 13

refactoring, 16, 217–221

self- vs. other-imposed, xxv

simple design, 17

test-driven development (TDD), 15–16

YAGNI, 227

Distractions, managing, 349–354

Double-entry bookkeeping, 20–22

Dummies, 111–114

Duplication

accidental, 238

duplicate tests, 66

minimizing code, 237–238

E

Eisenhower’s decision matrix, 310–312

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, 274–275, 358–372

Ethics

in Clean Craftsmanship, xxvi

oath of, 293

single vs. multiple, xxii

Expectations, 252

Explanatory variables, 204

Exploratory testing, 267

Expressivity

code language for, 233–234

as design principle, 239

and real vs. accidental duplicates, 238

role of code and tests in, 236

External services, 108, 110

Extract Field refactoring, 204–216

Extract Method refactoring, 68, 201–202, 208

Extract Superclass refactoring, 214

Extract Variable refactoring, 202–204

Extreme Programming Explained (Beck), 228

Extreme Programming (XP), 13–14, 219, 226, 258

F

Factors variable, 54–55

Failure tests

algorithms via, 82

input/output (IO), 108

for integer sort algorithm, 83

in integer stack example, 36–52

multiple solutions to, 88

in prime factors example, 52–62

Fakes, 124–126

Fear

of broken code, 31–32, 219

fearless competence, 263–264

Fibonacci kata, 191–194

Finite state machines, 105–107

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

FitNesse, 247, 337

Flaws, design, 70–71

Flexibility, 141, 142, 345

Flight, history of, 1–4

Flow, the, 352

Fortran, 282, 319–320

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, 160–161

mocks and, 139–140

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, 322–323

Functional programming, 62, 196

Functions

extract refactoring of, 201

function to nil transformation, 186–187

harm to, 299–301

minimizing size of, 239

misplaced responsibility of, 71

replacing comments with, 75

testing query, 148–150

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, 183–184

Generic code, 59

Git, 334–336

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, 153–154

testing, 150–153

H

Haines, Corey, 229

Handwashing, 12–13

Harm, do no

to function, 299–301

to society, 296–297

to structure, 302–303

via easy changeability, 303–304

via tests, 305–306

HealthCare.gov, 297–298

Hendrickson, Chet, 224

History of flight, 1–4

Honest estimates, 274–275, 360–364, 370–372

Hooks, 226, 227–228

Hopper, Grace, 6, 282

Horn, Michael, 289

Humble Object pattern, 157–160

I

IBM, 6, 7, 282, 283

If statements, 58, 60, 202

Immobility, 309

Implement Interface command, 114

Implementation, function, 120

Improvement, continuous, 262, 342–346

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, 256–257

Inside-out design, 142

Integration tests, 182–183

Integrity

via high productivity, 346–354

via relentless improvement, 342–346

via small cycles, 328–342

Interactors

in component hierarchy, 144–145

GUI, 152, 154

Iteration, 321

J

JBehave, 104

Jennings, Jean, 282

JUnit Recipes (Rainsberger and Stirling), 154

K

Keogh, Liz, 105

Knight Capital Group, 299–300, 302

Koss, Bob, 62–79

L

Languages

continuous learning of, 277, 373–374

expressive code, 233–234

first programming, 7, 282–284

Law of trichotomy, 89

Learning

continuous, 277–278, 373–374

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, 370–372

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, 365–367

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, 108–110, 121–123

when to use, 126

Mojang, 289

Mood, 351

Music, 350–351

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, 161–162, 218

Open offices, 356–358

Optimistic locking, 333

Outside-in design, 141

P

Pair programming, 242, 244, 352, 357

Parent-child algorithms, 299

Patterns, test, 155–160

Perspective, 252

Pessimistic locking, 334

Polymorphism, 110, 225

Pomodoro technique, 242, 352–354

Power Peg code, 299, 302

Precise estimates, 360–361, 367–369

Presenters

in component hierarchy, 144–145

defined, 151

GUI, 151–152

in Humble Object test pattern, 157–159

Pride, 33–34

Prime factors algorithm, 52–62, 185

Probability distributions, 365

Procedural Programming, 62

Production data, 116

Production releases, 340

Productivity

high, 346–354

inexpensive adaptability in, 256–257

perpetual readiness in, 258–259

quality standard for, 254–256

stable, 259–260

Program Evaluation and Review Technique (PERT), 369–370

Programmer tests, 182

Programmers

continuous improvement by, 262

as craftsmen, xxi

demographics of, 284–286

Edsger Dijkstra, 316–323

as heroes and villains, 289–290

history of, 5–9, 280–286

inexperience of, 9–10

as nerds and saviors, 287–288

one path for, xxii

perspective of, 252

pop culture depictions of, 287–288

responsibility of. See Responsibility

senior, 297

senior/junior partnerships, 244

as stakeholders, 312–313

teaching new, 278

undisciplined, 256

Programming

collaborative, 17–18, 242–244, 356

decidability problem in, 62

as finite state transitions, 107

functional, 196

history of, 280–286

London school of, 141

modular, 330–332

procedural and functional, 62

structured, 319–322

Proof, repeatable, 316

Property testing, 140

Pryce, Nat, 141

Public class stack, 36–52

Public trust, xxiv–xxv

Push function, 41

Q

Quality

continuously improved, 262

definition of poor, 255

extreme, 264

fearless competence on, 263–264

readiness for QA review, 265–267

test automation, 267–269

testing the user interface, 269–270

Quality assurance (QA) department

acceptance test readability by, 246

readiness for review by, 265–267

tests by, 248

Queries, testing, 148–150

Quick sort algorithm, 94–95

Quick tests, 218, 324

R

Rainsberger, J.B., 154

Readiness, 258–259

RealAuthenticator, 111–112, 116

Recursion, 100

Red/Green/Refactor loop

cleanup via, 39

as continuous, 219

as fourth TDD law, 34–35

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, 168–169, 172

Refactor step

as restorative, 185

in video rental algorithm, 165–166

Refactoring

basic toolkit for, 200–217

basis of, 232–233

cleaning as, 345

code generalization via, 184

consistent, 219

defined, 72, 199

disciplines of, 16, 217–221

as fourth TDD law, 34–35

and fragile tests, 139

IDE’s Extract Method, 68

Red/Green/Refactor loop, 34–35, 39, 185

restorative, 185

as Rubik’s cube solutions, 215

in video rental algorithm, 164–183

vs. placing hooks, 227

as XP practice, 14

Refactoring (Fowler), 198, 221

Remote work, 357

Rename refactoring, 200–201

Respect, 372–373

Responsibility

and collaborative programming, 243

of continuous learning, 374

to do no harm, 296–303

misplaced, 71

of programmers, 290–293, xxiv

recognition of, 306

to replace yourself, 273

single responsibility principle, 201, 214

of software developers, xxiv

as a stakeholder, 312–313

Revision Control System, 333

Rigidity, 308

Ritchie, Dennis, 284

Rochkind, Marc, 333

Role Models, 289

RSpec, 104

Rubik’s cube, 215

S

Science, software, 323–324

Scrum, 258

Selection, 321

Selection to iteration transformation, 190

Self-Shunt pattern, 156

Semantic stability, 344–345

Semmelweis, Ignaz, 13

Sequence, 321

Setup method, 103

Short cycles, 334–336

Sieve of Eratosthenes, 53, 61

Sigma, 366, 369

Simplicity

design, 14, 17, 224–226

fundamental aspect of, 235

incremental derivation, 61, 82, 86

rule of test, 95–96, 103

via expressive language, 233–234

via technology advances, 227

Simula 67, 7, 283

Sine calculation, 127–138

Single responsibility principle, 201, 214, 239, 246

Small cycles, 328–342

Smalltalk, 108

Society

dependence on software, 9, 291, 306

harm to, 297–298

responsibility to, 292

views on programmers, 286–288

Software

catastrophes, 291–293

changes to, 224, 226, 303–304

failed estimates on, 358

GUI, 150–151

invention of, 5

messy, harmful, 302

pervasiveness of, 290–291

proofs, 316–323

public trust in, xxiv–xxv

rigid, fragile, immobile, 256, 308–309, 345

as a science, 323–324

similarity to accounting, 23

tests as documentation of, 26–28

untangled, 224

SOLID principles, 17, 143, 309–310

Sorting algorithms

bubble sort, 82–87, 95

quick sort, 94–95

Source code

continuous build of, 249

control, 328–334

dependencies, 143, 153, 225

editors, 237

harm to, 303

Source Code Control System (SCCS), 333

Specificity, 183–184, 202

Spies

fragility of testing with, 138, 139

mocks as, 121

in sine calculation algorithm, 133–135

in test doubles, 118–120

for testing across boundaries, 144

Stabilization sprints, 258

Stack of integers, writing a, 36–52

StackTest, 37

Stairstep tests, 66

Stakeholders, 312–313

Standards

in Clean Craftsmanship, xxvi

courage, 271–278

defined, 252

differing perspectives on, 252

productivity, 253–260

provable code, 324–325

quality, 261–270

responsibility and, xix

single vs. multiple, xxii

Startups, 304

State/Transition diagram, 105–106

Statement to recursion transformation, 189–190

Stepdown rule, 202

Stevenson, Chris, 104

Stirling, Scott, 154

Story points, 275

Structure

behavior vs., 303–304, 307, 311

and collaborative programming, 244

duplication and, 237

good, 308–310

harm to, 302–303

Structured programming, 7, 319–323

Stubs

and business rule isolation, 269–270

spies as, 118–119

in test double process, 115–117

Subversion, 334

Subway turnstiles, 105–106

Sullenberger, Chesley, 4

Surviving mutations, 344

T

Taylor series, 128, 130, 132–133

Teamwork

collaborative programming, 242–244

continuous integration and, 337

covering for each other, 272

honest/fair estimates as, 358–372

knowledge sharing via, 356

open/virtual offices, 356–358

respect, 372–373

Technological advances, 227–228

Teradyne, 361

Test doubles

boundary crossing and, 144

dummies, 111–114

fakes, 124–126

mock objects, 108–110, 121–123

spies, 118–120

structure of, 109–110

stubs, 115–117

Test-driven development (TDD)

algorithm simplicity via, 61–62, 78–79

Arrange/Act/Assert pattern in, 104

BDD as, 105

benefits of, 26–34

continuous integration and, 337

as design technique, 312

documentation in, 26–28

as double-entry bookkeeping, 23

examples, 36–79

as foundational discipline, 14, 15–16

four laws of, 23–35

fragile test problem and, 160–161

getting stuck with, 95–103

incremental complexity in, 92

long-term mastery of, 148

necessity for, 305–306

proofs of, 323–325

test suite holes, 28–29

two schools of, 140–143

uncertainty principle, 126–139

Test-Specific Subclass pattern, 155–156

Tests

acceptance, 18, 246–249

Arrange/Act/Assert pattern, 103–104

assertions and spy behavior, 123

automated, 246, 267–269, 340

code and test communication, 236

continuous running of, 249

coverage by, 229–231, 239, 343–344

for databases, 148–150

decoupling production code from, 161–184, 218

degenerate, 53–54, 57, 66

deleting stairstep, 66

design of, 160–184

excluding production data from, 116

as finite state transitions, 107

fragile, 59, 139–140, 160–161

functions constrained by, 127

for GUIs, 150–154

historic, 226

integration, 182–183

mutation testing, 344

patterns, 100, 155–160

to prevent harm, 305–306

programmer, 182–183

as refactoring discipline, 218, 219–220, 221

rule of simplicity for, 95–96

semantic stability of, 344–345

specificity of, for generic code, 59, 82, 183–184

speeding up, 348–349

streamlining, 113

as theories, 323

transformations for passing, 184–196

vs. placing hooks, 227

written by/for BA and QA, 248–249

Thompson, Ken, 284

ThoughtWorks, 142

Tichy, Walter, 333

Time management, 352–354

Toggles, branches vs., 338–340

Toyota, 300–301, 302

Transformation priority premise, 195–196

Transformations, 184–196

Transistors, 6

Transition triplets, 106

Traversal code, 237–238

Trim call, 101

Turing, Alan, 5–6, 62, 280–281

U

UML diagrams, 64, 73, 144

Uncertainty principle, 126–139, 140

Unconditional to selection transformation, 188–189

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, 268–269

testing the, 269–270, 348

User perspective, 252

V

Vacuum tube computer, 6

Values

testing, 140

value to list transformation, 189

value to mutated value transformation, 190–191

Variables, 202–204, 235

View model, 151

Virtual teamwork, 356–358

Viscardi, Stacia, xix

Viscosity, 347–349

Volkswagen, 289, 296, 297

Von Neumann, Jon, 282

W

Wake, Bill, 103

While statements, 58, 60, 202

Whitehead, Gustave, 3

Work, best, 306–315

Work breakdown structure (WBS), 366–367

World War II, 3, 5

Wrap call, 100

Wright brothers, 3

X

XRay class, 155

XUnit Test Patterns (Meszaros), 110, 154

Y

YAGNI, 226–228

Z

Zuse, Konrad, 5