TCR Variant: The Storyteller

This Version of TCR is another Variant of (test && commit || revert). For the others see here. I will add it there as soon as I am convinced, that ‘The Storyteller’ is a good idea.

Note: TCR is new to you? Check out this post, which provides background, context and an example.

tl;dr Instead of just resetting the code, ‘The storyteller’ communicates back in a ‘human’ way so that it feels like a pair works with me remotely on the project.

The Buddy

‘The Storyteller’ is based on the idea of the buddy, described in ‘TCR Variants’. But let me repeat myself:

“How low can you go?” Triggering TCR manually remembers to TDD. But if we want to shorten our feedback-cycle further, we can do more. This approach goes in the direction of Google Docs (what is our holy grail):

while true
do
./tcr
done
$ cat tcr
./buildIt && (./test && git commit -am working || git checkout HEAD — src/main/)

So, why is this called “The buddy”? You have to try it. When you code it is like someone is sitting beside you and as soon he spots an error, he brings you back in a green state. Replace in the example in this post of Fibonacci the plus with a minus. A ghost hand changes it back immediately. With the buddy, you will feel the real spirit of TCR.

The Story Teller: Beyond the Buddy

So we have the scheme

while true
do
build && ( test && commit || revert )
done

The build is just protection from revering the source-code because of typos.

As mentioned in ‘The body,’ programming with this kind of TCR feels as a ghost does pair-programming with you and correct you, if you are wrong.

This ghost can’t speak or communicate with you. It just does something. But what if it could? It would become a human-like pair sitting virtually next to you. How to achieve it?

Communicate in ‘revert’

Revert gets the information what to do from Git and does it. Now comes the extra step, that defines ‘The Story Teller.’ It places the information additionally in text-templates adds some information and communicates all back to the user.

$ cat revert
messageContent = Git.getDiffAndWhatToReset
message = MessageGenerator.generateWith(messageContent)
Git.reset
print message

The resulting message should look like it was from a remote pair programmer. For example:

  • Hey, I recognized an error at line 87 at file Source.java, as I executed the Test ‘testFeatureX.java’. To get in a green state ASAP, I delete the lines, that caused the problems. OK?
  • It seems to work so far. I save the changes and rerun the tests.

This communication can be done in a chat, where I can manipulate the behavior of ‘The Story Teller,’ for example setting another strategy or push the code or over a voice interface (but I expect it becomes annoying after a while — I have to try it!)

The Goal

The Goal is to feel the presence of another “person.”