A Pattern Language

I’ve been seeing people recommend A Pattern Language (amazon, very large pdf) here and there for a few years now and finally picked it up. I’ve only begun to read it, but it is a truly remarkable work. In particular it draws a thick and complex connection between design and ethics.

(Skimming the wikipedia page of the first listed author makes me want to read much more of his work.)

This book simultaneously defines what a pattern language is, makes a case for how they should be used in design, and provides an example.

Designers of any sort (industrial designers, graphic designers software, urban planners, etc) work explicitly or implicitly based on patterns that they have learned about, developed, or identified. If I own land and want to sleep indoors, I might think about the pattern “Single Family Home” and create a design based on that pattern. And we need patterns for the whole spectrum of human existence that emerges through design, from the way our highest political entities are arranged (“Independent Regions”) through cities (“Subculture Boundaries”, “Night Life”), and so on (“Looped Local Roads”, “Compost”)

How do different patterns, though, connect to each other? There’s the concept of a Pattern Library which I’ve often seen in the tech space (example). The Library metaphor asserts that patterns should be listed and categorized. But metaphor of a Pattern Language goes much farther in exploring the rich connections between patterns, the syntax by which they can be juxtaposed, and the layers of meaning that they bring to bear when they are used together in different ways. A library can only be constructed and maintained, usually by a single entity. A library, unlike a language, does not usually develop and evolve organically.

Every society which is alive and whole, will have its own unique and distinct pattern language; and further, that every individual in such a society will have a unique language, shared in part, but which as a totality is unique to the mind of the person who has it. In this sense, in a healthy society there will be as many pattern languages as there are people — even though these languages are shared and similar…

The language described in this book, though, is more like Esperanto than like English. It is not the dictionary of any observed pattern language, it is a call for a new language that will lead to a new and better lived existence for humanity. Languages differ in the fluency with which they can express certain concepts, and so each language comes with a value system and creating a language is an ethical acts. What kind of patterns should feel natural to express? What is clunky?

The language that has emerged in our society is a stunted, depraved language without humanity. We have a pattern for billboards, for surveillance cameras, for strip malls, for old age homes.

[W]e have written this book as a first step in the society-wide process by which people will gradually become conscious of their own pattern languages and work to improve them. We believe…that the languages which people have today are so brutal, and so fragmented, that most people no longer have any language to speak of at all — and what they do have is not based on human, or natural considerations. [emphasis added]

The language in this book contains, on the contrary, patterns like the following:

  • Magic of the City
  • Old People Everywhere
  • Children in the City
  • Holy Ground
  • Connected Play
  • A Room of One’s Own
  • Garden Growing Wild
  • Communal Sleeping
  • Window Overlooking Life
  • Secret Place

These are only a few with particularly obvious ethical ramifications, but every pattern and every connection expresses an ethics, and creating such a language is a lasting way to codify your ethics.

Any such set of design principles contains within it an ethics and ethics are sometimes best expressed as design principles. In particular, I’m familiar with the conversation around dat a ethics. Usually when we talk about data ethics we are saying “here are the set of tools we’ve designed and built, and over there is our thinking about ethical ways to use them.” But those tools were also designed within a value system that is embedded not just in the design of the specific tool but the whole web of existence.

In the book’s domain (the built environment), we might think about the design of a single house. What ethics are embedded in the way a house is designed? How many people is built for, and what kinds of living arrangements? But the design of the house broadly speaking must also connect to the design of the broader society and its ethics: what materials are used, and what sorts of labor arrangements are assumed to be available? What is nearby, and what can we assume about the ways that neighborhood will change over time? What is the anticipated lifespan of this building and how might its uses change in the future?

Similarly, maybe talking sensibly about data ethics requires connecting it more deeply to the patterns we use as designers, and thinking more broadly about what those patterns are that we use and the timescales and means by which they change.

We have spent years trying to formulate this language, in the hope then when a person uses it, he will be so impressed by its power, and so joyful in its use, that he will understand again, what it means to have a living language of this kind. If we only succeed in that, it is possible that each person may once again embark on the construction and development of his own language — perhaps taking the language printed in this book, as a point of departure.

Police Science

Very much enjoying Jackie Wang’s Carceral Capitalism.

Especially liked this thought in “This Is A Story About Nerds and Cops“:

Given that critics of the police associate law enforcement with the arbitrary use of force, racial domination, and the discretionary power to make decisions about who will live and who will die, the rebranding of policing in a way that foregrounds statistical impersonality and symbolically removes the agency of individual officers is a clever way to cast police activity as neutral, unbiased, and rational.

Complex actions need specialized interfaces

