kanban push-me pull-you



This is the slide-deck for the presentation I gave at the Lean Kanban UK conference. Many thanks to David for giving me the opportunity and impetus to put some of my thoughts together on this.


adapting

Back to quotes table-of-contents

From The Aesthetics of Change
In the [predator/prey] example, the battle over food and territory between two species is only one half of the story. The larger cybernetic picture is that the battle is a means or process of generating, maintaining, and stablizing an ecosystem.

From Surfing the Edge of Chaos
The defining feature of a complex adaptive system is its ability to learn.

Recent study of evolution, both in the natural world and in computer based complex systems, has demonstrated the surprising result that the presence of parasites in a system accelerates evolution dramatically.

From Growing a Business
Businesses that grow too fast or in the wrong way overwhelm the adaptive capacity of the people who work there.

From Sense and Respond
Adaptiveness… cannot just be added on to an organisation's existing capabilities: the organisation itself must become adaptive.

From Adapt - why success always starts with failure
Tight coupling means the unintended consequences proliferate so quickly that it is impossible to adapt to the failure or to try something different.

From The Gift of Time
Jerry warns us that when a system that continues to change or that is in a changing environment is subjected to a fixed set of tests, it will inevitably over-adapt to those tests, leading to a higher probability of severe or surprising failures in the field. [James Bach]

From The Art of War
Victory in war is not repetitious, but adapts its form endlessly.

From How Buildings Learn: Chapter 5 - Magazine Architecture: No Road
The specious old-box is old because it is profoundly adaptive.

From The Silent Language
Theodosius Dobzhansky, the great human geneticist, once observed that life was the result of neither design nor chance but the dynamic interaction of living substance with itself. He meant that life, in a changing environment, places such strains on the organism to adapt that, if this does not take place constantly, the organism as a species dies out. ... Different cultures are analogous to different species in the sense that some of them survive whilst others perish. Some are more adaptive than others. The study of change, therefore, is the study of survival.

From How to use Conscious Purpose Without Wrecking Everything
What is involved is not simply survival of the fittest, but survival of the fitting-in-est.

Evolution always means Co-evolution.

From Brain Rules
Charles Darwin noted… the brains in wild animals were 15 to 30 percent larger than those of their tame, domestic counterparts.

From Agile Development in the Large
It is important that instead of the process being adopted it is adapted.

From Leverage Points
The most stunning things living systems and social systems can do is to change themselves utterly by creating whole new structures and behaviours. In biological systems that power is called evolution. In human society it's called technical advance or social revolution. In systems lingo, it's called self-organization.

From Obliquity
Evolution is smarter than you are.

teams

Back to quotes table-of-contents

From Quality Software Management: Vol 3. Congruent Action
In all Steering (Pattern 3) organisations, the team is the fundamental unit of production.

From The Psychology of Computer Programming
In the end though, it's their method of learning that distinguishes teams from groups… team members always have a common goal, regardless of the product - the goal of helping each other learn to perform better.

From Pair Programming Illuminated
Widespread use of pair programming involves a cultural shift in values of the organization - away from individual and toward team recognition and goals.

From Wooden on Leadership
I rarely assigned one player to a basket. Basketball is a team sport, and I felt it was unwise to allow players to practice by themselves. Always I wanted them to be interacting with their teammates.

From Situated Learning - Legitimate Peripheral Participation
The fact that the work was done in an interaction between members opened it up to other members of the team.

From The Fifth Discipline
The total absence of meaningful practice or rehearsal is probably the predominant factor that keeps most management teams from being effective learning units.

In great teams conflict becomes productive.

From Peopleware
Most organizations don't set out consciously to kill teams. They just act that way.

The structure of a team is a network, not a hierarchy.

From The Deming Route to Quality
Time and again I see the benefits of using a team.

Teamwork characteristics ... cannot be determined if you interview ... one at a time.

From The Mythical Man Month
The Mythical Man Month is only incidentally about software but primarily about how people in teams make things.

