MY TOP 10 TDD PAYOFFS

These payoffs rely on the assumption that I’ve adhered to the 3 laws of tdd.

Law

Description

1. Start

You must start by writing the test and making it fail.

2. Minimal

You must write the minimal amount of code to pass your failing unit test.

3. Closure

You must stop when the test has passed.

Here’s a quick list of my top 10 TDD Payoffs.

TDD Payoff

Notes

Courage & Change

I can make changes without having to keep track of every step of progress I’ve previously made.

Continuity & Flow

When I’m working off a descriptive unit test I know where I’m at. I can see from the trail of unit tests what I’ve been focused on recently.I can deal with distractions without getting stressed. I don’t need to juggle my work.

Design

Writing unit tests affects the way I write production code. It affects the design of the classes, functions, data structures and properties I create. I encourages me to create easier to read more decoupled solutions.

Testing First & Iteration

Writing my tests first means they actually get done. When I write the tests after I’m done writing the code I tend to only write the primary cases. Working on one unit test at a time means I don’t have to write a large collection of tests after a large dump of code. Iterating through a small test by implementing a small amount of code sounds slow but it means never getting lost in spaghetti dependency.

Communication & Talking

When I talk to colleagues it’s much easier to describe what I’m working on if I can show them a failing unit test

Workflow & Relaxation

Finding an organised way of thinking about my work makes it easier to estimate and express my progress. Using the red, green, refactor loop is an relaxing workflow.

Collaboration & Source control

I find it easier to share the workload if each of my colleagues are working on various unit tests. It’s an easy way to prevent a road block / collision.

Speed & Reduced repetition

TDD is fast. It’s faster that no using tdd. Running unit tests automatically, rather than running firing up the application and testing it manually, makes me infinitely more efficient.

Book keeping

Knowing that something works from two angles is awesome. Double entry book keeping. It’s a universal financial account practice that works well. It’s consider appropriate due diligence.

QA & Professionalism

When QA find an issue I write a unit test that matches their concern and then I fix it. I can track my progress inline with their efforts.

"I know of no better way than to ensure my code works than to practice the 3 laws of test driven development." -Uncle Bob.