Destructive Abstraction

A destructive abstraction is one that destroys distinctions which users naturally and persistently believe in. The purported symmetries which the abstraction uncovers will never actually be used in practice because human beings always consider the situation to be asymmetric, even if at the implementation level it is not, and they always consider it asymmetric in the same way. A destructive abstraction is what results from designers deciding that two things "are really the same" despite the fact that they're never used the same way or used by the same people.

Concrete examples of destructive abstractions:


MultiMethods comes from asking WhyIsTheFirstArgSpecial and deciding it is not. But it actually is special since natural languages such as English make a distinction between subject and object. We call English's order SVO for Subject - Verb - Object and not FVS for First Object - Verb - Second Object. The subject of a phrase is special. It might not be easy to explain why, it might not even be possible to explain why, but actual human beings will insist that the first argument is in fact special.


Prototypical programming is similarly destructive in that it destroys the distinction between a class and an object. But then, a good prototypical programming language will just reinvent the class as a convention (traits) and behind the scenes magic (maps) so what is really gained?


The Morphic interface (as opposed to the morphic framework) is destructive in a similar manner. Morphic is based on morphs which give the user the ability to resize them, move them, re-orient them, delete them, and so on. The problem there is that these are meta-operations which have no meaning to the object being presented. Besides, all of these meta-operations are useless overhead in the same category as AutomaticVsManualPlacement, and so all of this useless overhead is eliminable in a superior interface. Technically, morph operations are interface artifacts entirely analogous to windowing artifacts, and if WindowsAreEvil then morphs are evil too (on an interface level anyways, not on a framework level).

The key point here is not that morphs provide inferior meta-operations, but that these operations are useless precisely because they apply only to individual objects. The typical user isn't able to, for example, change the colour of every browser window that pops up. Why? Because morphic doesn't distinguish between morph operations and underlying node operations, but its users really DO distinguish between the two levels of operation and so there's nowhere to insert a third level of meta-operation even though this third level is infinitely superior to the meta-level morphic provides.


SVO in linguistics

Costin's point above may or may not be true, but is not the issue here. In terms of theoretical linguistics, whether there is a truly important difference between "subject" and "object" depends grammatically on the sentence in question. A very large number of kinds of sentences in all languages involve an active agent (the subject) performing some process (the verb) on some object (optionally, depending on the kind of verb). For instance, in "Doug wrote a paragraph", there is an inherent difference, both grammatically and semantically, between the subject "Doug" and the object "a paragraph".

There are, however, sentences that have no relevant subject, yet English requires a subject anyway, e.g. "It is raining". These are sometimes colorfully called "weather-it sentences". Grammatically the subject is "it", because it is mandatory to have a subject, but semantically there is no subject, there's just a verb/process. That can happen with an object, e.g. "It is snowing pink snowflakes" (object is "pink snowflakes", still no semantic subject).

Only a subset of languages put the subject first, so the observation that "the first parameter is special" is English-centric. Object-verb-subject and Verb-object-subject and other orders exist in certain languages. There are also a lot of languages which are not best analyzed this way in the first place, for instance, Japanese (and a number of otherwise unrelated Asian languages) more often has a "topic/comment" structure than it does a Subject-Object-Verb structure (some sentences analyze well the latter way, many others do not).

In situations where the subject plays a semantically important role, there is an issue in programming compared with natural languages: we need to be able to easily and unambiguously know which parameter is the subject. One could use a subject marker (many natural languages do), and allow it in any position, or indicate it by ordering (as some natural languages, such as English, mostly, but not entirely, do), in which case the two natural cases are either subject comes first, or subject comes last. The latter is somewhat more awkward in the case of a variable number of parameters, so there is some relatively neutral point of view for choosing subject-first, although that is by no means the only defensible choice. -- DougMerritt''

Just an observation. SVO actually is special since of the 6 possible orderings, a disproportionately large number of languages adhere to it. And within English, SVO order is special although all orders exist in English and likely every other language.

It would be interesting to know whether the ratio of languages with different orders replicates the ratio of phrases with different orders in each language. It should since the order of a language is just the one order that has the highest share in that language. Unfortunately, I don't know the linguistics terminology that would allow me to google this.

The 'it' in 'it is raining' is interesting. Might it be the equivalent of thisContext? -- RK

Regarding the latter, yes and no. By itself, "it" is a pronoun: an anaphoric/deictic reference, something that refers to something else. In situations like: "You stole his book. Give it back to him." the word "it" is very simply a reference to "his book". That's thisContext in some sense, yes. But in the above "weather-it" constructs, the word "it" truly is just a dummy, it doesn't really refer to anything at all, it's just a placeholder. (People sometimes attempt to make some sense of that by thinking "maybe 'it' refers to the sky or the clouds, but it's generally agreed that such attempts are forced, unnatural, and don't stand up to examination.)

