XIII.3 Name Oriented Software Development

子路日:卫君待子而为政,子将奚先.子日:必也正名乎. 子路日:有是哉!子之迂也.奚其正.子日:野哉由也.君子于其所不知.蓋阙如也.名不正,则言不顺.言不顺,则事不成.事不成,则礼乐不兴.礼乐不兴,则刑罚不中.刑罚不中,则民无所措手足.故君子名知必可言也.言之必可行也.君子于其言,无所苟而已矣. — 论语 十三:三

Tzu-lu said, ‘If the Lord of Wei left the administration (cheng) of his state to you, what would you put first?’ The Master said, ‘If something has to be put first, it is, perhaps, the rectification (cheng) of names.’ Tzu-lu said, ‘Is that so? What a roundabout way you take! Why bring rectification in at all?’ The Master said, ‘Yu, how boorish you are. Where a gentleman is ignorant, one would expect him not to offer any opinion. When names are not correct, what is said will not sound reasonable; when what is said does not sound reasonable, affairs will not culminate in success; when affairs do not culminate in success, rites and music will not flourish; when rites and music do not flourish, punishments will not fit the crimes; when punishments do not fit the crimes, the common people will not know where to put hand and foot. Thus when the gentleman names something, the name is sure to be usable in speech, and when he says something this is sure to be practicable. The thing about the gentleman is that he is anything but casual where speech is concerned.’ — Analects XIII.3 (Lau)

If something has to be put first in programming, it is, perhaps, the rectification of names. Names are what place the system and the not-system in the same reality. They are the bridge between the externalized machine without use and the internalized emotion without expression.

What in Confucian philsophy we call the rectification of names we can in Confucian software call Name Oriented Software Development. This does not yet exist, but it can be defined simply. Name Oriented Software Development uses a toolset that promotes the continuous rectification of names across all the interstices between natural languages and machine languages in the system.

The nominalist toolset should span package, class, variable and method names. It should span library and project names. It should cover layers of code around the core system, including message protocol definitions and protocol dictionaries, configuration entities, unit and performance tests, and run scripts. The aim in managing machine facing names is to enforce consistency and coherence of names while making precision in naming, including type restriction, easy. The same name appearing in different machine-facing contexts, eg a message protocol field in a script and a Java class, should be linked in an automated and machine verified way. This might at first seem to make the internal technical dialect (namespace, one could say, if it were not taken) too rigid. This is not the intent, and if we look at the rename variable refactoring, not its effect in smaller scopes. It is because we can execute refactorings in a reliable, automatic way that it becomes viable as a low-risk change. This is the same across the entire internal technical dialect – enforced formal consistency allows mutability to be low risk.

By contrast, the aim in managing people facing names is to allow a consensus jargon to emerge backed by a literature of interaction and aspiration which is still moored to the technical reality of the system as it exists. This covers specifications, use cases, test documents (even and especially automated acceptance tests), application messages or labels for users or external parties, internationalization, log messages (ie, a UI for support) support and developer faqs, and user manuals and documentation. Changes to this shared understanding should be reflected as immediately as possible and not tied to a long software release cycle. A label, for example, is essentially a piece of simple key-mapped static data; changes to it can therefore be routine and implicit. When treating this sort of text as static data, it is essential to keep it automatically linked to the running widgets themselves – otherwise it is merely the domain of style guides and moral exhortation. A true dialect is owned by a community – a folksonomy – so the entire community must be able to use and contribute to it. The editors for these documents should be as broad as possible within organisational constraints. Where editing constraints exist (organisational not technical), annotation on these documents should be easy. Cross referencing within the docset and outside it to external sources of expertise (for instance on domain jargon) should also be easy to add and maintain.

Or, via Wittgenstein, Tractatus 7: Whereof one cannot speak clearly, one must damn well link to a wikipedia entry.

