Wooohooo - River Wye Springer

Woooohoooo. I've caught my first River Wye Springer. Thirty-four inches long, nineteen inches fat, eighteen pounds exactly. I caught it on the Monument pool of the Tunnel beat on a green and yellow devon minnow (a technique I'd never used before). Huge thanks to my friend Steve Roberts for skilfully guiding me.


Before setting off for this fishing trip I'd been stumped on a cyber-dojo fault which eluded me for the best part of a day. After the trip, I cracked it within five minutes. So you see, fishing fixes faults!

nordevcon cyber-dojo presentation

It was a pleasure to speak at the recent norfolk developers conference. My talk was "cyber-dojo: executing your code for fun and not for profit". I spoke about cyber-dojo, demo'd its features, discussed its history, design, difficulties and underlying technology. Videos of the talk are now on the infoq website. The slide-sync is not right at the start of part 2 but it soon gets corrected.

code and test oppose each other

I was reading one of Michael Feathers excellent blog posts on Symbiosis. His writing really resonates with me. As I get older I feel I'm starting to get a handle on thinking about things more dynamically and less statically. Looking back, if I had to pick the one thing that helped me the most on this road I would say its Le Chatelier's Principle, which I paraphrase as "Systems tend to oppose their own proper function". As I recall, Le Chatelier was a chemist and his principle is worded in the context of chemical reactions. The same fundamental "system of opposition" is also described in Walter B. Cannon's classic book The Wisdom of The Body which I first learned about in Jerry Weinberg's book General Principles of Systems Design (p 177). I'd like to try to explain what "systems oppose their own proper function" means using an example from the body. It's called the Glucose Cycle.


If you eat a donut the amount of glucose (sugar) in your blood goes up. If this increase continues unchecked you get hyperglycemia and you die. Fortunately this does not happen because the body is the result of millions of years of destructive testing! Cells in the pancreas detect the glucose increasing and start producing insulin. The liver and muscles detect the insulin increasing and start converting glucose into a stored form (called glycogen). This naturally reduces the amount of glucose and you don't get hyperglycemia.
However...
If the amount of glucose continues decreasing, you get hypoglycemia and you die. Fortunately this does not happen either because other cells in the pancreas detect the glucose decreasing and start producing glucagon. The liver and muscles detect the glucagon increasing and start converting the glycogen back to glucose.

These two effects work in opposition to each other regulating the blood stream glucose.
All this tremendous activity to keep something else constant.
I find it deeply beautiful and deeply paradoxical.


Bradford Keeney writes about this same paradox in his classic book The Aesthetics of Change. An example he uses is evolution. He writes about the battle between a predator and its prey but goes beyond the 'mere' battle for food and territory. He describes a larger cybernetic picture, how the ongoing battle is itself a means or process of generating, maintaining, and stablizing an ecosystem. That evolution is always co-evolution as John Gall said.


This duality suggests that if you want to understand how codebases successfully change you should also understand how codebases successfully stay the same. To quote The Aesthetics of Change again: "Change cannot be found without a roof of stability over its head. Similarly stability will always be rooted to underlying processes of change".

In this light I see test driven development, as much more than simply specifying required behaviour (as important as that is). I see coding and testing working in opposition to each other naturally regulating each other. The ongoing 'battle' between coding and testing, between change and constancy, is itself a primary means of generating, maintaining, and stabilizing the development process.

My instinct tells me good software development is full of processes regulating each other via feedback like this. I'd like to make a collection of them. What's your favourite example? Please tell me. Thanks.

simplicity

From The Aesthetics of Change
All simple and complex regulation as well as learning involve feedback. Contexts of learning and change are therefore principally concerned with altering or establishing feedback.

From Thinking in Systems - A Primer
Complex systems can evolve from simple systems only if there are stable intermediate forms.

From The Systems Bible
A complex system that works is invariably found to have evolved from a simple system that worked.

From Patterns of Software
In the modern era, we have come to favor simplicity over complexity, perfection over imperfection, symmetry over asymmetry, planning over piecemeal growth, and design awards over habitability. Yet if we look at the art we love and the music, the buildings, towns, and houses, the ones we like have the quality without a name, not the deathlike morphology of clean design.

From Safer C
A central and hard-earned engineering principle in older engineering areas such as mechanical engineering and civil engineering is that simplicity rules.

From The Tao of Business
Keeping things simple is an art. And, as with any art, simplicity needs to be cultivated.

From The ACM Turing Award Lectures
I conclude that there are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies. [C.A.R. Hoare]

From The Way of the Leader
The art of leadership is an art based on simplicity, and all success is rooted in performance.

From Extreme Programming Explained
Simplicity supports courage because you can afford to be much more courageous with a simple system.

From Tao Te Ching
Simplicity in conduct, in beliefs, and in environment brings an individual very close to the truth of reality.

From Simplicity
An expert is someone who has succeeded in making decisions and judgements simpler through knowing what to pay attention to and what to ignore. Simplicity means focused effort. Simplicity is a unification around a purpose.

From Simple and Usable
Simple organization is about what feels good as you're using the software, not what looks logical in a plan.

