zen in the art of archery

is an excellent book by Eugen Herrigel (isbn 978-0-14-019074-8). As usual I'm going to quote from a few pages:
He who has a hundred miles to walk should reckon ninety as half the journey.
I have also tried to keep my language as simple as possible. Not only because Zen teaches and advocates the greatest economy of expression, but because I have found that what I cannot say quite simply and without recourse to mystic jargon has not become sufficiently clear and concrete even to myself.
No reasonable person would expect a Zen adept to do more than hint at the experiences which have liberated and changed him, or to attempt to describe the unimaginable and ineffable 'Truth' by which he know lives.
I hit upon the thought that there must be a trick somewhere which the Master for some reason would not divulge, and I staked my ambition on its discovery.
In spite of its being divided into parts the entire process seemed like a living thing wholly contained in itself and not even remotely comparable to a gymnastic exercise, to which bits can be added to taken away without its meaning and character being thereby destroyed.
I once remarked that I was conscientiously making an effort to keep relaxed, he replied: 'That's just the trouble, you make an effort to think about it. Concentrate entirely on your breathing, as if you had nothing else to do.
A great Master, he replied, must also be a great teacher.
You had to suffer shipwreck though your own efforts before you were ready to seize the lifebelt he threw you.
Do you know why you cannot wait for the shot and why you get out of breath before it has come? The right shot at the right moment does not come because you do not let go of yourself. You do not wait for fulfilment, but brace yourself for failure.
Right presence of mind. This means that the mind or spirit is present everywhere, because it is nowhere attached to any particular place.
It is all so simple. You can learn from an ordinary bamboo leaf what ought to happen. It bends lower and lower under the weight of snow. Suddenly the snow slips to the ground without the leaf having stirred. Stay like that at the point of highest tension until the shot falls from you. So, indeed, it is: when the tension is fulfilled, the shot must fall, it must fall from the archer like snow from a bamboo leaf, before he even thinks it.
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.
Don't ask, practice!

c++ development slide deck

Here's the slide deck for a presentation I recently did for a large gathering of C++ developers.

systems thinking slide deck





Here are the slides for the talk on Systems Thinking that Niklas Bjornerstedt and I did in the Scotsman pub in Oslo yesterday. The point about "Your wife is very beautiful" is that it is very easy to read that in a static sense. To get a sense of reading it in a more dynamic (relative) sense, imagine if someone replies "compared to who?!"

The books mentioned in the talk are:
The Law of Unintended Consequences slide has three images for these three stories:

dojo = way place

Tore Martin Hagen and some of his colleagues did their first team Cyber-Dojo recently. One team member, Manabu Mochida, is from Japan and he wrote a nice explanation of the term Dojo on the white board. Love it. Thanks Manubu.

the principles and practice of fly and bait casting

Is an excellent book by Reginald D. Hughes (published 1924). As usual I'm going to quote from a few pages:
The great majority of fishermen are ignorant of the actual principles which underlie their every act, whether right or wrong.
One certain index of efficiency is the absence of effort. Style is synonymous with efficiency, and style and effort do not go together.
Double-handed fly casting may especially be recommended as almost, if not quite, the most beneficial form of exercise one can take. It calls for the use of every muscle in the body. It exercises without exhausting.
Excessive effort is not only uncalled for, but if practised defeats itself.
Brute force alone will never put one in the front rank.
A tight grip means tense muscles and joints throughout the body. It kills all attempts to cast smoothly and easily. It imparts, through a vibrating rod tip, waves and irregularities to the line, and is very tiring even to an onlooker.
Remember that the rod should be practically noiseless. Any distinct "whoosh" is a sign of a faulty casting, and shows that the cast is made with the entire rod instead of with the top.
Hold or grip of the rod - there should be none. The rod merely rests in the right hand, while the left hand lightly encircles the butt end. Any tendency to a tight grip must be resolutely suppressed.
Both hands must do an equal share of the work.
Our desire is to cast the fly across and downstream at an angle of about 45 degrees. So we stand, as regards our feet, facing this direction, and, without moving them, rotate the body until we face downstream, rod low and pointing in the direction of the fly.
In learning these casts try to avoid too much concentration, as the great secret is to let the whole body be free and swing easily and comfortably, letting the rod do it, and it will do it if the timing is right.
If the line is allowed to slacken in the least, even momentarily, the pull on it is lost.

the importance of living

Is an excellent book by Lin Yutang, isbn 978-0688163525. As usual I'm going to quote from a few pages:
In the West, the insane are so many that they are put in an asylum, in China the insane are so unusual that we worship them.
I consider the education of our senses and our emotions rather more important than the education of our ideas.
Only he who handles his ideas lightly is master of his ideas, and only he is master of his ideas is not enslaved by them.
A great man is he who has not lost the heart of a child.
Passion holds up the bottom of the world, while genius paints its roof.
The courage to be one's own natural self is quite a rare thing.
An Old Man was living with his Son at an abandoned fort on the top of a hill, and one day he lost a horse. The neighbours came to express their sympathy for his misfortune, and the Old Man asked, "How do you know this is bad luck?" A few days afterwards, his horse returned with a number of wild horses, and his neighbours came again to congratulate him on this stroke of fortune, and the Old Man replied, "How do you know this is good luck?" With so many horses around, his son began to take to riding, and one day he broke his leg. Again the neighbours came round to express their sympathy, and the Old Man replied, "How do you know this is bad luck?" The next year, there was a war, and because the Old Man's son was crippled, he did not have to go to the front.
The trouble with Americans is that when a thing is nearly right, they want to make it still better, while for a Chinese, nearly right is good enough.
When the chains of a bicycle are kept too tight, they are not conducive to the easiest running, and so with the human mind.
Tea in invented for quiet company as wine is invented for a noisy party.
Luxury and expensiveness are the things most to be avoided in architecture.
Taste then is closely associated with courage.
We must give up the idea that a man's knowledge can be tested or measured in any form whatsoever.
Only fresh fish may be cooked in its own juice; stale fish must be flavoured with anchovy sauce and pepper and mustard - the more the better.
The thing called beauty in literature and beauty in things depends so much on change and movement and is based on life. What lives always has change and movement, and what has change and movement naturally has beauty.