This approach owes more than a little to Knuth’s Literate Programming. A distinction is that instead of putting documentation with source code in a single artifact to be owned by a single philosopher-developer auteur, it puts editable, often executable content in the hands of a community of expertise.

Historically, the Confucians became increasingly sophisticated in their theory of names. I know of no record of Confucius addressing names changing over time, apart from a general openness to political reform (Analects IX.3). Indeed, as old Kongzi was often conservative, the quote above might reasonably be taken to advocate reverting to old names now in disuse. Xun Zi (荀子), who lived in the century after Confucius and was one of his major intellectual heirs, saw fit to reuse the Mohist (墨家) theory of names.

单足以喻则单,单不足以喻则兼; […] 名无固宜,约之以命,约定俗成谓之宜,异于约则谓之不宜。名无固实,约之以命实,约定俗成,谓之实名。名有固善,径易而不拂,谓之善名 — 荀子 – 正名 6-8

If a single name is enough to communicate, make it single; if not, combine. […] Names have no inherent appropriateness, we name by convention; when the convention is fixed and the custom established, we call them appropriate, and what differs from the convention we call inappropriate. No object belongs inherently to a name, we name by convention, and when the convention is fixed and the custom established, we call it the object’s name. Names do have inherent goodness; when straightforward, easy and not inconsistent, we call them good names. — Xun Zi – Rectification of Names 6-8 , AC Graham translation

AC Graham’s use of the word “combine” (兼) above is in the sense of “compound”. This is the term the Stanford Encyclopedia of Philosophy uses in preference. That entry points out Xunzi’s concern with names is also in rebuttal to the paradoxes of the Chinese sophists. Furthermore, Xunzi is rather more open to mutability and the pragmatic construction of language from a vernacular folksonomy. (The term 俗成, translated as convention, includes 俗 which now spans meanings including custom and vulgar.)

Computer science launched itself out of the western analytical tradition, though. A sometime description and criticism of Object Oriented design is that it is reheated Platonism. See, e.g., blogs by Vlad Tarko and Richard Farrar. ((Should the frequent light analogical treatment of Platonism and software sound a note of alarm for this very project? Perhaps. But there is heavier academic firepower behind us as well. Are we not grappling with code, which Berry and Pawlik call the defining discourse of our postmodernity? In an article that has more code metaphors than a house full of crack-addled Java-monkeys at teatime.))

The platonic analogy has legs. We do construct a parallel world of sorts in code. It is also revealing to think of classes as ideal representations of some external physical element. Isn’t that why we often fail as programmers? We critique the world for being less perfect than our ideal programs, for failing to match up to their strict conditions, for making them ugly, for crashing them. Code, and OO, can have a kind of brittleness that happens when we stop thinking of software as a model of the world and start thinking of it as the true world. We fit our shape to the name.

My suggestion is not to stop doing taxonomy – we could not navigate the world and construct alternative worlds out of software without it. We couldn’t even speak without it. Instead, we should use Xunzi’s advice and fit our names to the shape. We name by convention. We continually rectify names. If a single name is enough to communicate, make it single. If not, combine.

‘RenameClass’ is the most powerful refactoring. — Michael Feathers

Petty Liberties

In October 2010 the Parliament of Queensland entertained a petition from one of its citizens regarding the pressing issue of the presence of dogs in cafes. Dogs, in Queensland, are banned from cafes, restaurants, and similar establishments, for fear of the health of the public.

The petition, which myself and two thousand, one hundred and forty six Queenslanders signed, proposed loosening the restriction on dogs on cafes, making it a matter of discretion of the owner and of the local council.

We aren’t currently pet owners, though we have been in the past. I’ve seen dogs behave themselves in European cafes and Australian caravan parks. So long as the dog is well behaved, nowhere near food preparation areas, and the cafe owner is fine with it, it seems something people can work out amongst themselves, without the state parliament and police force being involved. It’s not a grand secular humanist right, exactly, though you can construct it from those if you wish. It’s just a petty liberty, the everyday business of civic society amongst free people, and their dogs.