a man called Ove

is the title of an excellent book by Fredrik Backman. As usual I'm going to quote from a few pages:
He felt one should not go through life as if everything was exchangeable. As if loyalty was worthless. Nowadays people changed their stuff so often that any expertise in how to make things last was becoming superfluous. Quality: no one cared about that any more. Not Rune or the other neighbours and not those managers in the place where Ove worked. Now everything had to be computerised, as if one couldn't build a house until some consultant in a too-small shirt figured out how to open a laptop.
'They've bumped up the electricity prices again,' he informs her as he gets to his feet. He looks at her for a long time. Finally he puts his hand carefully on the big boulder and caresses it tenderly from side to side, as if touching her cheek. 'I miss you,' he whispers. It's been six months since she died. But Ove still inspects the whole house twice a day to feel the radiators and check that she hasn't sneakily turned up the heating.
'Now you listen to me,' says Ove calmly while he carefully closes the door. 'You've given birth to two children and quite soon you'll be squeezing out a third. You've come here from a land far away and most likely you fled war or persecution and all sorts of other nonsense. You've learned a new language and got yourself an education and you're holding together a family of obvious incompetents. And I'll be damned if I've seen you afraid of a single bloody thing in this world before now.' ...
'I'm not asking for brain surgery. I'm asking you to drive a car. It's got an accelerator, a brake, a clutch. Some of the greatest twits in world history have sorted out how it works. And you will as well.'
And then he utters seven words, which Parvaneh will always remember as the loveliest compliment he'll ever give her.
'Because you are not a complete twit.'
Men like Ove and Rune were from a generation in which one was what one did, not what one talked about.
Ove has probably known all along what he has to do, but all people are time optimists. We always think there's enough time to do things with other people. Time to say things to them. And then something happens and then we stand there holding on to words like 'if'.
'But serious, man. You do this every morning?' Jimmy asks cheerfully.
'Yes, to check if there have been any burglaries.'
'For real? Are there a lot of burglaries round here?'
'There are never a lot of burglaries before the first burglary,' Ove mutters and heads off towards the guest parking.
'There is no hope for these boys and girls,' the headmaster soberly explained in the interview. 'This is not education, this is storage.' Maybe Sonja understood how it felt to be described as such. The vacant position only attracted one applicant, and she got the boys and girls to read Shakespeare.


fishing and refactoring: A story with two endings

The Happy Ending

I'm salmon fishing on the River Spey, on the beautiful Tulchan beat, concentrating on spey casting. My phone is back at the hotel. My laptop is back at the hotel. I'm not thinking about coding. I'm fishing and I'm only fishing. Suddenly, from "nowhere" my subconcious pops an idea up into my consciousness. It says, hey, you know that code you were working on 2 weeks ago...? Where you had that nagging feeling there was a better, simpler solution? I know you know what I'm talking about! We'll I've been working on that for you. And I've come up with this. Here's the idea. Tada. What do you think?

For a moment, I think about the idea. It seems a good one. Of course, I can't try it out now because I'm waist deep in the middle of the River Spey. I promise myself I'll look into it when I get back to the hotel. I carry on trying to catch a salmon.

Later, back at the hotel I try out the new idea. I re-run all the unit tests and they pass. I make the change.

A few weeks later I'm fishing again. This time on the River Tay at Dunkeld. My subconscious pops up a new idea. I make a note of it. In the evening, back at the hotel I try the change. All the tests pass. The change is live.

A few weeks later I'm fishing again. On the River Verdal in Norway. My subconscious pops up with another new idea...


The Sad Ending

I'm salmon fishing on the River Spey, on the beautiful Tulchan beat, concentrating on spey casting. My phone is back at the hotel. My laptop is back at the hotel. I'm not thinking about coding. I'm fishing and I'm only fishing. Suddenly, from "nowhere" my subconcious pops an idea up into my consciousness. It says, hey, you know that code you were working on 2 weeks ago...? Where you had that nagging feeling there was a better, simpler solution? I know you know what I'm talking about! We'll I've been working on that for you. And I've come up with this. Here's the idea. Tada. What do you think?

For a moment, I think about the idea. It seems a good one. Of course, I can't try it out now because I'm waist deep in the middle of the River Spey. I promise myself I'll look into it when I get back to the hotel. I carry on trying to catch a salmon.

Later, back at the hotel I think about the new idea. I'm wary of making the change. There are no unit-tests I can quickly run. I'm remembering a few months back - that time when I tried an idea and broke stuff and was castigated. I'm fearful of making the change. I don't make it.

A few weeks later I'm fishing again. This time on the River Tay at Dunkeld. My subconscious gives me a new idea. I make a note of it. In the evening, back at the hotel I think about making the change. There are still no unit-tests. And I'm still remembering that time a few months back - when I tried an idea and broke stuff. Boy was I ridiculed. And if anything the culture is a bit worse since then. I can feel the fear. Once again I decide not to make the change.

A few weeks later I'm fishing again. On the River Verdal in Norway. This time, my subconscious doesn't pop up a new idea.