zen bow, zen arrow

Is an excellent book by John Stevens, isbn 978-1-59030-442-6. As usual I'm going to quote from a few pages:
He never missed a day of teaching, regardless of the weather, and would often sit for hours in the dojo watching and instructing, even if it was freezing outside.
Gratitude will make you brave.
Learn from a teacher everything he or she has, all the way - that is the real secret of training that will give you great results.
Self-reflection encourages great bravery. Rationalization is your greatest enemy.
Fostering the spirit is painful, hard work; shoot each shot as if your life depended on it.
The essence of Buddhism is not meditation or liberation from samsara. It is kenso, "seeing into your nature."
Do your best at each and every thing. That is the key to success. Learn one thing well and you will learn how to understand ten thousand things.
The two greatest virtues: self-control and returning kindness.
Human beings always cling to things. Practice begins when you stop clinging.
One day of effort is one day of bliss; One day of sloth is a hundred years of regret.


the #include test

Suppose we have a class called widget defined in widget.hpp
class widget
{
    ...
};
How many ways (exclusing templates) can the definition of the class fubar depend on widget?
I can think of thirteen ways:
class fubar : public widget // 1 inheritance
{
    void value_parameter(widget  ); // 2
    void   ref_parameter(widget &); // 3
    void   ptr_parameter(widget *); // 4

    widget value_return(); // 5
    widget & ref_return(); // 6
    widget * ptr_return(); // 7

    widget instance_value_member; //  8
    widget & instance_ref_member; //  9
    widget * instance_ptr_member; // 10

    static widget static_value_member; // 11
    static widget & static_ref_member; // 12
    static widget * static_ptr_member; // 13
};
Now for the test.
Which of the thirteen ways require a hash include
#include "widget.hpp"
as opposed to a forward declaration
class widget;
I've given this test to many many programmers and the vast majority get it wrong. The variety of answers I get is amazing. I recently gave it to a room of about 100 C++ developers and 5 got it right with about 20 different wrong answers (at which point I stopped counting).

What's your answer?
Once you've decided you can scroll down to find the answer.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.keep scrolling...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
The answer is 1 and 8.
How did you do?


If you don't believe me why not try it now in cyber-dojo (click the link and then click the start button).

cyber-dojo Raspberry Pies in action



Liam Friel, who helps to run a CoderDojoBray (in Ireland) asked me for some Raspberry Pies which I was more than happy to give him, paid for from the donations lots of you generous people have made from cyber-dojo.

Liam sent me this wonderful photo of a CoderDojoBray session and writes:

Your Pies have been getting a lot of use... We've got 8 Pies in total. Got a reasonably steady turnout at the dojo, 75-85 kids turning up each week.

Awesome. If, like Liam, you would like some Raspberry Pies to help kids learn about coding, please email. Thanks

ACCU conference charity bookstall

A huge thank you to all the excellent folks at the ACCU conference who helped to raise £481.28 which, like all donations to cyber-dojo, will be used to buy Raspberry Pies for kids.

Pair Programming Illuminated

is an excellent book by Laurie Williams and Robert Kessler. As usual I'm going to quote from a few pages

Programmers admit to working harder and smarter on programs because they do not want to let their partner down.

The pair results were also more consistent, while the individuals varied more about the mean. Individuals intermittently didn't hand in a program or handed it in late; pairs handed in their assignments on time.

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

We have observed that effective pair programmers communicate with each other at least once a minute.

Interestingly enough, the more experience a developer has, the more likely he or she is to ask for help; novices are less likely to ask for help.

We used to consider a new person unproductive for their first three months. Now, we find that new people can help out almost immediately.

We still feel that a novice pair is a better alternative to a solo novice.

We believe pair programming is an integral part of XP, and it is dangerous to do XP without doing pair programming.


changing

Back to quotes table-of-contents

From The Aesthetics of Change
Cybernetics therefore suggests that "all change can be understood as the effort to maintain some constancy and all constancy as maintained through change".
Change cannot be found without a roof of stability over its head. Similarly stability will always be rooted to underlying processes of change.

From How Buildings Learn: Chapter 2 - Shearing Layers
The rates of change over time define the layers as clearly as the individual physical changes.

Hummingbirds and flowers are quick, redwood trees slow, and whole redwood forests even slower. Most interaction is within the same pace level.

From Understanding the Professional Programmer
You must begin to see change as something wonderfully rare, and worth observing. You must stop taking change for granted if you wish to master the art of productive change.

From How Buildings Learn
By far the greatest rate of change comes right at the beginning, as it does with everything that lives.

From Managing the Design Factory
Best practices are only "best" in certain contexts and to achieve certain objectives. A change in either the context or the objective can quickly transform a "best practice" into a stupid approach.

From The Gift of Time
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.

From Progressive Fly Fishing for Salmon
In my opinion most anglers change their flies too often, generally because they lose faith in it. Moreover, when they change flies it is normally for one of a different colour, and not size, and I believe that this is a great mistake.

From Slack
The more efficient you get, the harder it is to change.

From The Silent Language
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.

From The Importance of Living
What lives always has change and movement, and what has change and movement naturally has beauty.