From Toyota Production System - Beyond Large Scale
In modern industry, harmony among people in a group, as in teamwork, is in greater demand than the art of the individual craftsman.

From The Starfish and the Spider
The Toyota assembly line... if an employee stopped the line a pleasant "ding-dong" would sound and teams would carefully study what was going on.

learning

Back to quotes table-of-contents

From The Psychology of Computer Programming
In the end though, it's their method of learning that distinguishes teams from groups… team members always have a common goal, regardless of the product - the goal of helping each other learn to perform better.

From The Fifth Discipline
The total absence of meaningful practice or rehearsal is probably the predominant factor that keeps most management teams from being effective learning units.
Learning is eventually always about action.

From The Deming Route To Quality
Anyone who stops learning is old, whether at 20 or 80. [Henry Ford]

From Mindset
Speed and difficulty are the enemy of learning.

From Surfing the Edge of Chaos
The defining feature of a complex adaptive system is its ability to learn.

From Agile Development in the Large
Learning and change processes are part of each other. Change is a learning process and learning is a change process.

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 The Lean Startup
I've come to believe that learning is the essential unit of progress for startups.

Qualitative learning is a necessary companion to quantitative testing.

From Managing the Design Factory
In life, we design most processes for repetitive activities because a process is a way of preserving learning that occurs when doing an activity. … We need to find some way to preserve what we have learned without discouraging people from doing new things.

From Situated learning - Legitimate Peripheral Participation
A learning curriculum is thus characteristic of a community.

From Ackoff's Best
Development of individuals and corporations is more a matter of learning than earning.

From Surely You're Joking Mr Feynman
They didn't even know what they "knew". I don't know what's the matter with people: they don't learn by understanding; they learn by some other way - by rote, or something. Their knowledge is so fragile.

From Management of the Absurd
Ex-convicts are better able to rehabilitate prison inmates than is the prison staff. Ex-drug addicts are more successful in getting other addicts off drugs than are psychiatrists. Students learn more from each other than they do from their professors.

From Experiential Learning: Beginning
If there is no provocation, there is no learning.

From What Did You Say?
Learning is what feedback is all about.

From Brain Rules
Students learn better from words and pictures than from words alone.
Students learn better when corresponding words and pictures are presented simultaneously rather than successively.
Students learn better when corresponding words and pictures are presented near to each other rather than far apart on the page or screen.
Students learn better when extraneous material is excluded rather than included.
Students learn better from animation and narration than from animation and on-screen text.
Spaced learning is greatly superior to massed learning.

From Measuring and managing performance in organizations
When outcomes are revealed so slowly, learning is difficult.

systems

Back to quotes table-of-contents

From Smart Swarm
Unlike our systems, which are tuned for efficiency, the termites' systems have been tuned for robustness, which they demonstrate by building mounds that are constantly self-healing.

We should think of it [the termite mound] as a dynamic system that balances forces both inside and outside its walls to create the right environment for the termites.

From The Fifth Discipline
In systems thinking it is an axiom that every influence is both a cause and an effect. Nothing is ever influenced in just one direction.

From The Mind of War
…in order to determine the consistency of any new system we must construct or uncover another system beyond it… One cannot determine the character or nature of a system within itself. Moreover, attempts to do so lead to confusion and disorder.

From Becoming a Technical Leader
From working with systems, I have learned that the process of change is always organic.

From How To Use Conscious Purpose Without Wrecking Everything
If I design a system with no regard for the universe that surrounds it, I will have scanty knowledge of what can impact it. That is not a formula for success. To fit my system in to the larger system of systems around it, I must go to the next higher level of recursion, which is a frame of reference that encompasses my system and its environment—that is, the systems around it. What is involved is not simply survival of the fittest, but survival of the fitting-in-est, of that which fits in best.

Ignoring feedback merely means that the system will eventually experience a massive unpleasant surprise rather than a small unpleasant surprise.

From Surfing the Edge of Chaos
The defining feature of a complex adaptive system is its ability to learn.