Societies without petty liberties are almost certain to be unfree ones – prisons, or Pyongyang, or a feudal serfdom – lives unequal by default. Yet the loss of any one petty liberty does not a tyranny make. Dogs tied to the footpath lamp-posts of cafes do not foreshadow a canine Krystallnacht. It’s like a political sorites paradox, where these rules take on a different nature when piled in a heap. Different places also have different ideas of everyday freedom. Try smoking at random places in New York and Ho Chi Minh City, or strolling around the local park in the nude in London versus Berlin. There’s also a kind of paradox of the liberal localist – local democracy, as in a city council, may be the most accessible, but it’s also more prone to petty tyrannies like banning outside washing or saying what colour your house can be.

If you look at the very real and beautiful liberalization that has happened across Asia in my lifetime, it has mostly been a matter of returning petty liberties. India threw off the license raj. In China, grand liberties such as free speech or national elections are not a reality, but a whole host of petty tyrannies have nevertheless been relaxed since 1978. That’s what microeconomic reform usually is – the abolition of cobwebs of pettifogging price regulations governing everyday life.

For the last few decades, governments all over the world have had success growing their economies and making their people’s lives better without giving much ground on grand liberties. It’s been the right to free speech unless you insult the powerful, or the right to property unless you’re inconvienent.

When we were in China my wife plowed most of a day into setting up a new blog to keep contact with people back home. Logins setup, content written and uploaded, tweaked, tooled around with. Once she had a fair first cut she tried to view it as a normal reader would. Except she’d tried it out on blogger, and that year, or month, or whatever, the Great Firewall had been configured to block access to blogger blogs. Not the admin interface, mind. You could still create all the posts. You just couldn’t see them. Every page would just hang, loading, until eventually timing out, like an aged uncle who might be deaf or might just be ignoring you.

My wife turned to me with a cry of frustration and asked “Why? Why would they do that?”

I paused. “Because they’re communists,” I replied. A technical reason didn’t seem adequate. The platform she had posted her travel diaries on happened to be the same platform some concerned individuals had used to write about politics or history in a way the CCP didn’t like. Sooner or later, petty liberties become intertwined with grand ones.

To return to pettiness: the dog petition I mention above did, by the way, get a timely reply, in late November last year. The then Minister for Health, Paul Lucas, advised that as it was a matter covered by the Australia New Zealand Food Standards Code, the state supports that standard, and any change would be carried out through that. For a dog to sit on its owners feet under a cafe table in Mackay, an international committee of politicians and bureaucrats must agree it’s ok.

I think this is a tiny taste of what drives a certain kind of European crazy about the EU. The EU acts always in the name of, and I think for its officers the genuine intent to follow, grand liberties. Its faults show at the edges between those grand ideas and the patchwork liberties of everyday life in a particular place. So the European Arrest Warrant can cause horrible miscarriages of justice because justice systems across Europe vary in approach and quality. More often, though, it’s like being slowly covered in sticky tape. The local community loses its ability to reflect changed attitudes and adapt to new circumstances over time. All bureaucracies expand by their nature. Laws written with good intent become a simple catalogue of petty tyrannies.

It’s a shame to see the British left-wing establishment respond with kneejerk cynicism to the introduction of online feedback mechanisms there, most recently a mechanism for online petitions becoming a trigger for debate in the Commons. Even the usually excellent LRB unimaginatively got into it; rather depressing.

The e-petition itself, though, works rather well as a mechanism – it raises concrete issues that are relevant in people’s day to day lives, and links them to the machinery of government in a timely way. It puts pressure on politicians to trim back the thicket of cruft that inevitably accumulates in any system, or to add services in a particular place, by linking support to thousands of voters. It intertwines people and politicians in specific and transparent ways. It is elegantly democratic.

The Well-Ventilated Cage