From Quality Software Management. Vol 1. Systems Thinking
A culture is a self-sustaining pattern that has remarkable powers of resistance to change.

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

From What Did You Say?
One of us is going to change, why don't you go first?

From Mind and Nature
The unchanging is imperceptible unless we are willing to move relative to it.

The Aesthetics of Change

Is an excellent book by Bradford Keeney. This is its first set of book snippets. Here's the second. As usual I'm going to quote from a few pages...
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.
Corrective action is brought about by difference. The system is technically "error activated" in that "the difference between some present state and some 'preferred' state activates the corrective response". Cybernetics therefore suggests that "all change can be understood as the effort to maintain some constancy and all constancy as maintained through change". [Gregory Bateson]
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.
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 stabilizing an ecosystem.
For the most part, people take distinctions to be representations of an either/or duality, a polarity, a clash of opposites, or an expression with a logic of negation underlying it.
Both Don Juan and Erickson also made use of introducing confusion to bring about change.
A "dormative principle" is a more abstract repackaging of a description of the item you claim to be explaining. To paraphrase [Gregory] Bateson, this occurs when the cause of a simple action is said to be an abstract word derived from the name for the action... What one does, in this case, is to say that an item of simple action is caused by a class of action. This recycling of a term does not constitute a formal explanation.
When we encounter sufficient complexity, such as recursive organization of human interaction, our inability to discern higher orders of patterns leads us to committing what Whitehead called "the fallacy of misplaced concreteness." We then "abstract from relationship and from the experiences of interaction to create 'objects' and to endow them with 'characteristics'".
The more "fundamental" a premise, the less accessible it will be to consciousness. As Samuel Butler proposed, the more one "knows" something the less aware one becomes of that knowledge.
Mere purposive rationality unaided by such phenomena as art, religion, dream, and the like, is necessarily pathogenic and destructive of life. [Gregory Bateson]
The truth which is important is not a truth of preference, it's a truth of complexity.

The Hidden Dimension

Is an excellent book by Edward T. Hall. As usual I'm going to quote from a few pages:
One of the most important functions of territoriality is proper spacing, which protects against over-exploitation of that part of the environment on which a species depends for its living.
As numbers of animals in a given area increase, stress builds up until it triggers an endocrine reaction that acts to collapse the population.
Man's evolution has been marked by the development of the "distance receptors" - sight and hearing...
There is a general relationship between the evolutionary age of the receptor system and the amount and quality of information it conveys to the central nervous system. The tactile, or touch, systems are as old as life itself.
As Freud and his followers observed, our own culture tends to stress that which can be controlled and to deny that which cannot.
All works of art are created on a certain scale. Altering the size alters everything.
The present internal layout of the house... is quite recent. As Philippe Aries points out in Centuries of Childhood, rooms had no fixed functions in European houses until the eighteenth century.
Many of my European subjects observed that in Europe human relationships are important whereas in the United States the schedule is important.
The study of Japanese spaces illustrates their habit of leading the individual to a spot where he can discover something for himself.
Planning and renewal must not be separated; instead, renewal must be an integral part of planning.
Like the link between cancer and smoking, the cumulative effects of crowding are usually not experienced until the damage has been done.

Slack

