Showing posts with label patterns. Show all posts
Showing posts with label patterns. Show all posts

patterns

Back to quotes table-of-contents

From The Nature and Art of Workmanship
No two leaves of the same tree are precisely alike, each is individual: yet every one of them conforms to a recognizable pattern characteristic of the species.

From The Unknown Craftsman
If the material is poor the pattern will suffer.

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

The essence of a pattern is what it can do consistently.

From Quality Software Management: Vol 1. Systems Thinking
A locked-on system tends to hold itself to an existing pattern, even against logical reasons to change. … Lock-ons occur in clusters.

The quickest and surest way to classify organisations into similar patterns is by the way people think and communicate.

From Quality Software Management: Vol 2. First-Order Measurement
One of the most sensitive measures of the cultural pattern of any organization is how quickly it finds and removes problems.

Culture makes its presence known through patterns that persist over time.

From An Introduction to General Systems Thinking
And with this shift in time there occurs a shift in the entity of concern - from an object, a pattern of matter in space, to a behavior, a pattern of events in time. [R.W.Gerard]

From An Ecology of Mind
He was often accused of talking in riddles and never coming to the point. The question he posed "What is the pattern that connects?" was never meant to be answered, because the patterns are changing. It was the act of questioning that he was pushing for. Knowing that the eyes behind that curiosity will be the most apt to give the patterns of connection room to wiggle as they perpetually self correct. And to see the beauty in that process. [Nora Bateson]

From Mind and Nature
To be meaningful - even to be recognized as pattern - every regularity must meet with complementary regularities.

From The Silent Language
A pattern is only meaningful if analyzed on its own level.

From Leverage Points
Self-organization is basically the combination of an evolutionary raw material - a highly variable stock of information from which to select possible patterns - and a means for experimentation, for selecting and testing new patterns.

From Patterns of Software
In most types of abstraction the common pattern is replaced by a name, such as a function name, a macro name, a class name...

patterns of connection

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

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

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

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.

Andy and the crusty cobs

My friend Andy works on the railways. He used to work as a master baker at one of the big supermarkets. One of the items he baked was Crusty Cobs.

Clearly customers can only buy Crusty Cobs if there are some Crusty Cobs actually on the shelves. So the supermarket also employed a bakery supervisor to check Crusty Cob availability. (Naturally the supervisor was paid more than Andy. After all he was the supervisor.) Every day, at 4pm, the bakery supervisor arrived, clutching his clipboard, and counted the Crusty Cobs on the shelves; one, two, three, four, five, six, seven... Andy got praised if there was good Crusty Cob availability and chastised if there wasn't.

So Andy adapted. He baked extra batches of Crusty Cobs but waited to put them on the shelves until shortly before 4pm. Crusty Cob availability, as recorded by the supervisor, was very good. Customers wanting Crusty Cobs before 4pm were often disappointed.

A short while later as well as counting the Crusty Cobs on the shelves (always at 4pm), the supermarket also started counting the number of Crusty Cobs actually sold at the tills during the day. Now Andy also got praised if lots of Crusty Cobs were sold.

So Andy adapted. As well as sticking the Crusty Cob labels on the Crusty Cobs, he also printed extra Crusty Cob labels and stuck them on some Soft Rolls (same price). After all, who looks at the labels? So Crusty Cob sales, as recorded at the tills, were always very good. The number of Crusty Cobs actually bought by customers was somewhat less.

Not long after, the supermarket noticed a drop in the sales of Soft Rolls. They asked Andy not to bake so many Soft Rolls.

So Andy adapted. He baked less Soft Rolls, labelled them correctly, and put the extra Crusty Cob labels on the French Sticks. Customers wanting Soft Rolls, at any time, were often disappointed.

Goodhart's Law states:

When a measure becomes a target, it ceases to be a good measure.

Or, more colloquially:

Targets are where measures go to die.


refactoring in the shower

