Writing software is writing

In his book Patterns of Software Richard Gabriel devotes a whole chapter (Writing Broadside) to writing about writing. Writing software is an act of writing so to get better at writing software he suggests it is a good idea to get better at writing in general. I was reminded of the chapter when I listened to Kevlin Henney's Skillsmatter podcast Rethinking unit testing in C++.

In his talk Kevlin discusses identifiers. Names. Names are funny things. When developers choose names they have a difficult task. They have to balance two forces that are very definitely competing against each other. On the one hand longer names give more room to express intention - to create intention revealing names. A declaration is a declaration of intent, an expression is an expression of intent, a statement is a statement of intent. But on the other hand the names of our classes, our functions and our objects also participate as sub expressions in larger and larger expressions. In the context of use the pull of brevity is very powerful.

Kevlin reminds us that some names are never intended to be used at all! They never participate in expressions that we write! Brevity should not be a concern for such names. In a language that supports reflection your test framework will call the test method for you. The only time you write the name of the test method is when you define it.

Developers typically have a lot less practice at writing names when they are freed from the shackles of brevity so it's not really surprising test method names often smell so bad. They smell bad because they are too concise! Loosen up! Give yourself some space. Instead of writing a test method called test_index think about the intention deep inside your head and try to express that as a whole sentence. That's a difficult practice to develop. If I'm pair programming and as the navigator I see the driver struggling with a test method name I sometimes ask them to "put the mouse down and step away from the keyboard". We discuss, face to face, what the intention is. Freed from the code-silo mentality of the keyboard we can usually move quite rapidly from test_index to test_indexing to test_out_of_range_indexing to test_out_of_range_indexing_throws_exception.

The last additional suffix ...throws_exception is an important one. A good test name should express an expectation. This is a transformational name change. It transforms the idea of testing so that it becomes not-testing. The name becomes a proposition. And the tests inches closer towards being an executable specification.

Another example of the context of test/proposition names having a different meta-context from regular code is naming style. Kevlin suggests that even in a language with a strong camelCase or PascalCase naming convention there is a strong argument for naming test methods with underscores_as_separators. You aren't calling these methods. They aren't participating in larger expressions. The only time they appear is in a diagnostic. Experiments have shown there is a small but definite cognitive delay in reading camelCase or PascalCase identifiers once they get beyond around 30 characters.

bureaucracy

Back to quotes table-of-contents

From The Right Stuff
The esprit throughout NASA was tremendous... Bureaucratic lines no longer meant anything. Anyone in Project Mercury could immediately get to see anybody else about any problem that came up.

From Beyond Culture
By their very nature bureaucracies have no conscience, no memory, and no mind.

From Jerry Weinberg (in person)
Bureaucracy can be measured by how much people don't know why they're doing what they're doing.

From Good to Great
The purpose of bureaucracy is to compensate for incompetence and lack of discipline. Avoid bureaucracy and instead create a culture of discipline.

From It's Your Ship
More often than not, bureaucracies create rules and then forget why they were needed in the first place, or fail to see that the reasons for them no longer exist.

From Quality Software Management: Vol 2. First Order Measurement
Bureaucracy is each thing in control, but everything is out of control.

From John Boyd - the fighter pilot who changed the art of war
Anything new and different is feared by a bureaucracy.

From A Little Book of f-Laws
A bureaucrat is one who has the power to say 'no' but none to say 'yes'.

From Beating the System
Bureaucrats are usually empowered to say no to even reasonable requests, but they cannot say yes to them. This requires passing requests to a higher authority. Saying no inflates bureaucrats' self-images.

From the Mind of War
he was always testing the limits - of airplanes, people, science, the military, and, most especially, bureaucracies.

From Ackoff's Best
The most variety-decreasing type of social system is one we call a bureaucracy.

If you're going to sin, sin against God, not the bureaucracy. God will forgive you but the bureaucracy won't. [Admiral Hyman G. Rickover]

From Are Your Lights On?
Bureauracies always begin with some process of selection - a process which is never quite "natural" selection.

From Quality Software Management: Vol 2. First order measurement
Bureaucracy: people doing things whose purpose they don't understand.

From the DevOps Handbook
Bureaucracies are incredibly resilient and are designed to survive adverse conditions - one can remove half the bureaucrats, and the process will still survive.

The Buffalo Bridle

One of my favourite Laws from Jerry Weinberg's The Secrets of Consulting is The Buffalo Bridle, which is all about motivation.

You can make a buffalo go anywhere just as long as they want to go there.


The velocity/wip game

While I was at Jerry Weinberg's Problem Solving Leadership workshop last week (which was truly fantastic) I showed a group of fellow attendees a very simple velocity/wip game I've invented. You simply create some cards and arrange them into columns. Each card has a number written on it which is it's estimate. The photo shows the setup for our game; the left column (eg Analysis) contained the numbers 1,8,2; the middle column (eg Design) contained the numbers 1,1,5; the right column (eg Testing) contained the numbers 8,1,2. We put one person on each column; Darrin on analysis, Ted on Design, and Tim on Testing. Play proceeds as follows:
  • each player gets N (eg 3) dice which they each roll over and over again
  • if a player rolls a 1 they add one to their running tally (which starts at zero)
  • if their tally reaches a number on a card in their column they can move that card one column to the right and reduce their tally by that number
  • that's it! (you can also add wip limits to the columns if you like)