From Managing the Design Factory
Whenever we see an intense need for communications it is typically a sign that the system has been incorrectly partitioned.

From Management 3.0
The Red Queen's Race is an evolutionary hypothesis describing that a complex system needs continuous improvement to simply maintain its current fitness, relative to the systems it is co-evolving with. Some scientists claim that the Red Queen's Race, or the principle of co-evolving species, is an even more important driver of evolution that any other kind of environmental change.

From Adapt - why success always starts with failure
Complexity is a problem only in tightly coupled systems.

From Thinking in Systems - A Primer
The system, to a large extent, causes its own behaviour.

This capacity of a system to make its own structure more complex is called self-organization.

Complex systems can evolve from simple systems only if there are stable intermediate forms.

From The End of Certainty
A nonequilibrium system may evolve spontaneously to a state of increased complexity.

From The Deming Route To Quality
Management works on the system, people work in the system.

From The Gift of Time
Jerry warns us that when a system that continues to change or that is in a changing environment is subjected to a fixed set of tests, it will inevitably over-adapt to those tests, leading to a higher probability of severe or surprising failures in the field. [James Bach]

I have become enormously skeptical of simple cause-and-effect explanations of any system behavior. [Tim Lister]

From Quality Software Management. Vol 4. Anticipating Change
Human systems don't change unless the individuals change, one at a time.

From Ackoff's Best
The essential properties of a system taken as a whole derive from the interactions of its parts, not their actions taken separately. Therefore, when a system is taken apart it loses its essential properties. Because of this - and this is the critical point - a system is a whole that cannot be understood by analysis.

An organisation is a system whose major deficiencies arise from the ways its parts interact, not from their actions taken separately.

From The Lean Startup
That which optimizes one part of the system necessarily undermines the system as a whole.

From Certain to Win
The insidious thing about entropy is that within a closed system, it always increases. In other words, closed systems run down.

From Consilience
In a system containing perfect internal order, such as a crystal, there can be no further change.

From An Introduction to General Systems Thinking
A "boundary" may not be infinitely thin, precisely so it can partake of both system and environment. Rather than separating, such a boundary connects.

From General Principles of Systems Design
The system responds more slowly in order to respond more surely.

From The Systems Bible
Systems don't appreciate being fiddled and diddled with. They will react to protect themselves.

Systems tend to oppose their own proper functions.

From The Road Less Travelled and Beyond
Systems inherently resist change.

From How Buildings Learn: Chapter 2 - Shearing Layers
The dynamics of the system will be dominated by the slow components, with the rapid components simply following along. Slow constrains quick; slow controls quick.

From Dr Deming
Lowering the number of defects in a stable system can only be achieved by working on the system.

Overadjustment of a stable system invariably makes things worse. This deserves a special name - tampering.

practising

Back to quotes table-of-contents

From Not Always So
When we practice together, we forget our own practice… When you practice your own practice together with others, the true ego-lessness happens.

From The Aesthetics of Change
Occidentals ... practice in order to get a skill, which is then a tool - in which I, unchanged, now have a new tool, that's all. The Oriental view is that you practice in order to change yourself.

From The Fifth Discipline
The total absence of meaningful practice or rehearsal is probably the predominant factor that keeps most management teams from being effective learning units.

From Wooden on Leadership
I rarely assigned one player to a basket. Basketball is a team sport, and I felt it was unwise to allow players to practice by themselves. Always I wanted them to be interacting with their teammates.

From The Mind of War
Boyd also came to appreciate the routine practice and repetition that was required to become really good at something and to overcome the boredom by focusing on minute improvements.

From Talent is Overrated
Practicing without feedback is like bowling through a curtain that hangs down to knee level. You can work on technique all you like, but if you can't see the effects, two things will happen: You won't get any better, and you'll stop caring.

From Stuka Pilot
Another confirmation of the truth of our old Stuka maxim: "Nothing comes off - except what you have practised."

We have long since ceased to develop practice from theory; we do just the opposite.