Regarding the former, it's a complicated issue. Some of the 6 orderings are rare enough as to be controversial whether they exist, and languages interconvert between orderings quite frequently (in terms of historical time). There's been lots of speculative theories about why Subject-First is as common as it is, but we don't know for a fact that those theories are true. It's possible that it's just a statistical fluke today.

You've got a good question, I agree that it would be very interesting "to know whether the ratio of languages with different orders replicates the ratio of phrases with different orders in each language. It should since the order of a language is just the one order that has the highest share in that language", although I have reservations about the (admittedly common-sensical) final quote sentence there.

I don't think googling would help settle it at all (because it involves the topic of all-language-surveys and language universals, two extremely controversial and difficult areas), but you'd run across interesting theories and isolated datapoints; I see tidbits on such things all the time. Off the top of my head, try including "clause word order" or "phrase word order" with "sentence word order".

And btw note that e.g. Chinese has extremely limited freedom for variations of word/phrase order compared with e.g. English, that Latin is famous for allowing far more (it's fairly free in pretty much exactly the places where it has morphological case endings, and not when it needs to use a free standing preposition), and that "Warlpiri" is famous for possibly having the maximal freedom by some measures.

The topic is further complicated by e.g. polysynthetic/incorporating languages such as Aleutian that suck certain other words out of the sentence and plop them down into the midst of a compound word. -- DougMerritt

Given the interconversion and the overwhelming discrepancy between SVO and the rarer orderings, I very strongly doubt it's a statistical fluke. If there were no interconversion then you could argue that each language or language group got that way by accident and homogenization by some dominant regional force. But with interconversion thrown in, that means each language is distinct and all several thousand natural languages count as data points.

Thank you for the details. -- RK


Ignoring the foray into linguistics (and the various flames) above, there is at least one well-documented case where MultiMethods are arguably more appropriate than SingleDispatch - the case of binary operators. When I attempt to add two things together, I really care about the types of both of 'em, not just of one of them. In other cases, SingleDispatch is appropriate - the operation fundamentally belongs to one object or the other.

I know little about Morphic, and shall refrain from commenting on it.

Prototypes may be a bad idea when they replace classes - but when they augment classes they are damn useful. Virtually every prototype-based language I can think of which is used for significant production work - and there aren't many of 'em - either provides class-like functionality in the language, or classes are implemented by programmers as a de-facto design pattern.

Just my two cents... -- ScottJohnson

Can you provide some examples where prototypes are useful, preferably not in GUI code?

Coitenly:

At any rate - why should GUI code be excluded? You make it sound as if code implementing the user interface is second-class.

Because it is. MVC is a second-class framework and Morphic has its own set of problems. Wait, dose that make MVC third class?

Is there anyplace where anonymous classes are useful? I know the concept but I've never felt their lack in Smalltalk.

Can you provide concrete examples of places where objects have to change roles other than coercion of numbers? -- RK

Consider the Smalltalk idiom of delegation via DoesNotUnderstand.

You may not feel the lack of anything in Smalltalk, since it's known to be a comfy language, but that doesn't mean that things that aren't in Smalltalk are without value, thus "I don't feel the lack" is neither here nor there in discussing language constructs.

Anonymous classes fit the pattern "why should I have to name something if I don't want to?", which we also see in lambda functions/Smalltalk blocks. It tends to depend a great deal on the language how much convenience is added by allowing anonymity of some given construct. -- DougMerritt

I don't understand what delegation has to do with changing roles. -- rK

Of various possibilities, consider a highly dynamic RoleObject. Prototypes seem well-suited to such a thing (which is obviously not to say they can't be done other ways). Hypothetically, if prototypes were added to Smalltalk, it might reduce the number of areas in which DoesNotUnderstand-as-delegation is currently an idiom.

The issue isn't whether that's the best way, merely to give an example other than number coercion. -- Doug


I spent four years refactoring WyCash. In that time I almost always eventually found a simple abstraction that used no more than single inheritance polymorphism to capture the essential features of a concept. The only one exception was PUTs and GETs which were the mirror image of each other and were mirrored again depending on whether you were buying or selling. The trouble with adding a mirror wrapper around an object was that "self" got rebound when the delegation occurred and subsequent sends to self weren't mirrored. Prototype based languages delegate without rebinding self so I could have done the wrapper trick as often as I wanted. Instead, I just wrote if-statements to get the same behavior. Bummer. -- WardCunningham

Very interesting food for thought about a strength of prototypes, that chalks up a point for them in my mind.

I'm also intrigued that you almost always found a way to use no more than single inheritance polymorphism; were there any Eurekas you ran across that helped with that? -- DougMerritt

An important realization was that we weren't modeling the business with objects but were modeling a business computation with objects. The distinction gave us enough latitude to make the objects work for us. One particularly good story, WhatIsAnAdvancer, has been told here before. -- WardCunningham


JanuaryZeroSix

CategoryAntiPattern


EditText of this page (last edited August 16, 2006) or FindPage with title or text search