is the title of an excellent book by Tom DeMarco. This second snippet (here's the first) continues my tactic of rereading good books several times. As usual I'm going to quote from a few pages:
Talented managers are ... all sense organ, constantly attuned to the effect their leadership is having on their people ... Managers without such talent find themselves relying on formulas and "principles" of management. They reason, "This thing I'm trying to do should work; the fact that it isn't working probably suggests that I'm doing it half-heartedly." And so they do more of whatever they've been doing.
When the new automation is in place, there is less total work to be done by the human worker, but what work is left is harder. That is the paradox of automation: It makes the work harder, not easier.
In my experience, standard processes for knowledge work are almost always empty at their center.
The power you've granted is the power to err. If that person messes up, you take the consequences. Looked at from the opposite perspective, it is this capacity to injure the person above you that makes empowerment work.
When there is neither time nor staff to cope with work that runs more slowly than expected, then the cost of lateness is paid out of quality. There is no other degree of freedom.
... voluminous documentation of everything that will hold still for it.
Successful change can only come about in the context of a clear understanding of what may never change, what the organization stands for... the organization's culture... If nothing is declared unchangeable, then the organization will resist all change. When there is no defining vision, the only way the organization can define itself is its stasis.

the (de)composition fallacy

You've probably heard the saying "the whole is greater than the sum of the parts". You can think about this law in various ways. For example, if you remove the brain from a man you no longer have a man minus a brain. You have two dead things. A brain is more than just a "part" of a man. A part has relationships to a whole that contribute to the essential wholeness of the whole.

Another way is at a much simpler level - where all the parts are of the same type aggregating together over time. Time patterns them. Human beings are pretty poor at seeing effects over time. We tend to think things are more permanent than they are. We think that the way things are now is how they've always been and how they'll continue to be. I recall showing my children some old Victorian pennies and telling them that's what pennies used to look like. They didn't believe me! Before street lighting it was apparently very common in England to have two sleeps a day. The short one after a midday meal was called the "small sleep". The time we eat our main meal has changed. Eating several courses at a meal is a relatively recent phenomenon. The cutlery we eat with has changed. And what we wear. Before the 17th century your left and right shoe (if you had shoes at all) were the same and were called "straights".

But things do change, and this matters because

Things that don't matter in isolation often matter in composition.

Suppose you compile some code and you get a few warnings. Do these warnings matter? You might think not, since there are only a few, but they do. Tomorrow you'll be writing some more code, and the day after that some more too, and so will your colleagues. After six months those few warnings have turned into 3000 warnings. That's the composition fallacy.

3000 warnings is a big problem for at least two reasons. But the two reasons I'm thinking of are really the same reason. Let me explain.

The first reason is that if you've got 3000 warnings then any new warnings aren't even noticed in the comparative vastness of the existing 3000. You've become completely desensitized to warnings. The number of warnings inexorably grows but no one notices - you've just got "a lot of warnings" that is always "a lot of warnings".

The second reason is the same reason but in reverse.

Suppose you see what you couldn't see before - that a lot of warnings is a composition problem - and you try to do something about it. You've now got to work hard learning how to do something you don't know how to do - namely how to write code without warnings. That takes effort. And what do you get for all your effort? Almost nothing it seems! The number of warnings goes down a tiny bit but there are so many warnings you've hardly made any difference at all. A lot of warnings remains a lot of warnings.

One thing you can do in this situation is to stop reporting the total number of warnings and switch to reporting only the number of warnings either added or removed. This is an example of switching from a static measure (the number of warnings is now 2981) to a more dynamic measure (in the last 24 hours the number of warnings has gone down by 19).

Are your lights on?

is an excellent book edited by Donald Gause and Jerry Weinberg (isbn 0-932633-16-1). This is my second snippet for this book - I've set myself the goal of reading all of Jerry's books twice. As usual I'm going to quote from a few pages:
The fledgling problem solver invariably rushed in with solutions before taking time to define the problem being solved. Even experienced solvers, when subjected to social pressure, yield to this demand for haste.
There are hundreds of things that can be be overlooked in any problem definition. If you can't think of even three, all that says is that you can't, or won't, think at all.
Human beings are so adaptable, they'll put up with almost any sort of misfit - until it comes to their consciousness that it doesn't have to be that way.
Are your lights on?
Bureaucracies always begin with some process of selection - a process which is never quite "natural" selection.
The source of the problem is most often within you.
These young computniks will acquire one valuable lesson from their unrelenting quest for problems to fit their solution - "solution probleming," we call it. As they quest so shall they learn. Mostly, they'll learn about problem definition.
If we seek a universal solvent, we can hardly deem it a "side effect" that it dissolves any container we try to keep it in.
Habituation allows us to cancel out the constancies in our environment, thus simplfying our lives.

Understanding the professional programmer

is an excellent book by Jerry Weinberg (isbn 0-932633-09-9) (I've blogged a snippet review of it before.) As usual I'm going to quote from a few pages:
In the past, we depended on meetings because little was written down.
There are very few ways to measure the quality of a programmer's work unless you are a competent programmer yourself.
How do I work on those aspects of my own personality and problem-solving approach that are so personal I can't even see them, even though they may be the most important factor in my effectiveness as a programmer?
The next generation will come when we outgrow our adolescent fascination with toys and develop an adult interest in people.
I believe the first manager failed because she thought that to manage change you must interact directly with the employee.
If you want people to change what they're doing, make sure they are fed back the consequences of what they're doing.
90 percent of all illness cures itself - with absolutely no intervention from the doctor.
It's sometimes hard to know when someone is listening - rather than merely waiting to seize control of the conversation. One way everyone knew Mack wasn't listening was by noticing how seldom he allowed other people to finish what they were saying.
The secret to all good writing is re-writing.
Our tests have shown that certain implanted errors take fifteen minutes for one person to find, fifteen hours for another, fifteen seconds for a third. A few more people can't find the error no matter how long they search. This kind of variation hardly forms the basis for estimating.
The situation is hopeless but not serious.
Rules are not made to be broken, but neither are they made to be not broken. Rules are made so that the organization operates more efficiently.

nothing new ever works

Jerry Weinberg's latest blog is a guest entry from me!
It's an email I sent detailing a personal example of his New Law...

Hi Jerry,

I just had a moment of enlightenment about the New Law I wanted to share with you... I was giving Patrick, my son, some calpol (liquid paracetamol - he's ill off school today). The bottle had a new plastic widget in the top. With the bottle there was a new small syringe with a new plunger. This was a new design - instead of simply pouring the calpol onto a teaspoon you clearly had to fill up the syringe. Try as I might I could not get the syringe through the hole in the plastic widget in the neck of the bottle. So was it The New Law - Nothing new ever works?

My beautiful wife Natalie came to my rescue. It did work and she showed me how.

I just re-read The New Law from your book. I noticed that all the examples, the coffee maker, the pills, the car-battery, the car, the hospital procedure were examples where the new thing was genuinely not working. But in my case the new thing WAS working. It was ME that was not working!

From this I have realized that

1) It's easy to think the emphasis in "Nothing New Ever Works" is on the word "new" but it's equally on the word "works"!

2) Something being new is a relationship

3) Something working is a relationship

4) When I say "it's not working" what I always mean is "I can't get it working"

Also, it might give some insight into the question you pose at the end of the New Law...

"Everyone knows that new things never work."

"Then why is everyone obsessed with changing everything for something new?"

"If you answer that, you'll have something worth writing about"

Well, when things go wrong we can look for the cause outside of ourselves, or we can look for the cause inside of ourselves. But, looking for the cause inside of ourselves would mean WE had failed. Which is unthinkable. Therefore the cause must be outside of ourselves. Viz, if it's a choice between changing the world around us, or changing the world inside us, outside wins. And that's one reason why we create new things!

Cheers

Jon


Alice in wonderland

