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.