Paul was on the timer and gave us one minute. After the minute was up we added up the...
  • work-in-progress: the total of the cards still in the three columns
  • velocity: the total of the cards that got moved out of the rightmost column (into an extra rightmost column called Done)

The first minute

The wip was 25 and the velocity was 11. This makes a total of 36 which is greater than the total we started with. This is because there is also an extra left-most column called Backlog which contains more numbered cards. Darrin was on the left Analysis column and after moving all three of his cards into Ted's middle Design column he pulled some more work into his column from the Backlog. Despite this Ted was starved of work for part of the minute.

The second minute

We reset the board back to it's initial position and decided to try and increase the velocity by smoothing the work. We split the high cards into multiple smaller cards. For example, the 8 was split into 3,3,2. Then we did another minute's worth of work. This time the wip was 18 and the velocity was 18. Once again this makes a total of 36 and once again Darrin pulled in more work from the Backlog after emptying his Analysis column. Because the work was less lumpy Ted wasn't starved and the velocity went up.

The third minute

We reset the board back to it's initial position from the second minute. This time we decided to try and lower the work-in-progress left over at the end. After all, if the project got canceled that wip would be waste. To do this we agreed not to introduce any new work from the backlog, and also that anyone's dice could contribute to the tally on anyone's column. Then we did another minute's worth of work. This time the wip was 9 and the velocity was 20.

Summary

Simply by smoothing the work and working together we increased velocity by a factor of ~2 (11 to 20) and reduced the wip by a factor of ~3 (25 to 9). Simple!

The way to weath

is an excellent book by Benjamin Franklin. As usual I'm going to quote from a few pages:
We are taxed twice as much by our idleness, three times as much by our pride, and four times as much by our folly.
A life of leisure and a life of laziness are two different things.
The eye of the master will do more work than both his hands.
Buy what you do not need and soon you will sell your necessities.
It is easier to suppress the first desire than to satisfy all that follow it.
Experience keeps an expensive school, but fools will learn in no other.
If you want to be wealthy, think of saving as well as of earning.
What maintains one vice would bring up two children.

How to win friends and influence people

is a great book by Dale Carnegie. As usual I'm going to quote from a few pages:
Any fool can criticise, condemn, and complain - and most fools do.
Action seems to follow feeling, but really action and feeling go together; and by regulating the action, which is under more direct control of the will, we can indirectly regulate the feeling, which is not. (quoting William James)
Good manners, said Emerson, are made up of petty sacrifices.
I made it a rule, said [Benjamin] Franklin, to forbear all direct contradiction of the sentiment of others, and all positive assertion of my own.
I judge people by their own principles, not by my own. (quoting Martin Luther King)
Any fool can try to defend his or her mistakes - and most fools do.
If there is any one secret of success, said Henry Ford, it lies in the ability to get the other person's point of view and see things from that person's angle as well as from your own.

Einstein on conventional schooling

At Jerry Weinberg's Problem Solving Leadership workshop one of the handouts contains this quote from Einstein which spoke to me:

I soon learned to scent out that which was able to lead to fundamentals and to turn aside everything else, from the multitude of things which clutter up the mind and divert it from the essential.

The hitch in this was, of course, the fact that one had to cram all this stuff into one's mind for the examinations, whether one liked it or not. This coercion had such a deterring effect upon me that, after I had passed the final examination, I found the consideration of any scientific problems distasteful to me for an entire year.

It is, in fact, nothing short of a miracle, that the modern methods of instruction have not yet entirely strangled the holy curiosity of inquiry; for this delicate little plant, aside from stimulation, stands mainly in need of freedom; without this it goes to wreck and ruin without fail. It is a very grave mistake to think that the enjoyment of seeing and searching can be promoted by means of coercion and a sense of duty. To the contrary, I believe that it would be possible to rob even a healthy beast of prey of its voraciousness, if it were possible, with the aid of a whip, to force the beast to devour continuously, even when not hungry.

The Book - On the taboo against knowing who you are

is a great book by Alan Watts. As usual I'm going to quote from a few pages.
Attention is narrowed perception.
We need a notation for almost anything that can be noticed.
The human individual is not built as a car is built.
Differentiation is not separation.
To say that certain events are causally connected is only a clumsy way of saying that they are features of the same event, like the head and tail of the cat.
In the Nootka language a church is "housing religiously," a shop is "housing tradingly," and a home is "housing homely."
It is symptomatic of our rusty-beer-can type of sanity that our culture produces very few magical objects.
We have scrubbed the earth clean of magic. We have lost even the vision of paradise, so that our artists and craftsmen can no longer discern its forms.
No work is well and finely done unless it, too, is a form of play.
The goal of action is always contemplation - knowing and being rather than seeking and becoming.
Idolatry is not the use of images, but confusing them with what the represent.

I Ching

I do I Ching some mornings. It's part of a deliberate effort to try and improve my subconscious! Today the dice chose 1,2,1,1 which means tetragram ten.
Inner Harmony
In managing your instincts and embracing Oneness,
  Can you be undivided?
In focusing your Influence,
  Can you yield as a newborn child?
In clearing your insight,
  Can you become free of error?
In loving people and leading the organization,
  Can you take no action?
In opening and closing the gateway to nature,
  Can you not weaken?
In seeing clearly in all directions,
  Can you be without knowledge?

Produce things, cultivate things;
Produce but do not possess.
Act without expectation.
Advance without dominating.
These are called the Subtle Powers.