is an excellent book by Lewis Carroll. As usual I'm going to quote from a few pages:
It was labelled ORANGE MARMALADE, but to her great disappointment it was empty.
Down, down, down. Would the fall never come to an end?
She generally gave herself very good advice (though she very seldom followed it).
Alice felt so desparate that she was ready to ask help of anyone.
Why, said the Dodo, the best way to explain it is to do it.
It sounded like an excellent plan, no doubt, and very neatly and simply arranged; the only difficulty was, that she had not the smallest idea how to set about it.
Would you tell me, please, which way I ought to go from here?
That depends a good deal on where you want to get to, said the Cat.
I don't much care where - said Alice.
Then it doesn't matter which you go, said the Cat.
Have some wine, the March Hare said in an encouraging tone.
Alice looked all round the table, but there was nothing on it but tea.
I don't see any wine, she remarked.
There isn't any, said the March Hare.
The chief difficulty Alice found at first was in managing her flamingo.
Alice soon came to the conclusion that it was a very difficult game indeed.
Take off your hat, the King said to the Hatter.
It isn't mine, said the Hatter.
Stolen, the King exclaimed, to the jury, who instantly made a memorandum of the fact.
I keep them to sell, the Hatter added as an explanation: I've none of my own. I'm a hatter.
Begin at the beginning, the King said gravely, and go on till you come to the end: then stop.

viking laws


Several years ago I bought this postcard from Olso airport.

be brave and aggressive

  • be direct
  • grab all opportunities
  • use varying methods of attack
  • be versatile and agile
  • attack one target at a time
  • don't plan everything in detail
  • use top quality weapons

be prepared

  • keep weapons in good shape
  • keep in shape
  • find good battle comrades
  • agree on important points
  • choose one chief

be a good merchant

  • find out what the market needs
  • do not promise what you can't deliver
  • do not demand overpayment
  • arrange things so you can return

keep the camp in order

  • keep things tidy and organized
  • arrange enjoyable activities which strengthen the group
  • make sure everyone does useful work
  • consult all members of the group for advice


kanban push-me-pull-you

I've been thinking some more about kanban and visualization. A while ago I blogged about my security-scan kanban idea of introducing proper physical kanban onto the board. Instead of writing a work-in-progress limit of 5 at the top of a column you introduce 5 physical "empty-tray" kanbans. Different columns use different coloured kanban. For example, here's a very simple kanban board with a Wibbling limit of 4 yellow trays and a Fubaring limit of 5 red trays. The stories are in blue and must always be in a tray.


I mentioned how this allows genuine pulling. For example, the Fubarers can signal they're ready to pull a story from the Wibblers by moving an empty red kanban tray into the Wibbling column.


I said that the Wibblers could simply move a done blue story from its yellow kanban into an empty red kanban. Something about that bothered me and I think I now know what it is. Once again it's about visualization. What bothers me is that there is no representation of whether a blue story is done until it's moved into an empty kanban. There is no visual display of whether a blue story actually is "in-progress" and being worked on, or whether its "in-queue" and waiting for an empty red kanban. That feels wrong.

More recently, I blogged about about the common pattern of splitting each column; one for ongoing, one for done, like this. Something about the done column didn't feel quite right either.


So here's what I'm thinking. As well as moving empty-kanbans upstream to signal a pull, you can also move full-kanbans downstream to signal a push. For example, when a Wibbler finishes a blue story they don't leave it in their Wibbling column, waiting for a red kanban pull signal, they move it, still in its yellow kanban, into the Fubaring column, like this:



Ideally, the departing full-yellow-kanban will be just-in-time to meet an arriving empty-red-kanban between the columns...



...and the blue-story will flow from the full-yellow-kanban into the empty-red-kanban:



On the other hand, if the Wibblers are working much faster than the Fubarers then the Fubarer's column will fill up with full-kanban push-requests:



As the Fubarer's column fills up with full-kanban push-requests from upstream it's likely it will also be filling up with empty-kanbans pull-requests from downstream (in green say):


Push-me-pull-you is very visual:
  • There's one representation of flow ; thin columns with kanban of one colour only.
  • There's a different representation of lack of flow ; fat columns filling up (at the bottleneck) with two or three different coloured kanbans.
Push-me-pull-you points to problems:
  • If the yellow Wibblers work faster than the downstream red Fubarers, the Wibbler's full yellow kanban get stuck downstream in the Fubarer's column, inviting the Wibblers to help the Fubarers.
  • If the red Fubarers work faster than the upstream yellow Wibblers, the Fubarer's empty red kanban get stuck upstream in the Wibbler's column, inviting the Fubarers to help the Wibblers.
Push-me-pull-you has helped me understand:
  • pull does not preclude push; you can have push and pull.
  • wip-limits are not limited to pull systems; wip-limits would help in push systems too.


multi-tasking

Many years ago, in a taxi, in Athens, I watched with a mixture of amazement and fear as my driver freed up both hands by steering with his elbows. It was quite an experience!

Multi-tasking is a bad idea when you're doing tasks requiring "immersion". After being interrupted it takes you a long time to get back to where you were. One of the least talked about reasons why pair-programming can be so effective is that a pair seems to be much more resilient to interruptions than an individual. In other words, yet again, pair-programming is partly about programming, but it's mostly about the pairing.

Jerry Weinberg observed that if you have two task to choose from you don't in fact have two tasks to choose from. You have three. Your third task is deciding which of the other two tasks you should tackle!

Recently, on a train, a man sitting opposite me was reading The Telegraph. An article on the front page about multi-tasking caught my eye. It quoted some research by Professor David Strayer from the University of Utah. It said multi-taskers often end up juggling activities not because they are good at it, but because they are easily distracted and cannot concentrate on the job at hand. And in contrast, the most efficient multi-tasker is the person least likely to do so because they can focus on one thing at a time. The implication is that someone who claims to be good at multi-tasking probably isn't!

Zen and the art of motorcycle maintenance

