Before we can make the case that microtest TDD is an effective change strategy, there's a few high-level aspects of it that we need to highlight. We tend to take these for granted in our case, but newcomers won't already know them.
More even than before, geekery seems irrelevant. We're living the natural outcome of a politics of hatred & deceit. This content is one way I find respite, and maybe it will help you a little, but...

Stay safe. Stay strong. Stay anrgy. Stay kind.

Black Lives Matter.
Today, I'm writing for the newcomer. It's going to be a little rambly, because the ideas aren't partitioning a single conceptual level into its component parts. Think of me as going over a text with a yellow highlighter, bringing out some points newcomers might not readily see.
Twinning: When we do TDD, we are working in a single textual codebase that we use to produce two entirely separate applications, each serving a different purpose. The one app will be the one we ship. The other app will be a primary tool for producing the first app more quickly.
The two apps, let's call them the shipping app and the making app, use many of the same parts of that textual base. Normally, the making app uses a superset of the parts of the shipping app. But these parts are combined and arranged and used in significantly different ways.
The shipping app uses its parts to make a program that users can do domain stuff with: accounting, content-management, machine control, graphics, and so on. Back in the '80s, cavemen like myself worked only & entirely with the shipping app, and its parts were all the parts.
The making app takes those same parts, plus others, to make a program that developers can do developer stuff with: primarily, taking the same parts the shipping app uses, exercising them in isolation, and telling us whether or not they do what what we wanted them to do.
Tho the shipping app could be doing practically anything, the making app really just does one thing: put a shipping part under the microscope, exercise it, and tell us about it.
That's handy, because it means we can use the same "other parts" we mentioned, over & over, w/o a lot of custom code. We don't write a brand new making app for every shipping app, but primarily use the same pre-fab making-app-parts from one to the other.
The most notable differences between the making app and the shipping app are these: 1) the making app is *fast*. 2) the making app's interface is tightly tuned to its purpose. 3) the making app is based on a small well-defined library or framework that we don't re-roll each time.
The making app, by the way, runs right on the developers box, regardless of where the shipping app runs. In fact, most grown-up development environments know how to run that app and show its results right out of the box.
Alternation: For each (interesting) part of the shipping app, the developer defines a corresponding part of the making app. During development, the developer is continuously bouncing her focus back and forth between these two parts, one from the shipping app, one from the making.
The developer-added parts of the making app are sets of tests. They are short triplets of code of the form [arrange,act,assert]. Arranging puts the shipping part on a slide in a known state. Acting tells that shipping part to do something. Asserting sees what it does in response.
Alternation between the making part and the shipping part is so frequent and well-defined that, again, most grown-up development environments use a single keystroke to flip back and forth.
Isolation: The shipping app arranges parts in what we call a dependency graph, with one part depending on another, and it depending on others, and so on. It never violates those dependencies. The making app actively seeks to isolate each shipping part from its dependency graph.
Isolation of parts is critical to the usefulness of the making app, and it's one of the hardest ideas for newcomers to wrap their head around. Failures to grasp this idea are a primary cause of TDD adoption failures.
This isolation is why the making app runs so fast, which adds to its usefulness, but it's also why the making app is precisely informative, which is the essence of its usefulness.
There are myriad techniques for achieving the isolation, and isolation is normally used only selectively. There is no formula for the right amount of isolation, which means that humans have to use their judgment to decide. This is why mastering TDD takes time.
Iteration: The microtests in making app and their subjects in the shipping app are developed interactively over time. We don't sit down and write the tests then sit down and write their subjects. We don't sit down and write their subjects, then sit down and write their tests.
TDD is "test a little, code a little, test a little, code a little", iterated over and over again. TDD style is inherently evolutionary, incremental, and iterative.