Some houses are populated only with teenagers. When one gets in the shower they notice the plug-hole is clogged with horrible gunk: hairs of indeterminate origin, bits of soap, spit, bogies, general fluff (like the stuff that grows in your belly button), congealed shower gel, etc., etc.,. But they don't clean out the plug-hole. After all, they didn't make the mess. When they've finished they're cleaner. But only slightly. And they don't clean the plug-hole. Partly because they then notice there's no towel. They curse the other teenagers as they walk around the house naked, dripping water as they go, looking for anything vaguely absorbant they can commandeer.
After a while the plug-hole gets so gunked up tackling it becomes a truly repulsive task. It actually clogs the plug-hole. The shower fills with water - it starts turning into a bath! But it wasn't designed as a bath. Splashes leak over the lip of the door. Water collects under the shower base where it's not visible. Not at first anyway. After a while the ceiling below the shower starts to discolour in a tell-tale circular pattern. But it goes unnoticed. At first anyway. Soon the ring grows so large it's unmissable. But it's ignored. After all, it's a full-scale call-the-plumber-and-tiler job now.

Some houses contain a mixture of teenagers and adults. When a teenager showers sometimes the plug-hole is gunk free and there's a dry towel but sometimes the plug-hole is gunked up and there's no dry towel. They can't quite understand this. But they never clean the plug-hole and never put up a clean dry towel. When an adult showers sometimes there's a build-up of plug-hole-gunk and no dry towel. They know the previous shower-goer was a teenager. Sometimes there's no plug-hole-gunk and there is a dry towel. They know the previous shower-goer was an adult. When they've finished they clean out any plug-hole-gunk and put up a new dry towel.

Some houses house only responsible adults. Whenever they start to shower they don't notice any gunk around the plug-hole because there never is any. And there's always a fresh clean towel. After they've showered they clear any plug-hole gunk and put up a new dry towel.

the silent language

is an excellent book by Edward T. Hall (isbn 0-385-05549-8). As usual I'm going to quote from a few pages:
Culture hides much more than it reveals, and strangely enough what it hides, it hides most effectively from its own participants.
Interaction has its basis in the underlying irritability of all living substance.
Culture is saturated with both emotion and intelligence.
Theodosius Dobzhansky, the great human geneticist, once observed that life was the result of neither design nor chance but the dynamic interaction of living substance with itself. He meant that life, in a changing environment, places such strains on the organism to adapt that, if this does not take place constantly, the organism as a species dies out.

Different cultures are analogous to different species in the sense that some of them survive whilst others perish. Some are more adaptive than others. The study of change, therefore, is the study of survival.
An often noted characteristic of culture change is that an idea or a practice will hold on very persistently, apparently resisting all efforts to move it, and then, suddenly, without notice, it will collapse.
The idea of looking at culture as communication has been profitable in that it has raised problems which had not been thought of before and provided solutions which might not otherwise have been possible.
We say, "I'll see you in an hour." The Arab says, "What do you mean, 'in an hour'? Is the hour like a room, that you can go in an out of it?" To him his own system makes sense: "I'll see you before one hour," or "I'll see you after one week." We go out in in the rain. The Arab goes under the rain.
...we all hold an illusion about talking, an illusion that talking is quite untrammeled and spontaneous and merely 'expresses' whatever we wish to have it express. This illusory appearance results from the fact that the obligatory phenomena within apparently free flow of talk are so completely autocratic that the speaker and the listener are bound unconsciously as though in the grip of a law of nature. [Benjamin Whorf, Linguistics as an Exact Science]
Complete lack of congruence occurs when everything is so out of phase that no member of a culture could possibly conceive of himself creating such a mess.
Many artists... are credited with "creating" new patterns. Yet most artists know that what greatness they have lies in being able to make meaningful statements about what is going on around them. They say what others have tried to say but say it more simply, more directly, and more accurately, more incisively and with greater insight.
Talking about them... changes our relation with them. We move into an active and understanding correspondence with those aspects of our existence which are all too frequently taken for granted or which sometimes weigh heavily on us. Talking about them frees us from their restraint.

