
Introduction-2
Richard Gabriel
Repetition, Generativity, and Patterns
Repetition---a Foucault pendulum, seawaves north of Santa Cruz, the
shapely, curved stride of a young woman---attracts us---a steady R&B
beat, night lullabies. Repetition---rhyming poetry, pre-dawn
coffee---defines our lives---suppertime, weekends, evenings out.
When we were born, the world, fresh, contained no repetitions. An
infant first smiles at his mother's return not because it is her but
because her presence repeats; later he smiles because the she who
returns is the same she. I take my daughter to the bus stop at 8:20 am
every day, and as we stop she waits a minute then looks up the road to
see the bus come over the ridgetop. She expects the bus at a
particular time and feels safe and human when it does---out of sorts and
stressed when it does not.
We understand all there is for us to understand through repeated parts
and portions. Grammar is our regularized grunting, song is our
stylized noisemaking, human society is our patterned gene stuff. We
live by recognizing and using recurrences, by relying on what happens
over and over. Unpredictability when not sought is feared.
Recurrence works because actions, characteristics, and relations that
are noticeable repeat. Every act---every thing---contains not only the
noticed repeated parts but also attendant, variable portions. The
recurrent parts stand out because our minds (our brains?) are
constructed that way.
Repetition as mantra is how we learn: 2x8 is 16, 3x8 is 24, 4x8 is
32. When I spelled ``stillness'' wrong in the 5th grade, I wrote it 100
times on the board. When I play squash and mis-hit or misdirect the
ball, I chant, ``follow through, follow through, you idiot.'' A mantra
of simple things. The magic of the chant---enchantment; inward
song---incantation. When the rhythm of repetition begins, the body
sways; when the repetition of chant continues, sometimes the chanter
cannot stop. Repetition is power.
What repeats is important and reveals commonality. What isn't repeated
is variable and can be highlighted or hidden. Repetition makes us feel
secure and variation makes us feel free. Abstraction reveals and
revels in what is common, the repetition, and what is abstract is
defined by the repeated. The remainder, in science, basks behind the
veil of ignorance, and the remainder, in computing, is filled in as
missing. Abstractions is what we know as long as what is repeated has
the magic of enchantment and song of incantation.
But, what of the mantra ``follow through, follow through''? Insistence
of rhythm is a mnemonic---in ancient times laws were expressed in
incantatory rhythms---and remembering and teaching are what we intend by
the incantation. The law of follow-through is hard to forget---it's a
law, though, that makes little sense: where is its enchantment? How
can advice about what to do after you hit a ball make any difference
to what happens when you hit it, or before?
The advice must work---because we hear it all the time---but how can it
work? Here's how: If you plan to contact the ball at a particular
point, your muscles will naturally begin slowing down just before you
get there---perhaps to guard against the jolt. When you try to slow down
the forward motion of your arm, muscles opposed to that motion
contract to counteract. Your arm, then, moves with ``noise'', jiggling
up and down, circling around; and power moving forward drops. Amplify
this by the length of the racket. Problems.
When you follow through, your arm is aiming at a point well beyond
where the racket will contact the ball, so there is no
deceleration. ``Don't decelerate, don't decelerate, you idiot!'' It
might make a mantra worth repeating, but it isn't advice you can take.
This mantra generates the effect we want---just as a seed generates the
flower which eventually blossoms. Just as the wind in the sand
generates dune designs and sidewinding sinews and ripples of grains of
sand. The power of generative activities is cousin to that of
repetition. Give a person something that can be done, and it will be
done. Science loves a clever explanation---the gyroscopic forces
generated by the front wheel of a bicycle cause the proper lean when
you turn---but the clever explanation is merely clever, and really only
good for a pleasant magazine article or MIT macho talk.
Generative mantras have the psychological power of ritual coupled with
the physical power of algorithm. Ritual builds on our need for
repetition and predictability, ritual is the basis of superstition---if
you step with your left foot at the top of the dugout, rub toward the
business end of the bat with the pine rag, dig a 3" trench to stand in
with your right toe, you will not strike out. Ritual calms---the ritual
of petting a dog lowers blood pressure below resting levels, makes
stutterers speak clearly.
Rituals, repetitions, recurrences: These are simply patterns, the
repeated parts, the familiar signposts that tame frightening
variations. You don't know what the pitcher will throw, but you know
how you will prepare as you walk to the plate. Rituals, like the
advice to follow through, are things people can follow.
Software---is it something we can learn to produce by scientific study?
Will type systems with nice semantics make it easy to produce and
maintain the 5-million-line telecom switching system? Will an
additional 30% in performance from unboxing data in a higher-order
programming language unleash productivity in the softwareworkplace?
I don't think so. Such work will help a few dedicated researchers
achieve tenure and assure a comfortable life for their long-enduring
families, but you might as well tell a novice tennis player about how
muscles decelerate and ask them to repeat their new stroke 20 times.
The work of the Hillside group is to remind us that people in teams
and groups write software, and that in the absence of rituals and
repetitions, recurrences, every step of the way for the individual is
invention and creation. Software engineering is not yet engineering
and won't be, cannot be, for decades if not centuries, because we
cannot yet recognize the important, repeatable parts. When we do we
will have patterns---recurrences, predictability.
Is it really possible we cannot yet recognize the repeatable parts?
For several years I traveled to Paris every few months, and my good
friend, Jerome, would always take me to the brasserie
where he'd order
oysters. Whenever I tasted them, all I could discern was salt water,
fat, and sometimes grit. Jerome didn't skimp, and many times we had
Locmariaquer oysters, but I ate the smallest polite number I could get
away with.
Years later I visited Point Reyes Station in California, and my friend
and I ordered oysters---Hog Island Sweetwaters. They're farmed in
Tomales Bay where the river enters the bay, and they are only slightly
salty. Suddenly I could taste oystertaste, sweet and lightly
eccentric, muscularly hard, central. The next day---guarding against
oddities---we ate oysters somewhere else, and once more I enjoyed
them. The next year or so I sampled oysters whenever I could, and even
when they weren't the Sweetwaters, I could taste the hint of
oystertaste and could enjoy that part of it---the repeated part.
Two years ago Jerome and I were in Portland, Oregon, and I took him to
Jake's where we dined on 5 dozen oysters of many types. He smiled and
ordered champagne for the two of us.
I needed to learn to recognize the repeated parts---it took years and
luck. Something as basic as flavor---I had to learn to taste it. Before
that, oysters tasted like poison.
Software tastes like poison. Patterns, possibly, will reveal the
sweetwaters.
Patterns embody the repetitions and recurrences within software; they
provide the lonely developer with rituals and familiarity, and prevent
him or her from falling prey to lossage. A pattern is a simple thing
to understand, the more so the more like a ritual it makes part of
development. Patterns feed on repetition, provide ritual. What
patterns leave out provdes freedom, a point of departure for
creativity.
There is no content to patterns---no one will ever produce a journal
article or conference paper whose content is a pattern or pattern
language---and if someone does, he's missed the point. Just as no one
will ever write an acceptable biomechanics paper whose content is the
advice to follow through.
If the ballplayer's ritual works it's because it relaxes him or gives
him confidence. Patterns should be like these rituals---people should be
able to follow them and perhaps there should rarely be reasons why or
the reasons can be the topic of a real scientific paper. The content
is not in the pattern---that's somewhere else---;the pattern holds only
the ritual part, and the pattern works by giving the developer
something to do with the knowledge only that ``if you do this, it will
work.'' Such patterns are called generative patterns. Patterns work
like rituals, patterns feed our need for repetition and
predictability, patterns are designed for people to use in their
lives---generative patterns work like magic. Generative patterns don't
require CS degrees to understand, to get their gist you don't need a
mathematical background---you just do what they say and win.
How do you produce generative patterns? You don't---you find them. They
are in systems written by virtuosos, they are in systems that are a
dream to maintain. If a great programmer comes to you and says ``hey,
look at this code I found,'' that's where you'll be able to mine
generative patterns. Someone invented or developed the code that
contains the patterns, but that's largely irrelevant: It's that the
same solution or style has been used and found habitable. We don't
find a single gold atom, we find veins and
nuggets---accumulation. Patterns are discovered because they are
well-used, they form a vein that anyone could find.
Great pattern writers are miners, they create nothing except the
wonderful explanation---they are writers, they aren't scientists, or
even engineers. CS departments consider them drudges, scribes,
amanuenses. Pattern writing geniuses won't get tenure anywhere, they
won't advise CEO's. A pattern writer won't ride off into the sunset
with the prize in his saddlebag
When we look at Christopher Alexander's patterns, we see that almost
all of them have to do with how people live in homes, towns, and
cities, with other people and alone, indulging in culture or savoring
spirituality. Few talk about engineering and construction. They are
short on physical explanation---we don't learn why light in a room
causes useful biological reactions, only that such places are alive
and comfortable. Alexander draws on centuries and millennia of
architecture, and he, with a group of about a dozen, spent nearly a
decade finding out 253 patterns.
We hunt today alone for software patterns in 40 years of code. Have we
found any patterns yet?
Anyone can write lines in verse with a rhythm and some rhyme---is it
poetry? Patterns are a form---the repetition calms, the variation
inspires---but are we still writing doggerel?
* * *
Kent Beck
Once there was a mountain kingdom whose economy was based on farming.
Wanting to get the most out of the limited arable land, the king set
up schools to teach all the inhabitants the principles of
farming---photosynthesis, weather, entymology. Upon graduation, each young lad
or lass was assigned a patch of land to farm and given seeds and
tools. Each was allowed, even encouraged, to farm their own way.
The results were disaster. Understanding the principles did not keep
new farmers from making terrible mistakes. Crops were planted at the
wrong time, crops in adjacent fields did not work together to limit
the depredations of insects, the soil was not maintained from year to
year.
As the food supply shrank, the country's residents became restless.
They brought their empty bellies before the king and demanded a
solution. He in turn brought together his wisest advisers and gave
them a choice---solve the farming problem, or learn to do without their
heads.
After many late night meetings where gallons of stimulating drinks
were consumed, the advisers reported to the king. "King," they said,
"the education given future farmers prepares them to farm in any
number of ways. Toothless old farmers know, however, that only a few
farming techniques deserve consideration. While understanding the
principles is important, understanding the techniques that work is
equally important. Bring together your most experienced and thoughtful
farmers. Have them write down what works in a book. Give this book to
new farmers, that they may avoid obvious mistakes and get on with
farming."
At first the book grew quickly, as new farming techniques were
recognized and recorded. It looked as if the book would grow so large
that no one would be able to understand it all. After a while, though,
it became apparent that many techniques were duplicates of others, and
that the recognition of new techniques had slowed to a trickle. The
book settled down to a weighty but manageable tome.
As farmers learned to read and use the book, the kingdom's food
production stabilized. Farmers could now take advantage of the wisdom
of others. When they faced a situation, they weren't responsible for
always inventing a unique solution, they could find a technique that
solved the problem. If no technique fit exactly, they were still able
to adapt techniques rather than start from scratch.
The farmers sometimes missed the crazy old days of wild invention. On
the whole, though, the kingdom was satisfied. The people ate well, so
they were happy. The king didn't have to listen to complaints all day,
so he was happy. And the advisers had solved the problem, so they
still had heads to be happy with.
The Beginning
|