When it's going well, these TDD iterations are quite short in duration: just minutes for each cycle.
It is possible to test too much without coding enough, or to code too much without testing enough. TDD'ers have specific advice & suggestions for keeping those parts in balance.
One aspect of all this that troubles newcomers: the tests themselves change during the iteration, and not just by addition. It's not uncommon to have to make a change to a test you already wrote and passed, because the subject has changed its behavior or its interface.
We've no room to go into how & why this local inefficiency translates directly into global efficiency. But it does, and we'll see a few hints of how it works when we get to the real case.
Indirection: Microtest TDD does not directly prove that the shipping app is what the customer wanted, or even that it works. It indirectly establishes the base from which we are more likely to achieve those goals: it proves the shipping parts do what the developer thinks they do.
This is the Pieces Premise said another way, really. What we're saying is that, to satisfy the customer we have to put shipping parts together in the right way to do the right thing. If the shipping parts don't do what we think they do, we'll never get to satisfying the customer.
I've learned many things doing TDD these twenty years, but one of the most startling things I learned is this: the *overwhelming* majority of software defects come from simple one-liner brain-o events.
Programmers translate ideas from their minds into highly structured highly detailed imperative text. This kind of work is fraught with opportunities for the most trivial sorts of mistake.
These are *exactly* the kind of mistake that we, when we're speaking & hearing, work around rapidly at seemingly no cost. That's our humanness at work. But they are also *exactly* the kind of mistake that computers aren't capable of working around.
And that is why we need to prove first that our code does what *we* want it to, before we determine whether it does what *they* want it to.
Okay, in conclusion, that was as predicted, a bit of a ramble. But I felt we needed just a little more thickness to our description of TDD before we lay out how it represents an effective strategy for change.
The ideas of Twinning, Alternation, Isolation, Iteration, & Indirection are laced through the actual practice of TDD, as opposed to any simple psuedo-algorithm for doing it. I wanted to convey a sense of the *feel* of it.

Next stop: How microtest TDD works as a change-strategy.
Do you like my content? Show me the love in two ways.

1) Subscribe. It's free, spam-free, full-text or audio, and it helps me.

geepawhill.org/subscribe

2) Get out there & change things, inside and outside the trade.

Black Lives Matter, and we need to act like it.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with GeePaw Hill

GeePaw Hill Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @GeePawHill

11 Jan
I got one of those messages I sometimes get from a reader, telling me that including my politics in my muses/blogs is off-putting.
As a general rule, I don't bother to respond to these. I gain and lose followers all the time, everyoen who makes content does, for all sorts of reasons, and that's just one more.
Today, though, surrounded by <waves hands> all of this, I feel like I want to give a more full statement on the matter.

So.
Read 15 tweets
11 Jan
ONI: Off to bed at 11, so I gotta little bit of time, and doomscrolling is breaking my heart. I accidentally walked away and left things running for five hours, so we're back at c380. <sigh>.
Well, glass half full and all: I wasn't happy with the oil wells anyway. I need a rig that doesn't dump steam. I thought this was a matter of gas pressure, but I misunderstood: It's actual cooling. Since I get a free do-over anyway, I'm going to finally use that cold ph2o cache.
I am going to use a switching loop this time: run a pipe through all three wells with the cold ph2o, but have it on an inline thermo sensor, and let it loop through them until around 80c, then dump it to o2 supply. That oughta do it, but it may take a while.
Read 4 tweets
10 Jan
Sippie Wallace, w/Albert Ammons and his Rhythm Kings, "Bedroom Blues".

Wallace was famous at the time, but was made more famous by Bonnie Raitt's covers of her. Ammons was not just a *killer* pianist, he was also an excellent band-leader, who wanted his players to shine.
I sometimes admire a pianist for having a left hand as strong as the right, but with Ammons his gift was that his right hand was as strong as his left. I got takes, kids, serious takes, that make a person gasp.
Read 4 tweets
10 Jan
Oh.

This is called "Life in a Northern Town". It's by Dream Academy.

I mean, idunno, sometimes ya ring a bell. And if you ring the bell one time in your whole career? Well. You know what, you rang the fucking bell, dint you?
I bought the collected William Carlos Williams, and I put it in the bathroom. And I read it, all of it.

He rang the bell a dozen times.

Can you imagine that? To ring it *twice*, to ring it more, to ring it and ring it?

I can't.
Read 4 tweets
10 Jan
The rural population of the United States has held at 50-60m people for sixty years. They were a third of us in 1960, and they're just over a fifth of us today.
Did ignorant, misled, wrongly angry white people elect Trump, aided by his many enablers who believe ends justify means?

Yes.

But it's a dreadful over-simplification to suggest that ignorant country people can account for 74 million votes.

You might wanna check yourself.
If every single rural voter in America was pro-Trump, a laughable notion, they could not possibly have made him competitive. Even with gerrymandering, even with the electoral college.
Read 7 tweets
9 Jan
ONI: c404. The sky is 100% sealed with bunker doors. I've started to recover from the steel push, and have 3.5t of it. The three oil wells are capped & tapped "ish", as you can see.
Oil wells are a pain in the ass, but they're valuable, at 3kg/s of oil. The problem: they're often submerged, and when you unload them, you get steam, unless they're in >2k gas pressure. That one on the left is still WIP, and I *just* got the one on the right cleaned out.
It's energy-positive tho, once stabilized. 10kg/s of oil = 5kg/s of petroleum = 2.5 petroleum generators = 4kw per second. Even all tricked out with separate pumps the way I have it, that's a lot of net+
Read 5 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!