how to use conscious purpose without wrecking everything

is the title of the truly fantastic talk John Gall gave at Tom Gilb's annual Gilbfest a few weeks ago. You can read the whole thing here. Here's a small selection of the many snippets that spoke to me:
Maximizing efficiency is the error of having a single goal, what William Blake once called “Newton’s sleep.”
Always the more beautiful answer who asks the more difficult question [e.e.cummings]
Evolution always means Co-evolution. The horse eats the grass, the grass grows stronger roots, the horse grows stronger jaws.
What is involved is not simply survival of the fittest, but survival of the fitting-in-est.
The amount of feedback that is built into living organisms differs by many orders of magnitude from the amount that we build into manmade systems.
Flexibility means the willingness to act in response to the feedback message by actually changing how the system works.
There are many Potemkin Villages in operation today, hiding and distracting us from awareness of what’s really going on.
Ignoring feedback merely means that the system will eventually experience a massive unpleasant surprise rather than a small unpleasant surprise.
As Bradford Keeney pointed out, stability is not homeostasis, it’s homeodynamics.
Once you get above that first level, the level of material things and forces, you are dealing with abstractions. In place of physical forces, you have communication—messages, signals. And in place of material things, you have relationships—which are abstractions.
Once we get above the level of physical objects and forces, we are dealing with patterns of interaction, that is, with abstractions.
Abstractions — that is, ideas — don’t die. They can’t be killed. They can’t be exterminated. They just keep coming back, over and over and over. This problem can never be solved if one continues to believe that the so-called "real" world of physical objects and forces is all there is. The Chinese have a word for this. They call it "being stuck in the ten thousand things."
In order to become birds, dinosaurs had to give up being dinosaurs.
If I design a system with no regard for the universe that surrounds it, I will have scanty knowledge of what can impact it.


Smoking cigarettes, eating sweets, dropping litter, and drinking coffee

I was speaking to Olaf Lewitz at the awesome Oslo coach camp last week. We were discussing why drinking coffee doesn't create the same social dynamic as smoking cigarettes. I chatted with Geir Amdal too and quite by chance he mentioned he's given up smoking. And how approaching a work colleague and asking if they want to go outside for a smoke is not the same as asking if they want to go outside for a talk.

Then I remembered something Olve Maudal said to me recently. He said that kids being allowed to eat sweets on Sundays was not really about kids being allowed to eat sweets on Sundays at all. It was really about kids not being allowed to eat sweets on any day except Sunday. Similarly, apparently in the USA when you're driving along you sometimes see a big sign at the side of the road saying "Litter here" and then another sign a mile or so later saying "Stop littering". These signs are also not really about littering. They're about not littering in the places outside the designated littering zones.

There's a crucial difference between smoking and drinking coffee. Smokers tend to smoke in groups in designated areas because smoking is not allowed except in those areas. Coffee is different. Drinking coffee is, by default, allowed everywhere. When you want a coffee you walk to the coffee machine and make a cup of coffee. There's often no one else at the coffee machine so you take your cup of coffee back to your work desk. It is precisely this take-it-back-to-your-desk default which is why there is only rarely someone else at the coffee machine. It is a self-fulfilling dynamic.

If you want to encourage more social interaction between your team members here's what you might do:

  • Buy machines that make really good coffee.
  • Put them in a nice area with lots of space to congregate in.
  • Ban drinking coffee at work-desks.
The third step might seem a bit draconian. But it's vital. You could justify it on the grounds that spilling coffee onto expensive computers will waste money. But the real reason it to encourage developers to drink their coffee near the coffee machine. Together. To encourage communication.

Everyday heroes of the quality movement