is an excellent book by Robert Pirsig (isbn 978-0-099-32261-0). As usual I'm going to quote from a few pages:
By far the greatest part of his [the mechanic's] work is careful observation and precise thinking.
Care and Quality are internal and external aspects of the same thing. A person who sees Quality and feels it as he works is a person who cares. A person who cares about what he sees and does is a person who's bound to have some characteristics of Quality.
As Poincaré would have said, there are an infinite number of facts about the motorcycle, and the right ones don't just dance up and introduce themselves. The right facts, the ones we really need, are not only passive, they are damned elusive and we're not going to just sit back and "observe" them. We're going to have to be in there looking for them or we're going to be here a long time. Forever. As Poincaré pointed out, there must be a subliminal choice of what facts we observe. The difference between a good mechanic and a bad one, like the difference between a good mathematician and a bad one, is precisely this ability to select the good facts from the bad ones on the basis of quality. He has to care!
That's really why he got so upset that day when he couldn't get his engine started. It was an intrusion into his reality.
The range of human knowledge today is so great that we're all specialists and the distance between specializations has become so great that anyone who seeks to wander freely among them almost has to forego closeness with the people around him.
This isn't really a small town. People are moving too fast and too independently of one another.
I've a set of instructions at home which open up great realms for the improvement of technical writing. They begin, 'Assembly of Japanese bicycle require great peace of mind.'
Peace of mind isn't at all superficial really, I expound. It's the whole thing. That which produces it is good maintenance; that which disturbs it is poor maintenance. What we call workability of the machine is just an objectification of this peace of mind. The ultimate test's always your own serenity. If you don't have this when you start and maintain it while you're working you're likely to build your personal problems right into the machine itself.
There is an infinity of hypotheses. The more you look the more you see.
It's the sides of the mountain which sustain life, not the top.
It is not the facts but the relation of things that results in the universal harmony that is the sole objective reality.
Always take the old part with you to prevent getting a wrong part.
Impatience is close to boredom but always results from one cause: an underestimation of the amount of time the job will take.
Mu means "no thing". Like "Quality" it points outside the process of dualistic discrimination. Mu simply says, "No class; not one; not zero, not yes, not no." It states that the context of the question is such that a yes or no answer is an error and should not be given. "Unask the question" is what it says. Mu becomes appropriate when the context of the question becomes too small for the truth of the answer.
Apart from bad tools, bad surroundings are a major gumption trap.
Religion isn't invented by man. Men are invented by religion.
When handling precision parts that are stuck or difficult to manipulate, a person with mechanic's feel will avoid damaging the surfaces and work with his tools on the nonprecision surfaces of the same part whenever possible. If he must work on the surfaces themselves, he'll always use softer surfaces to work with them. ... Handle precision parts gently.
Want to know how to paint a perfect painting? It's easy. Make yourself perfect and then just paint naturally. That's the way all experts do it.
The real cycle you're working on is a cycle called yourself.


Scrum buses

Some buses are busy busing people. Picking up passengers at stops. Not stopping when there are no passengers. Busy bus-y.

Suppose bus 5 picks up slightly more passengers than normal. This delays it slightly. It takes slightly longer to reach the next stop. This means it again picks up slightly more passengers than normal. Bus 5 gets further and further behind bus 6 ahead of it.

Do we understand the bus system? We have a cause and an effect which seem plausible. I've learned that saying something is a cause and something is an effect is fraught with danger. With a deeper understanding, what is cause and what is effect start to blur together. Saying this is a cause and that is an effect is a clumsy way of saying they are part of the same system.

Back to the slightly delayed bus 5. Behind bus 5 is bus 4. Bus 5's delay means bus 4 picks up slightly fewer passengers than normal. Bus 4 gets closer and closer to bus 5 ahead of it.

Now it's less clear bus 5 is causing the problem. Perhaps bus 5 picked up more passengers than usual because bus 6 ahead of it was catching up bus 7 ahead of it. And bus 7 is really the cause. But two ahead of bus 7 is bus 9. Maybe bus 9 in the cause? Or maybe we need to look at the whole system.

You wait ages for a bus and then two or more turn up at the same time! The buses are queueing just like the passengers at the stops! A trip that should take 15 minutes takes 45 minutes.

Queues will form when processes with variability are loaded to high levels of utilization without constraint.

What does the Bus "route" master do? They constrain the system.
  • Buses depart at evenly-spaced fixed-duration intervals.
  • If a bus is ready to go but it's not its time yet then it waits.
  • They limit the number of people getting on the bus.
  • They do something if people are not getting off the bus!


Feller's walk

Image you have a fair coin, and you flip it 1000 times, adding 1 or subtracting 1 each time you flip either a head or a tail respectively. How do you think the cumulative total will behave as the number of coin flips progresses from 1 to 1000?

Don Reinersten poses this question in his excellent book the Principles of product development FLOW. Don read it in William Feller's book An introduction to probability theory and its applications.

Feller says most people, even trained mathematicians and statisticians, assume that the cumulative total will hover around zero. It doesn't. It tends to drift further and further above or below zero. In fact, there is only a 50% chance the cumulative total will cross the zero line in the second 500 flips! Intrigued by this I've written a short javascript program to simulate 5000 walks and plot two graphs (using the jQuery flot library). You can grab my code from github if you're interested.

The first graph plots the cumulative total on a single walk.

  • Y-axis is cumulative total, marked -40,-20,0,20,40
  • X-axis is walk step, marked 0,100,200,...,900,1000
The walk plotted above is fairly typical - it drifts down and ends with a cumulative total of about Y=-42 at X=1000.

The second graph plots the probabilities for the cumulative total after N flips at
  • N=10 (orange line)
  • N=30 (blue line)
  • N=100 (red line)
  • N=1000 (green line)
  • Y-axis is probability, marked 0.00, 0.05, 0.10, 0.15, 0.20, 0.25
  • X-axis is cumulative total, marked -125,-100,-75,-50,-25,0,25,50,75,100,125
The most probable value for the cumulative total is always zero, but this probability gets lower and lower as N increases. After 1000 flips of a fair coin, there's only about a 1 in 50 chance the cumulative total will be zero. I find that pretty amazing. Without constraints variance will accumulate. As Don says

over time queues will randomly spin out of control ... You cannot rely on randomness to correct the problems that randomness creates.


kanban musing


Here's a typical kanban board; three vertical sections, each with a work-in-progress wip-limit, each split into two sections; Ongoing work on the left, Done work on the right. I've been thinking about the Done columns. Specifically, the fact that they are labelled Done. You see, Analysis's Done is Development's Backlog. And Development's Done is Acceptance's Backlog. So none of the Done's are really done. Not done-done. Why are they labelled Done? Why not Backlog? Or donelog? The labelling seems to reflect a push mentality. I wonder whether there is a better way to draw and label them. One that places equal weight on removing items from the queue. One that would help to suggest a more connected process. Perhaps draw it between Development and Acceptance but inside neither?

I've also been pondering the label "wip-limit". In the picture above, Development has a wip-limit of 3. That strikes me as a bit odd. Development's limit of 3 is really a combination of a work-in-progress-limit for its left-half Ongoing column, and a work-not-in-progress-limit for its right-half Done column. Since Development's right-half Done column is also Acceptance's Backlog why does Acceptance not have a say on that part of the limit?

Even the word itself "wip" conjures an image of frenetic activity. A fast moving, whip cracking wip. Can't we have another word for the limit on the work that is not in progress? One that conjures an image of stillness? Any ideas? After all, as Don Reinersten says

making activities more efficient is much less important than eliminating inactivity


non violent communcation

is an excellent book by Marshall Rosenberg (isbn 978-1892005038). As usual I'm going to quote from a few pages:
Observing without evaluating is the highest form of human intelligence.
NVC is a process language that discourages static generalizations; instead, evaluations are to be based on observations specific to time and context.
In the sentence, "I feel I didn't get a fair deal," the words I feel could be more accurately replaced with I think.
When the faculties are empty, then the whole being listens.
Intellectual understanding blocks empathy.
I had read research indicating a lack of agreement among psychiatrists and psychologists regarding these terms. The reports concluded that diagnoses of patients in mental hospitals depended more upon the school the psychiatrists had attended than the characteristics of the patients themselves.
When we have a judgemental dialogue going on within, we become alienated from what we are needing and cannot then act to meet those needs. Depression is indicative of a state of alienation from our own needs.
Studies in labor-management negotiations demonstrate that the time required to reach conflict resolution is cut in half when each negotiator agrees, before responding, to accurately repeat what the previous speaker had said.
Don't just do something, stand there.
When we focus on clarifying what is being observed, felt, and needed rather than on diagnosing and judging, we discover the depth of our own compassion.

Thinking fast and slow

is an excellent book by Daniel Kahneman (isbn 978-0-141-03357-0). As usual I'm going to quote from a few pages:
The accurate intuition of experts are better explained by the effects of prolonged practice than by heuristics.
It is the mark of effortful activities that they interfere with each other.
It is easier to recognize other people's mistakes than our own.
A sentence is more easily understood if it describes what an agent does than if it describes what something is, what properties it has.
You will find in the changing size of your pupils a faithful record of how hard you worked.
Cognitive strain is affected by both the current level of effort and the presence of unmet demands.
This quality of pastness is an illusion. The truth is, as Jacoby and many followers have shown, that the name David Stenbill will look more familiar when you see it because you will see it more clearly.
I find this astonishing. A sense of cognitive ease is apparantly generated by a very faint signal from the associative machine, which "knows" that the three words are coherent (share an association) long before the association is retrieved.
Do the good feelings actually lead to intuitions of coherence? Yes, they do.
An important principle of skills training: rewards for improved performance work better than punishment of mistakes.
Professional golfers putt more accurately for par than for a birdie.
A single cockroach will completely wreck the appeal of a bowl of cherries, but a cherry will do nothing at all for a bowl of cockroaches. [Paul Rozin]
Our brains are not designed to reward generosity as reliably as they punish mistakes.
In addition to improving the emotional quality of life, the deliberate avoidance of exposure to short-term outcomes improves the quality of both decisions and outcomes.


Poker hands in Ruby

John Cleary (@TheRealBifter) is doing a nice project - The 12 TDD's of Xmas. Day 11 was Poker Hands. I did it in Ruby. Here's the code from traffic-light 116.

Tests first:
require './card'
require './hand'
require 'test/unit'

class TestUntitled < Test::Unit::TestCase

  def test_start
    hand = Hand.new("2H 4S 4C 2D 4H")
    assert_equal Card.new('2',:hearts),   hand[0]
    assert_equal Card.new('4',:spades),   hand[1]
    assert_equal Card.new('4',:clubs),    hand[2]
    assert_equal Card.new('2',:diamonds), hand[3]
    assert_equal Card.new('4',:hearts),   hand[4]
  end

  def test_card_has_pips_and_suit_set_on_creation
    card = Card.new('2',:hearts)
    assert_equal '2', card.pips
    assert_equal :hearts, card.suit
    card = Card.new('T',:hearts)
    assert_equal 'T', card.pips
    assert_equal :hearts, card.suit
    card = Card.new('J',:hearts)
    assert_equal 'J', card.pips
    assert_equal :hearts, card.suit
    card = Card.new('Q',:hearts)
    assert_equal 'Q', card.pips
    assert_equal :hearts, card.suit
    card = Card.new('K',:hearts)
    assert_equal 'K', card.pips
    assert_equal :hearts, card.suit
    card = Card.new('A',:hearts)
    assert_equal 'A', card.pips
    assert_equal :hearts, card.suit
  end

  def test_hand_ranked_three_of_a_kind
    assert_equal :three_of_a_kind, Hand.new("2H 4S 4C AD 4H").rank
  end

  def test_hand_ranked_one_pair
    assert_equal :one_pair, Hand.new("2H 4S 5C JD 4H").rank
  end

  def test_hand_ranked_two_pairs
    assert_equal :two_pairs, Hand.new("2H 4S 5C 2D 4H").rank
  end

  def test_hand_ranked_flush
    assert_equal :flush, Hand.new("2H 4H 6H 8H TH").rank
  end

  def test_hand_ranked_straight
    assert_equal :straight, Hand.new("2H 3C 4H 5H 6H").rank
  end

  def test_hand_ranked_full_house
    assert_equal :full_house, Hand.new("2H 4S 4C 2D 4H").rank
  end

  def test_hand_ranked_four_of_a_kind
    assert_equal :four_of_a_kind, Hand.new("2H 4S 4C 4D 4H").rank
  end

  def test_hand_ranked_straight_flush
    assert_equal :straight_flush, Hand.new("2H 4H 3H 5H 6H").rank
  end

  def test_hand_ranked_high_card
    assert_equal :high_card, Hand.new("2C 3H 4S 8C AH").rank
  end

  def test_full_house_beats_flush
    black = Hand.new("2H 4S 4C 2D 4H")    
    white = Hand.new("2S 8S AS QS 3S")
    assert_equal 1, black <=> white
  end

  def test_higher_card_wins_if_equal_rank
    black = Hand.new("2H 3D 5S 9C KD")
    assert_equal :high_card, black.rank
    white = Hand.new("2C 3H 4S 8C AH")
    assert_equal :high_card, white.rank
    assert_equal -1, black <=> white
  end

  def test_equal_hands
    black = Hand.new("2H 3D 5S 9C KD")
    assert_equal :high_card, black.rank
    white = Hand.new("2D 3H 5C 9S KH")
    assert_equal :high_card, white.rank
    assert_equal 0, black <=> white
  end

end
Code second:
class Hand

  def initialize(cards)
    @cards = 
      cards.gsub(/\s+/, "")
           .scan(/.{2}/)
           .map{|ch| Card.new(ch[0],suit(ch[1]))}
  end

  def [](n)
    return @cards[n]
  end

  def rank
    return :straight_flush if straight? && flush?
    return :flush          if flush?
    return :straight       if straight?

    pip_tallies = pip_counts.sort.reverse
    return {
      [4,1] => :four_of_a_kind,
      [3,2] => :full_house,
      [3,1] => :three_of_a_kind,
      [2,2] => :two_pairs,
      [2,1] => :one_pair,
      [1,1] => :high_card
    }[pip_tallies[0..1]]
  end

  def <=>(other)
    keys <=> other.keys
  end

  def keys
    [ranking,pip_counts]
  end

private

  def ranking
    ranks.index(rank)
  end

  def ranks
    [
      :high_card,
      :pair,
      :two_pairs,
      :three_of_a_kind,
      :straight,
      :flush, 
      :full_house,
      :four_of_a_kind,
      :straight_flush
    ]
  end

  def pip_counts
    "23456789TJQKA"
      .chars
      .collect {|pips| pip_count(pips)}
  end

  def pip_count(pips)
    @cards.count{|card| card.pips == pips}
  end

  def pip_flags
    pip_counts.map{|n| n > 0 ? 'T' : 'F'}.join
  end

  def straight?
    pip_flags.include? 'TTTTT'
  end

  def flush?
    suit_counts.any?{|n| n == 5}
  end

  def suit_counts
    suits.collect{|suit| suit_count(suit)}
  end

  def suits  
    [:clubs,:diamonds,:hearts,:spades]
  end

  def suit_count(suit)
    @cards.count{|card| card.suit == suit}
  end

  def suit(ch)
    return suits["CDHS".index(ch)]
  end

end
class Card

  def initialize(pips,suit)
    @pips,@suit = pips,suit
  end

  def ==(other)
    pips == other.pips && suit == other.suit
  end

  def pips
    @pips
  end

  def suit
    @suit
  end

end
You can replay my entire progression (warts and all) on Cyber-Dojo (naturally).

Galileo once said

You cannot teach a man anything; you can only help him to discover it in himself.


Phone Numbers in Ruby

John Cleary (@TheRealBifter) is doing a nice project - The 12 TDD's of Xmas. Day 10 was the Phone number prefix problem. I did it in Ruby. Here's the code from traffic-light 14.

Tests first (very minimal - I'm a bit pressed for time):
require './consistent'
require 'test/unit'

class TestUntitled < Test::Unit::TestCase

  def test_consistent_phone_list
    list = { 
      'Bob' => '91125426',
      'Alice' => '97625992',
    }
    assert consistent(list)
  end

  def test_inconsistent_phone_list
    list = { 
      'Bob' => '91125426',
      'Alice' => '97625992',
      'Emergency' => '911'
    }
    assert !consistent(list)
  end

end
Code second:
def consistent(list)
  list.values.sort.each_cons(2).none? { |pair| prefix(*pair) }
end

def prefix(lhs,rhs)
  rhs.start_with? lhs
end
The each_cons from the previous problem proved very handy here. As did none? I really feel I'm starting to get the hang of ruby. You can replay my entire progression (warts and all) on Cyber-Dojo (naturally).