From Thinking Fast and Slow
An important principle of skills training: rewards for improved performance work better than punishment of mistakes.

The accurate intuition of experts are better explained by the effects of prolonged practice than by heuristics.

From Zen Mind, Beginner's Mind
Right practice, right attitude, right understanding.

From Bounce
Nobody who had reached the elite group without copious practice, and nobody who had worked their socks off but failed to excel.

From Mindset
Babe Ruth loved to practice. In fact when he joined the Boston Red Sox… he wasn't just a rookie. He was a rookie pitcher.

From Zen in the Art of Archery
If I tried to give you a clue at the cost of your own experience, I should be the worst of teachers and deserve to be sacked! So let's stop talking about it and go on practising.

From Zen Bow, Zen Arrow
Human beings always cling to things. Practice begins when you stop clinging.

From Thinking Fast and Slow
It is the mark of effortful activities that they interfere with each other.

From Mozart a biography
From earliest childhood he practiced for thousands of hours every year.

patterns of connection

When I read a good book I highlight passages that catch my attention. I copy a few of the highlights into a book-snippet.

This photo is of page 75 of my battered copy of The Secrets of Consulting. The yellow highlights are from the first time I read the book, the pink ones from the second time, the blue ones the fourth time. At the bottom right is one sentence outlined in pen and marked with an eight. That tells me I marked that sentence on my eighth re-read. (I've run out of new colours.)

I find it better to re-read a really good book 10 times rather than read 10 average books once each. It's the really good books that provide new insights each time I re-read them. Marking highlights in this way allows me to go back in time. What topics caught my attention in early readings? What topics in later readings? I can explore the differences. Of course, part of that newness is that I'm a different person each time I re-read. I'm older. A sentence triggers a new thought based an experience I've had since my last read. Also, I remember more of the book each time. For example I can see on my seventh re-read I marked this
The toughest problems don't come in neatly labeled packages. Or they come in packages with the wrong labels.
and I underlined the words labeled and labels because I'd consciously connected them to The Label Law (on page 64).
The name of the thing is not the thing.
Underneath that I can see I've written "The Dread Pirate Roberts". That's a connection to a scene from one of my favourite films, The Princess Bride. Westley is in the fire swamp explaining to Princess Buttercup how he has become the Dread Pirate Roberts...
Westley: I, as you know, am Roberts.
Buttercup: But how is that possible, since he's been marauding twenty years and you only left me five years ago?
Westley: I myself am often surprised at life's little quirks...
Westley: Well, Roberts had grown so rich, he wanted to retire. So he took me to his cabin and told me his secret. "I am not the Dread Pirate Roberts," he said. "My name is Ryan. I inherited the ship from the previous Dread Pirate Roberts, just as you will inherit it from me. The man I inherited it from was not the real Dread Pirate Roberts, either. His name was Cummerbund. The real Roberts has been retired fifteen years and living like a king in Patagonia." Then he explained the name was the important thing for inspiring the necessary fear. You see, no one would surrender to the Dread Pirate Westely.
John Gall (who was born in 1925), recently gave a fabulous talk called how to use conscious purpose without wrecking everything. He said:
As the years go by, the brain begins to put the dots together, to make conscious links between one experience and another, between one historical fact and another. A person begins to experience one’s entire life history as an integrated narrative.
This integrating capacity of the human brain is perhaps its most marvelous achievement. And you have to be old—usually fifty or sixty years old—to reach that point where it dawns on your conscious mind that that’s what’s going on. Unless you are already in your coffin, your mind is always a work in progress, an ongoing process of continual growth and greater differentiation, richer and more far-reaching correlations.
He chatted about how much his mind had changed during the first 40 years of his life compared to the most recent 40 years of his life. He said the latter change was far greater.
Isn't that amazing. Fantastic.
I'm looking forward to getting older!
I'm looking forward to seeing more and more patterns of connection.

courage

Back to quotes table-of-contents

From The Importance of Living
The courage to be one's own natural self is quite a rare thing.

From eXtreme Programming explained
Communication supports courage because it opens the possibility for more high-risk, high-reward experiments...

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

Concrete feedback supports courage because you feel much safer trying radical surgery on the code if you can push a button and see tests turn green at the end (or not, in which case you can throw the code away).

From The Road Less Travelled and Beyond
One thing that never ceases to amaze me is how relatively few people understand what courage is. The absence of fear is not courage; the absence of fear is some kind of brain damage. Courage is the capacity to go ahead in spite of fear, or in spite of pain.

From Quality Software Management. Vol 4. Anticipating Change
Ultimately what helps you most in managing system size is courage and realism.

From The Tao of Pooh
From caring comes courage.

From The Alchemist
"I had to test your courage," the stranger said. "Courage is the quality most essential to understanding the Language of the World."

From We Seven
Looking back on it now, it sounds a bit silly. But it takes little moments like that to build up a person's tolerance of fear and his ability to face the unknown. [Malcomn Scott Carpenter]

From The Teachings of Don Juan
There is nothing wrong with being afraid. When you fear, you see things in a different way.

Fear is the first natural enemy a man must overcome on his path to knowledge.

From The Conquest of Happiness
Every kind of fear grows worse by not being looked at.

From Mastery
The courage of a master is measured by his or her willingness to surrender. This means surrendering to your teacher and to the demands of your discipline. It also means surrendering your own hard-won proficiency from time to time in order to reach a higher or different level of proficiency.

From Stuka Pilot
Little by little I discover all the tricks. Skill is often the result of getting hurt.

From Existentialism and humanism
What produces cowardice is the act of giving up.

From Zen Bow, Zen Arrow
Gratitude will make you brave.

communicating

Back to quotes table-of-contents

From The Systems Bible
The meaning of a communication is the behaviour that results.

Information theory is a mathematical treatment of what is left after the meanings have been removed from a Communication.

From Managing the Design Factory
Whenever we see an intense need for communications it is typically a sign that the system has been incorrectly partitioned.

From The Pleasure of Finding Things Out
Official management, on the other hand, claims to believe the probability of failure is a thousand times less. One reason for this may be an attempt to assure the government of NASA perfection and success in order to ensure the supply of funds. The other may be that they sincerely believe it to be true, indicating an almost incredible lack of communication between themselves and their working engineers.

From Management of the Absurd
It is only when the balance of power is relatively equal that truly candid communication can and should take place.

From eXtreme Programming explained
XP is a communal software development discipline.

From The Road Less Travelled and Beyond
Community has to do with communication.

From Situated learning - Legitimate peripheral participation
A learning curriculum is thus characteristic of a community.

From Quality Software Management. Vol 1. Systems Thinking
The quickest and surest way to classify organisations into similar patterns is by the way people think and communicate.

From The Mind of War
Oral, not written, communication and conviction, not accuracy, still rule in military culture.

The tendency is for entropy to increase in a system that is closed or cannot communicate with the external systems or environments.

From The Starfish and the Spider
I taught them that communication is to be upward if it is to work at all.

From An Ecology of Mind
Without context, words and actions have no meaning at all. This is true of all communication.

From Quality Software Management. Vol 2. First-Order Measurement
Large projects always fail when their communication systems fail.

From The Psychology of Computer Programming
The greatest challenge, then, is not creative thinking, but creative communicating: representing our thoughts in a way that other persons - each with a unique style - can understand.

From how to use conscious purpose without wrecking everything
Once you get above that first level, the level of material things and forces, you are dealing with abstractions. In place of physical forces, you have communication—messages, signals. And in place of material things, you have relationships—which are abstractions.

From Wisdom of the idiots
Words alone do not communicate: there must be something prepared, of which the words are a hint.

feedback

Back to quotes table-of-contents

From An Ecology of Mind
A man walking is never in balance, but always correcting for imbalance.

From Leverage Points
Missing feedback is one of the most common causes of system malfunction.

From How to Use Conscious Purpose Without Wrecking Everything
Ignoring feedback merely means that the system will eventually experience a massive unpleasant surprise rather than a small unpleasant surprise.

The amount of feedback that is built into living organisms differs by many orders of magnitude from the amount that we build into manmade systems.

Flexibility means the willingness to act in response to the feedback message by actually changing how the system works.

From The Principles of Product Development Flow
The speed of feedback is at least two orders of magnitude more important to product developers than manufacturers...

The human effect of fast feedback loops are regenerative. Fast feedback gives people a sense of control; they use it, see results, and this further reinforces their sense of control.

Fast local feedback loops prevent the accumulation of variance.

From Quality Software Management. Vol 1. Systems Thinking
The feedback model says you can't successfully control anything for very long without information.

From Quality Software Management. Vol 2. First-Order Measurement
Software development is not primarily a manufacturing operation for we (ideally) never develop the same software twice. This uniqueness of product means that Deming's "statistical signal" - though necessary - is not sufficient for feedback control, because there often isn't enough repetition - enough stability - to generate meaningful statistics.

From Quality Software Management. Vol 3. Congruent Action
Information about past behaviour, delivered in the present, which may or may not influence future behaviour.

From Quality Software Management. Vol 4. Anticipating Change
In a feedback control system it's only our perception that determines which is controller and which is controllee.

From What Did You Say?
In other words, it's not so much the feedback that counts, but the struggle to get it - not the feedback, but the feeding-back.

We structure our world so we will not receive feedback that threatens our view.

We don't even wait to ignore feedback, but actively take steps to prevent such feedback from ever happening in the first place.

Don't concentrate on giving feedback; concentrate on being congruent - responding to the other person, to yourself, and to the here-and-now situation...

From Management 3.0
Feedback is only feedback when there is a purpose behind it.

From Talent is Overrated
Practicing without feedback is like bowling through a curtain that hangs down to knee level. You can work on technique all you like, but if you can't see the effects, two things will happen: You won't get any better, and you'll stop caring.

Feedback? At most companies this is a travesty, consisting of an annual performance review dreaded by the person delivering it and the one receiving it. Even if it's well done, it cannot be effective. Telling someone what he did well or poorly on a task he completed eleven months ago is just not helpful.

From Agile Development in the Large
Quick feedback should be the first thing you introduce.

From The Dance of Life
All societies depend for the stability on feedback from the people. Depersonalization reduces feedback to a minimum, contributing to instability and lowering the overall level of congruence in the society.

From Understanding the Professional Programmer
Many programmers… work in environments in which they receive essentially no real feedback embodying the consequences of what they do. Lacking no real feedback, they lack the motivation to attempt changes, and they also lack the information needed to make the correct changes.

From The Systems Bible
Just calling it "feedback" doesn't mean that it has actually fed back. To speak precisely: It hasn't fed back until the system changes course. Up until that point it's merely sensory input.

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 Surfing the Edge of Chaos
Feedback is the means by which a system talks to itself.

From The Fifth Discipline
Virtually all feedback processes have some form of delay.

you need to tell this to our managers

I did a very enjoyable live coding presentation using cyber-dojo at XP Days Ukraine last week. At the start I asked the XP question and, as usual, the audience told me lots about the XP practices (such as pair-programming) but struggled to name the four XP values, and failed to name courage.

On more than one occasion, while consulting or training at a customer's site trying to help explain and convey "an agile mindset", I've been told

you need to tell this to our managers

If I did tell their managers I'm pretty sure I know what would happen.
Can you guess?
Scroll down for my answer.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
I think their managers would say

you need to tell this to our managers

.
.
.
.
.

testing a random die roll

What tests would I write? Maybe I'd start by testing it only rolls 1 to 6
def test_doesnt_roll_less_than_1_or_greater_than_6
  1200.times do
    die = roll_die
    assert 1 <= die && die <= 6
  end
end
That's a good start. But it's not nearly enough. One way to think about testing is to imagine someone is deliberately writing the code so that it passes the tests but is nevertheless completely incorrect. Take, for example, sorting an array of N integers. What tests would you write? Now suppose I tell you the incorrect implementation simply returns an array of N 42's. Are you testing the output array is a permutation of the input array?

Back to rolling the die... an implementation of roll_die() which always returned 3 would pass my first test. I need to test all of 1-6 get returned.
def test_rolls_1_to_6_at_least_once_each_in_600_rolls
  rolls = [-1,0,0,0,0,0,0]
  600.times do
    die = roll_die
    rolls[die] += 1
  end
  assert rolls[1] >= 1
  assert rolls[2] >= 1
  assert rolls[3] >= 1
  assert rolls[4] >= 1
  assert rolls[5] >= 1
  assert rolls[6] >= 1
end
Why 600 rolls? You might be thinking it's too large. That a decent roll_die() should return at least one each of 1-6 after a lot fewer than 600 rolls. Or, to put it another way, if I have to wait till the 600th roll to get my first 5 then roll_die() is looking a bit suspect. Fair enough.

The tests form a specification. If I want to specify a "tighter" implementation of roll_die() I can simply change 600 to, 200 say. The 200 is then part of the specification.

Once again, it's easy to imagine an incorrect implementation that passes all the tests. How about one that simply cycles repeatedly through 1-6...
$n = 1

def roll_die
  $n += 1
  $n %= 6
  $n + 1
end
I've tested the "die" part of "random die". I've got to the "random" part of "random die". My incorrect implementation is not very random. It's very regular. It's very ordered. Suppose I call roll_die() 1200 times, save the 1200 values in a file, and then compress the file. I should get a lot of compression. Let's try it…
dice = ""
1200.times { dice += roll_die.to_s }
File.open('dice.txt', 'w') { |f| f.write(dice) }
unzipped_size = File.size('dice.txt')
assert_equal 1200, unzipped_size
`zip dice.txt.zip dice.txt`
zipped_size = File.size('dice.txt.zip')
p zipped_size
On my macbook I get a value of 184. As expected, a lot of compression. Let's compare the compression to an implementation that isn't deliberately incorrect.
def roll_die
  [1,2,3,4,5,6].shuffle[0]
end
This gives a zipped file size of around 680. A lot less compression. I can use that as part of the specification.
def test_roll_is_random_entropically
  dice = ""
  1200.times { dice += roll_die().to_s }
  File.open('dice.txt', 'w') { |f| f.write(dice) }
  unzipped_size = File.size('dice.txt')
  assert_equal 1200, unzipped_size
  `zip dice.txt.zip dice.txt`
  zipped_size = File.size('dice.txt.zip')
  assert zipped_size > 600
end
Imagine someone is deliberately writing the code so that it passes the tests but is nevertheless completely incorrect…


the power of example

Last week I attended another excellent Jerry Weinberg course in Albuquerque. Here's one of the nuggets I learned. It's related to the famous Solomon Asch social psychology conformity experiment.

In the experiment a group of people are shown two cards. The first card has a single line on it. The second card has three lines on it labelled A,B,C one of which clearly matches the length of the line on the other card (and the other two clearly don't). Only one person in the group is the actual subject and is unaware that the other members of the group are part of the experiment. The experiment measures how likely the subject is to conform to the answer given by everyone else when that answer is clearly the wrong one. The answer is "quite a lot". But that's not what I learned. What I learned about is a variation on that experiment. One where Solomon Asch measured how the effect varied depending on how many other people's answers matched, or didn't match, the subject's answer. You can read about this variation (and some others) here. This is the punchline:

The presence of a [single] supporting partner depleted the majority of much of its power. Its pressure on the dissenting individual was reduced to one fourth: that is, subjects answered incorrectly only one fourth as often as under the pressure of a unanimous majority.

Isn't that a great example of the power of setting an example. Of how change happens one person at a time. Of courage. Of how important it is that people feel safe. People are always more impressed by the power of our example than by the example of our power.