Yesterday I was in a room with a Bloomberg terminal. Bloomberg is specialized software used by financial professionals to navigate data and take actions. Users interact with the system through a specialized keyboard that looks like this:

These keyboards are easy to laugh at, they look antiquated and ridiculous. They look kind of like toys for people who don’t know how to use real computers. But I really like them, or at least I like the underlying idea:

Specialized tools need specialized interfaces.

Keyboards are specialized text-entry devices. It’s easy to forget this because they are our main interface with computers, which are general-purpose engines. But it’s crazy to think that it is the best tool for every program, for every cognitive environment that we can imagine implementing in software. We knew this once but in the name of efficiency we have forgotten it.

Good history museums remind you that history is not a linear, predetermined progression. Natural history museums, for example, are fascinating not just because we can see the apes from which we descended but the vastly stranger evolutionary dead-ends. I feel the same way at the Computer History Museum. Looking back there seems to be a sort of Cambrian explosion in the late 60’s/early 70s where the fundamentals of our computers were beginning to fix in place, but the world was still wide open. This was when the mouse was invented, along with stranger beasts like the “chorded keyboard”, where you play different letters with different combinations of keypresses:

But even this is just a text input device. The keyboard is a workhorse because we have abstracted the computer towards it – because we had keyboards before computers.

But for highly specialized cognitive work, there may be better ways to interface. No one would try to play a piano with a computer keyboard and mouse. PC gamers and flight simulator use joysticks. Console gamers use specialized controllers. Why don’t we have better input devices for programming, for data analysis, for planning timelines and budgets. The Bloomberg keyboard, like the Apple touchbar, is a small halting step in this direction.

Related links:

Contributing to pandas

Very proud to announce today that I had a pull request merged into the pandas library. In version 0.21, pandas will have a new feature: a way to read in line-delimited JSON in small pieces, which can be useful when working with large files or streams.

This is a fairly small change, technically, but a big deal for me.  Pandas is one of the most commonly used tools in the data science world. When I started at TrueAccord they bought me the book on pandas (Volume 2 coming out next month!). This was my first introduction to any programming language other than Stata, an odd proprietary language that languishes on among economists and epidemiologists. Now, writing software is a core part of my career.

Related, I highly recommend  The Success of Open Source, in which Steven Weber outlines the varied ways in which open source communities elicit and channel cooperation, and explores the complex set of motivations that leads people to contribute to open source.

What I’ve been reading lately

Rebecca Solnit, River of ShadowsSolnit is a marvelous thinker and historian who moves smoothly between well-researched historical fact and philosophical reverie. Here she traces the life of Edward Muybridge whose motion studies of animals are still familiar today. Muybridge was a first-class photographer, a true artist who also made many technical innovations. Solnit takes his collaboration with Leland Stanford as the jumping-off point for an exploration of the way technology has annihilated time and space, and develops a genealogy from those two to the California of today, dominated by Hollywood and Silicon Valley. In her telling, these two industries named for physical places are at the center of a world that, in large part because of their doing, is increasingly disconnected from the world itself.

Mary Robison, Why Did I EverA few years back I made a note to myself to read this novel. I can’t recall why, or at whose urging, but I’m glad I did. Told in over 500 short fragments, Robison is funny and poignant. I was sad to have finished this book.

Diane Coyle, GDP: A Brief but Affectionate HistoryI’ve been meaning to read this for a while, but I am, so far, disappointed. GDP is the single measure that people associate with economic health and growth, to the extent that people say “the economy grew” when they mean “GDP grew”. How the economy is measured could not be more important and Coyle lays out some of the history of how GDP developed, and some of the ways in which it is flawed. This wasn’t the right level of depth for me — took some things for granted and was disappointingly shallow elsewhere — but seems like a good starting point for a deeper read into these ideas.

Nitt Witt Ridge

Art Beal spent 61 years building a house out of found materials at Nitt Witt Ridge in Cambria, CA. He served for a time  as the town garbageman, dumping his truck directly into his own backyard and rummaging for salvageable building supplies with which he slowly built a house in the shape of his own mind. There is now little trace of the 20 feet of landfill underneath the hill. where his house rests.

Beal, born in Oakland, was a celebrated long-distance swimmer in his youth but decamped in his 20’s to Cambria, 200 miles south along the California coast. He built a small house and lived in it with “Gloria” whose life is otherwise lost to history. At some point she disappeared. He abandoned that house and began constructing his masterwork, the unfinished project of the rest of his life.

There is no place in our world for some men. Through accident of birth some men are born different and they accumulate injuries in the world as they repeatedly are rammed through holes of the wrong shape. Beal was lucky. He found a place for his energy, found a way to preserve himself in a world that has no room for difference of mind.