There’s been a brief algal bloom of discussion on urban blogs on the historical roots of anti-urbanism, particularly Ryan Avent and Stephen Smith. It seems as good a time as any to mention the Brisbane experience. Brisbane is a nineteenth century city, and like most Australian cities, a casual attitude to earlier hunter-gatherer settlement meant it suffered from no shortage of land.

Brisbane has a strikingly sparse density for a city of two million – 918 people per square kilometre. That’s about a tenth of the density of New York city or an eighth of Los Angeles. Though it’s worth noting the city limits are drawn to include more suburbs than many other cities, it’s a pretty obvious feature of the city for even the first-time visitor.

The culture of sprawl certainly runs deep in Brisbane, buying a house on land is the conventional wisdom, and new suburbs have been ever unfolding throughout my life and before, while commute times soar ever upwards. It’s a city that demands a car, but where the ubiquitous suburban blocks are often green. I’ve been in forests overseas with less trees than the Brisbane suburbs. It may be one of the few places to deliver on that part of the garden city vision. Perhaps because of this, I had always assumed that the development pattern was driven solely by cheap land and human nature, despite my own frustration with driving for hours to do anything, or the inconvenience of taxi-ing home to the middle of nowhere after a few drinks.

In fact, much like the US examples Stephen cites, the roots are as much regulatory as organic, and they date back to the Undue Subdivision of Land Prevention Act 1885. This set a minimum lot size of 400 m^2 with a ten metre wide block. The population, though going through a boom, was only a few ten thousands at this time, and it had a huge impact on the development about to occur. The house I am writing this in is on a block of exactly the minimum size and shape specified in the act, even though it was rescinded in 1923. The motivation, as wiki notes, was slum prevention. The cost of not letting people choose smaller houses, if they wanted them, was a city that was too expensive to comprehensively sewer until the 1970s. It was also much hard to keep services like trams economic when cars emerged. Residents were trapped by sprawl, in a well-ventilated cage.

I Wore A Descriptive Robot Ethical Onion On My Belt

Via the fortuitously broken RSS feed of Intimate Machines, a short academic overview of Robot Ethics / RoboEthics. Intimate Machines is Glenda Shaw-Garlock’s blog, currently in hibernation, possibly thesis-related. While the overview itself is pretty smooth, the major ethical documents in this nascent field seem to be jolly tedious for a subject that lets us answer questions about the morality of electroshock robot camel jockeys.

It’s not the latest output, but the Euron Roboethic Roadmap (PDF) will serve well enough as an example. Firstly, it’s not really a roadmap, which implies some sort of high level direction: it’s more an exhaustive bullet-pointed list of every permutation in which ethics and robotics might intersect, with the more interestingly science fictional ones glossed over in order to seem serious. The project is almost entirely descriptive, and there are no ethical guidelines here of the type a researcher might use to get their project past a roboethics committee. The first proposed national prescriptive guidelines, due to come out of Korea in 2009, seem to have been abandoned with a change of government. (In the meantime, Jamais Cascio has useful early stab.)

Its not clear if this descriptive tediousness, which is hardly inherent to academic writing, is unintended or deliberate policy. Supporting the unconscious side, the prose does have some of the word-counting desperation of an engineering student essay on Othello. Contrariwise, writing is produced with an audience in mind. Rather than researchers – for whom ethical guidelines might include some sort of moral stance – the institutions of public policy seem more clearly in mind. In the case of the Euron roadmap, one’s reminded of the bureaucratic house style of the likely regulator, the EU. Perhaps robot ethics has coloured itself in grey as a kind of self-defense mechanism: robotics researchers want to show they’ve done their homework, thought long and hard about if they are doing the right thing, and are safe and somewhat dull custodians of the world’s mechanized retarded geniuses and flying killing machines. Think of it as the Abraham Simpson school of rhetoric: win by boring your opponents to death.

I don’t think that will quite be adequate.