is an excellent book by Perry Gluckman and Diana Reynolds Roome, subtitled From Taylor to Deming : The Journey to Higher Productivity (isbn 0945320078). As usual I'm going to quote from a few pages:
Look for the flaws in the system not in each other.
When we reduce complexity, we start to see the organism behaving as a whole rather than a series of parts.
The effects of preventative medicine are hard to measure.
Theories are only the beginning. Why do we find it so hard to exercise, or give up smoking, even when we know all the arguments.
Quality and productivity are results, not goals.
Automating complexity is never as effective as removing it.
I'm not trying to be destructive. I just want to open the doors to some breezes that feel a little chilling to start with.
If there are problems in the company, we don't borrow money. We solve the problems.
If you automate without first getting rid of complexity, you cast the complexity in concrete.
We do almost nothing to control our workers productivity. They are already doing their best without being goaded. What we all try to control is the process itself.
You need to know your financial direction as far as it can be known, and make sure that you don't hit any big rocks. But something else is more important: to design the ship so that it can withstand the blows when they come.

Quality Software Management
Vol 2. First-Order Measurement

is the title of an excellent book by Jerry Weinberg (isbn 0-932633-24-2). This is the second snippet review for this book (here's the first). As usual I'm going to quote from a few pages:
The update cycle on the project control panel should be scaled to something less than the longest period of time the project can afford to be late.
Large projects always fail when their communication systems fail.
The slowdown of fault removal is a major reason why project times are underestimated.
In the end, it's not the observation that counts, it's the response to the observation. That's why Zen masters teach patience in response.
Culture makes its presence known through patterns that persist over time.
What power corrupts most thoroughly is the ability to make meaning of observations.
Incongruent behaviour is the number one enemy of quality, because it disguises what people truly value.
If you can see it you can review it.
The switch from cost observation to value observation is the strongest indication that an organization has made the transition from Pattern 2 [Routine] to Pattern 3 [Steering].
In my consulting, I frequently talk to managers who seem obsessed with cutting the cost of software or reducing development time, but I seldom find a manager obsessed with improving value.
No other observational skill may be more important to software engineering than precision listening.

The unknown craftsman

is an excellent book by Sōetsu Yanagi (isbn 0-87011-948-6). As usual I'm going to quote from a few pages:
The good artist or craftsman has no personal pride.
Seeing relates to the concrete, knowing to the abstract.
To divine the significance of pattern is the same as to understand beauty itself.
A pattern is both true to nature and artificial.
If the material is poor the pattern will suffer.
By and large, good pattern is of communal parentage.
Beauty must have some room, must be associated with freedom.
The Theologica Germanica, written in the fourteenth century, tells is: "He would know before he believeth cometh never to true knowledge". Applied to the perception of beauty, this means that if a man employs the function of knowing before seeing, his power is impaired.
Intuition is the power of seeing at this very moment.
The thing shines, not the maker.
They are made without obsessive consciousness of beauty; thus we catch a glimpse of what is meant by "no-mindedness", whereby all things become simplified, natural, and without contrivance.

Synectics

is an excellent book by William J.J. Gordon (isbn 978-0060324308). As usual I'm going to quote from a few pages:
The word Synectics, from the Greek, means the joining together of different and apparently irrelevant elements.
Abstraction breeds more abstraction and more generality instead of leading to tough yes-no tests.
Words like intuition, empathy, and play are merely names put to complex activities in the hope that the naming of the activity will in fact describe it.
Human beings are heir to a legacy of frozen words and ways of perceiving which wrap their world in comfortable familiarity.
Synectics theory agrees with the conviction that a man does not know even his own science if he knows only it.
"All the crappy solutions in the world have been rationalized by deadlines."
He refused to recognize the fact that his search for the perfect problem was a way of avoiding failure in solving a less perfect one.
Invention is akin to painting for in practice, the element being constructed has the capacity to tell the builder what the next step should be. In invention this is much more critical than in engineering because the inventor is always attempting to do something new.
When this forgetfulness is formalized into a methodology, it reinforces the rejection of the commonplace.
Organic functions are unfinished, cylical, and self-reproductive... Synthetic functions are complete and more obviously subject to decay.
Conventions as abstractions from reality constitute a virtually complete and unassailable pattern, whereas the commonplace is infinitely repatternable.
The child who asks: "What's that funny noise?" is told the noise is thunder in such a way that speculation is supposed to stop... But naming the noise does not describe it. It does not answer the question, it kills it.

Adapt Parameter and Preserve Signature

Working Effectively With Legacy Code by Michael Feathers (isbn 0-13-117705-2) is a great book. The very first dependency breaking technique (p326) is called Adapt Parameter. It uses this Java example:



public class ARMDispatcher
{
    public void populate(ParameterSource request) {
        String[] values
            = request.getParameters(pageStateName);
        if (values != null && values.length > 0)
        {
            marketBindings.put( 
                pageStateName + getDateStamp(),
                values[0]);
        }
        ...        
    }
    ...
}


Michael writes:

In this class, the populate method accepts an HttpServletRequest as a parameter. ... It would be great to use Extract Interface (362) to make a narrower interface that supplies only the methods we need, but we can't extract an interface from another interface. ...


and a bit later...

Adapt Parameter is one case in which we don't Preserve Signatures (312). Use extra care.


Well, here's a variation on Adapt Parameter where we do Preserve Signatures. I'll stick with the Java example, but the idea is broadly applicable...

First we create our ParameterSource interface and fill it with the signatures of the methods in HttpServletRequest that our populate method calls:

public interface ParameterSource
{
    String[] getParameters(String name);
}
then we implement the adapter for HttpServletRequest:
public class HttpServletRequestParameterSource 
    implements ParameterSource
{
    public HttpServletRequestParameterSource(HttpServletRequest request) {
        this.request = request;
    }

    public String[] getParameters(String name) {
        return request.getParameters(name);
    }

    private HttpServletRequest request;
}
Next we add an overload of populate taking a ParameterSource and implement it with an exact copy-paste:
public class ARMDispatcher
{
    public void populate(ParameterSource request) {
        String[] values
            = request.getParameters(pageStateName);
        if (values != null && values.length > 0)
        {
            marketBindings.put(
                pageStateName + getDateStamp(),
                values[0]);
        }
        ...        
    }

    public void populate(HttpServletRequest request) {
        String[] values
            = request.getParameters(pageStateName);
        if (values != null && values.length > 0)
        {
            marketBindings.put(
                pageStateName + getDateStamp(),
                values[0]);
        }
        ...        
    }
    ...
}
Now we Lean on the Compiler (315) to make sure we haven't missed any methods in HttpServletRequest that our populate method calls. Add any we missed to the ParameterSource interface. Implement them in HttpServletRequestParameterSource as one liners. When it compiles we can refactor to this:
public class ARMDispatcher
{
    public void populate(ParameterSource request) {
        String[] values
            = request.getParameters(pageStateName);
        if (values != null && values.length > 0)
        {
            marketBindings.put(
                pageStateName + getDateStamp(),
                values[0]);
        }
        ...        
    }

    public void populate(HttpServletRequest request) {
        populate(new HttpServletRequestParameterSource(request));
    }
   ...
}
And now we have a seam we can pick it at...
public class FakeParameterSource 
    implements ParameterSource
{
    public String[] values;

    public String[] getParameters(String name) {
        return values;
    }
}


Tao Te Ching

is an excellent book translated by R.L.Wing (isbn 0-7225-3491-4). As usual I'm going to quote from a few pages

In trying to understand a work like the Tao Te Ching, it is important to keep in mind that Chinese characters are not so much representations of words as they are symbols of ideas.
Because of its idea-embedded nature, the Tao Te Ching is a work that brings truth to the adage: It is better to read one book one-hundred times than one-hundred books one time.
True power is the ability to influence and change the world while living a simple, intelligent, and experientially rich existence.
Simplicity in conduct, in beliefs, and in environment brings an individual very close to the truth of reality.
When expectations are dropped, the mind expands, and reality expands along with the mind.
Nothing exists without the presence of its opposite.
Practice non-interference.
A house filled with riches cannot be defended.
Individuals who master themselves become less egocentric
Evolved Individuals strive to be intuitive, spontaneous, and simple.
Never fall completely into step with current society.


Spot the Tao Te Ching Bug

Most mornings I read one of the 81 entries in Tao Te Ching . My copy is called The Tao of Power, translated by R.L.Wing. Highly recommended. I use dice together with the chart in the picture (from page 19) to make a random selection. This morning I happened to notice that I never seem to get certain numbers. Closer inspection of the chart shows why...

JavaScript: The Good Parts

is an excellent book by Douglas Crockford (isbn 978-0-596-51774-8). As usual I'm going to quote from a few pages:
This is not a book for beginners... This book is small but it is dense. There is a lot of material packed into it. Don't be discouraged if it takes multiple readings to get it. Your efforts will be rewarded.
JavaScript's popularity is almost completely independent of its qualities as a programming language.
JavaScript is the first lambda language to go mainstream. Deep down, JavaScript has more in common with Lisp and Scheme than with Java.
strong typing does not eliminate the need for careful testing.
despite its deficiencies, JavaScript is really good.
Unlike many other languages, blocks in JavaScript do not create a new scope, so variables should be defined at the top of the function, not in blocks.
An object is a container of properties, where a property has a name and a value. A property name can be any string, including the empty string. A property value can be any JavaScript value except for undefined.
An inner function also enjoys access to the parameters and variables of the functions it is nested within... This is called closure. This is the source of enormous expressive power.
That act of nothingness gives us confidence that the function does not recurse forever.
What matters about an object is what it can do, not what it is descended from. JavaScript provides a much richer set of code reuse patterns.
Much of the complexity of class hierarchies is motivated by the constraints of static type checking.
var memoizer = function(memo, formula) {
    var recur = function(n) {
        var result = memo[n];
        if (typeof result !== 'number') {
            result = formula(recur, n);
            memo[n] = result;
        }
        return result;
    };
    return recur;
};

var fibonacci = memoizer([0, 1], function(recur, n) {
    return recur(n - 1) + recur(n - 2);
});

The nature and art of workmanship

is an excellent book by David Pye (isbn 1-871569-76-1). As usual I'm going to quote from a few pages:
Design is what, for practical purposes, can be conveyed in words and by a drawing: workmanship is what, for practical purposes, can not.
The essential idea is that the quality of the result is continually at risk during the process of making.
The care counts for more than the judgement.
Much of what is ordinarily called skill is simply knowledge.
There is a strong incentive to design only in terms of shapes which are easy to communicate.
No two leaves of the same tree are precisely alike, each is individual: yet every one of them conforms to a recognizable pattern characteristic of the species.
Design - the music of design - depends on the relationships between distinguishable and separable features of things.
It [workmanship] takes over where design stops.
You must not torture your material.
We can have no direct rapport with the nature of any material, but have to judge what it is by looking at the surface. We can never see the thing, the material itself, but only the surface, which our vision, unlike X-rays, will not penetrate.

Nearest exits x 2

As best as I can recall, on every flight I've ever been on, when the safety announcements are made in two languages they are done sequentially. First the whole thing in Norwegian (say) with the accompanying demonstrations; nearest exits, floor lighting, decompression air masks, lifevest strap, lifevest inflation, lifevest whistle, lifevest light, etc. And then the whole thing again in English with the same demonstrations again.


On my little KLM flight from Linköping to Copenhagen it was different. This time the two languages were interleaved. The steward demonstrated the nearest exits whilst the canned audio spoke the appropriate nearest exit words in Dutch, but then rather than moving on to demonstrating the floor lighting (with appropriate floor lighting canned audio in Dutch) he immediately demonstrated the nearest exits again whilst the canned audio spoke the appropriate nearest exits words in English. Nearest exits taken care of, the steward and canned audio moved on to the next topic, floor lighting - again first in Dutch with a demonstration, then in English with the demonstration again. The effect was that even though I don't know Dutch I saw each demonstration twice.



Utility surprises

One of these photos is of the cutlery drawer. I know exactly what it contains: knives, forks, and spoons. Its the cutlery drawer. It's name tells you what to expect when you open it.


The other photo is of.... well it doesn't really have a name in our house - it's just "the drawer" - but it's what Michael McInyre hilariously calls the man-drawer (start at 1 minute 30 seconds). I thought it would be interesting to see what's in it:

  • keys, 15, of which only 4 have a known current use
  • plastic coin bank bags, 5, all empty
  • glue, 4 x super-glue, 2 x glue-stick, 1 x bostik, 3 still usable
  • pens, 4 black, 1 grey, 1 red, a few still usable
  • spanners, 1 x 7/16", 1 x 10mm
  • chalk, 1, yellow, an escapee, we have a chalk box elsewhere
  • radiator bleeding keys, 1 yellow, 1 red, 1 black
  • drill chuck key, so that's where it is!
  • drill bits, 3, I never knew they were there
  • tape, 1 x sellotape, 1 x black electricians - aha, useful, pilfered for fishing
  • paper clips, about 50, loose, box-escapees
  • drawing pins, about 100, loose, box-escapees, be careful when rummaging
  • string, ah yes, would have been handy a few days ago
  • screwdrivers, 1 x 7" blue thin phillips, 3 x 4" watchmakers, plus 3 x 2" from an xmas cracker - never used, put in the drawer simply to keep the other screwdrivers company
  • screws, a few, loose, also keeping the screwdrivers company
  • tape measures, 1 x blue plastic non retractable, 2 x orange metal retractable, 1 x yellow metal retractable, clearly excess tape measures have been purchased when existing ones were temporarily lost
  • matchbox, large, half full
  • electrical lead, black, unknown use


Once you start a "utility" drawer it has an unstoppable force. All things can then be classified as being possibly of utility. It becomes a magnet for all things. If utility-drawers could expand infinitely they would turn into black-holes and consume everything in the known universe.


If you have a utility-drawer, unless it was born very recently in a house you've just moved into, it's almost certain to be completely full. Frequently you can't even close the utility-drawer because it's so full. When this happens a second immutable law kicks in - taking anything out of the utility-drawer is strictly forbidden. Possible work-arounds include brute-force drawer closure, crushing items flat, and jiggling the whole utility-drawer in a kind of simulated-annealing fashion in a vain attempt to get everything to settle down a bit.


Once your utility-drawer is full it will bud out into new forms. For example, I also have a utility-tin (batteries of indeterminate age live here), a utility-folder (instructions for 10 year old appliances live here), and a utility-cabinet (coins from out of circulation currencies live here). Michael would be proud.



Notes on the synthesis of form

is an excellent book by Christopher Alexander (isbn 0-674-62751-2). As usual I'm going to quote from a few pages:
Poincaré once said: "Sociologists discuss sociological methods; physicists discuss physics." I love this statement. Study of method by itself is always barren.
Culture is changing faster than it has ever changed before...what once took many generations of gradual development is now attempted by a single individual.
Modern mathematics deals at least as much with questions of order and relation as with questions of magnitude.
If the world were totally regular and homogeneous, there would be forces, and no forms. Everything would be amorphous. But an irregular world tries to compensate for its own irregularities by fitting itself to them, and thereby takes on form. D'Arcy Thompson has even called form the "diagram of forces" for the irregularities.
No complex adaptive system will succeed in adapting in a reasonable amount of time unless the adaptation can proceed subsystem by subsystem, each subsystem relatively independent of the others.
We define a concept in extension when we specify all the elements of the class it refers to. And we define a concept in intension when we try to explain its meaning analytically in terms of other concepts at the same level.
Design is by nature imaginative and intuitive.
Every form can be described in two ways: from the point of view of what it is, and from the point of view of what it does.
It is the culmination of the designer's task to make every diagram both a pattern and a unit. As a unit it will fit into the hierarchy of larger components that fall above it; as a pattern it will specify the hierarchy of smaller components which it itself is made of.
What is it about the internal structure of any problem that makes it hard to solve? In nine cases out of ten, we cannot solve it, because we cannot grasp it.