USAFacts, Corporate Hagiography and Historical Ignorance

This morning my circles are talking about Steve Ballmer’s new government data initiative USAFacts as reported in this NYT article.

It’s an interesting project, and I am glad that this is how Ballmer is spending his dotage! It’s a lot better than going into VC as a lot of other tech execs seem to do as they age. I wish him the best.

HOWEVER

This is not the first time someone has worked on making government data more accessible. I wish that Ballmer and the media coverage around this launch spent any time at all discussing the many other similar initiatives and how this fits into the ecosystem.

For example, the mission of “a comprehensive summary” is interesting and different, but represents a tradeoff compared to deep contextual understanding. Contrast with the “Scarsdale” series by Thomas Levine https://thomaslevine.com/!/scarsdale/, for example. Also, this is a classic example of the “How Standards Proliferate” process. Everyone who comes along thinks: “If only there were one canonical home for all government data!” And then you end up with 15 different portals.

I think most notably, USAFacts doesn’t actually make their data open, they just publish reports. That’s a major departure from what a lot of other players are doing, and I wish there was any discussion about why they made that choice. Are there legal requirements connected to some of the data? Surely at least some of it could be open. Is it a desire to keep a “moat”? Who knows!

The tone around this launch irks me in the same way most tech coverage irks me. Ballmer is not the first to think of it, not by a long shot. And his effort to understand what was already out there seems….cursory, at best. Googling “open government data” would have been a very good start.

Why was this published in NYT’s DealBook section? It’s not business reporting at all. DealBook seems to exist as a WSJ competitor so the Times can attract the crowd that just wants corporate hagiography. Related: https://twitter.com/louispotok/status/423173257110372352

If you are interested in learning more about different open datasets, this may be a good start: https://thomaslevine.com/!/open-data/better-datasets-about-open-data/

Edit: There are two comment threads on HN (1 2) about this, the discussion is pretty good so far. Fave comments:

Python tip: Inspect function signature at runtime

Problem:

I have a list of functions with different signatures. There is some set of possible parameters, and I want to call all these functions with the “appropriate” argument for each parameter.

This is a little hand-wavy, let’s look at an example:


def half(a):
    return a / 2

def twice(a):
    return 2 * a

def addition(a, b):
    return a + b

def subtraction(a, b):
    return a - b

functions = [half, twice, addition, subtraction]
a = get_a()
b = get_b()

Desired outcome:

[half(a), twice(a), addition(a,b), subtraction(a, b)]

And we want to do this without making our function definitions too ugly.

Solution 1:

One option is to `get_b()` within the functions that need them. This is not ideal, suppose `get_b` is not a pure function (e.g. a network call), we would want to pass `b` into scope instead of getting it from elsewhere every time it’s needed.

Solution 2:

We could change the signature to accept arbitrary kwargs and then pass a dict of args, for example:

def half(**kwargs):
    return kwargs['a'] / 2

def twice(**kwargs):
    return 2 * kwargs['a']

def addition(**kwargs):
    return kwargs['a'] + kwargs['b']

def subtraction(**kwargs):
    return kwargs['a'] - kwargs['b']

functions = [half, twice, addition, subtraction]
payload = {'a': get_a(), 'b': get_b()}
results = [f(**payload) for f in functions]

This works, but makes each of our function definitions uglier.

Solution 3:

Allow each function to have a different signature, inspect the signature at runtime and pass what is needed.
(Adapted from http://stackoverflow.com/a/2677263/3393459)


import inspect

def half(a):
    return a / 2

def twice(a):
    return 2 * a

def addition(a, b):
    return a + b

def subtraction(a, b):
    return a - b

# Wrapper which:
# * accepts a dict of all possible kwargs and their names
# * inspects the signature of the function
# * calls that function with the correct args
def call_func_with_correct_args(f, possible_args):
    func_args = inspect.getargspec(f).args
    args_to_pass = {k: possible_args[k] for k in func_args}
    return f(**args_to_pass)

functions = [half, twice, addition, subtraction]
a = get_a()
b = get_b()
full_payload = {'a': a, 'b': b}

results = [call_func_with_correct_args(f, full_payload) for f in functions]

So this is nice and clever, but we need to be careful that our function parameters are named correctly and consistently. Essentially we are passing the burden to the function definitions.

Conclusion

I don’t know what a great solution to this might look like. Is there a better way to do this? If all the parameters are different types, Python3’s type hinting might provide another option. What does this look like in other languages?

Book Review | Earthseed Series | Octavia Butler

Parable of the Sower and Parable of the Talents by Octavia Butler

I first heard about Octavia Butler in early 2014 on Twitter, I think originally from Danilo and/or Holly. I saw allusions to something called Earthseed, to humanity’s destiny in the stars, to the idea that “God Is Change”.

Two years later, with fascism on the rise and afrofuturism enjoying a moment of popularity, I went to a Fusion-backed symposium about Butler’s work. ((I learned about this from Alexis Madrigal’s newsletter Five Intriguing things which I’ve previously pluggedAlexis, formerly at the Atlantic and now Editor in Chief at Fusion, is one of the most interesting writers I follow.))  At this event, I was delighted by the idea that all progressives, all activists, are engaged in acts of science fiction; they imagine alternate worlds that could branch off from this one in a plausible way, societies like ours except governed by different principles of the physical or psychological universe.

Sower and Talents, published in 1993 and 1998 respectively, look more prescient by the day. Butler saw the future with great clarity and with a sense of resignation to the hate, destruction and degradation our world would suffer. In the Parable series, environmental catastrophe and economic inequality have created a desperate underclass driven to violence and drugs, whose life is of no value to a police force interested in protecting the property of the rich. In this fertile ground a white supremacist Christian paramilitary organization flourishes with the winking support of Presidential candidate Andrew Steele Jarrett, whose ascendance tears apart the vanishing middle class between liberal values and a frantic need to protect their families and communities from the predations of those even a little less fortunate. Kashmir Hill has already written about the uncanny similarity of this campaign to Trump’s. By the late 80s our future was not murky  to a thinker of Butler’s diagnostic precision.

The series follows Lauren Oya Olamina, a teenage girl who shows us the imagination and empathy and ambition that we will need to survive this bleak world. As a teenager in a middle-class enclave in southern California, Olamina begins to develop a practice called Earthseed, rooted in strong communities, individual self-sufficiency and an embrace of the universe’s ever-changing nature. Earthseed demands resilience and adaptability, with a sort of scientific and moral pragmatism, and points humanity towards the stars for its own survival. As she develops her philosophy it is eventually collected into The Book of the Living, which is “excerpted” heavily in the two books.

In these two books we don’t see anyone leave Earth — we are not given the pleasure of Butler articulating what it would be like for a whole society to live by these principles. We see small communities struggle to adopt these practices. We see them try to integrate new members who are grateful for food and shelter and company but skeptical of any indoctrination. We see major setbacks and minor accomplishments.

When we are defeated by Moloch our devastation is global and absolute and permanent. Our victories are usually are messy and local and temporary, a momentary respite from an ancient foe that is only getting stronger. If we are to survive, we must connect our small patches of humanity into a resilient and adaptable network. Our power is weak and our time is short, but our destiny is in the stars.

 

Book Review | The Whale | Philip Hoare

The Whale: In Search of the Giants of the Sea by Philip Hoare

A lot like Helen MacDonald’s H is for Hawk. An ode to an animal, to the wild side of ourselves, to our own voyages of discovery from sheltered indoor existences to the rambling untamed spaces that exist outside us, between us, within us. Hawk pays extensive homage to TH White’s The Once and Future King, and seeks communion with White, a loner on a similar journey seeking salvation in an uncompromising beast, in a wild eye that returns a gaze fiercer than we are accustomed to seeing. Hoare does the same with Melville’s Moby Dick. Unfortunately his gloss on Melville only made me pine for the real thing. No convict should ever be punished with the task of trying to out-describe, out-reflect, out-philosophize old Herman, and it is a fool’s errand for a free man.

But the bits of The Whale that are not just shadows of Melville are quite good. Excellent illustrations and photographs liven up personal memories, a sprightly history of 19th century naturalism, and fascinating snapshots of civic and economic history as they tangle with the history of whaling. In the 20th century the US and UK virtually gave up on whaling: the last whaling ship departed New Bedford in 1924. But Japan, Norway and Russia continued, spurred on by economic interests and national pride. Hoare cites a 1997 interview with a Japanese expert in the New York Times:  “It’s not because Japanese want to eat whale meat. It’s because they don’t like being told not to eat it by foreigners.”

Like MacDonald, like Rebecca Solnit, like Melville himself, Hoare understands that the world out there is only comprehensible with respect to and in contrast with the world within, that our idiosyncratic human interiority plays out in large and sometimes unpredictable ways on a global scale. The natural world acquires its beauty as it enters our retina or impinges on our fingertips or sprays its blowhole on our faces. But it becomes sublime as we recognize that whales are not just humans in thick blubber or symbols for sermons: rather we are cousins, together making up a small part of the unity of all living things.