Thursday, May 27, 2010

supernatural sci-fi redux: the Lost series finale

A long while ago I registered my annoyance at 1) applying the "sci-fi" label/category to fiction that contains supernatural elements (or indeed any elements that don't have fictional science justifications) and 2) fiction whose level of fantasy or "science-hardness" is inconsistent and sloppy, which provokes the "sci-fi" mislabeling.

I still feel my "supernatural sci-fi annoyance". For instance, it hindered but surely didn't squelch my enjoyment of the "BSG" series finale (Et tu, Starbuck?). However, I'm genuinely surprised by online reviews that express the same sentiment about the "Lost" series finale. Almost from the very start, "Lost" has emphatically teased supernatural elements. As the series went on, the show contained a smorgasbord of world religions, psychics, manifestations, energy healing, power-harnessing ruins (in the vein of Indiana Jones?), immortality, prophetic intuitions. Although sci-fi stories have often ended with intricate and thinly-stretched explanations behind everything that  appeared to be supernatural, it was increasingly unlikely that the writers of "Lost" would go down that path. After the episode "Across the Sea", the series finale was certain to feature a supernatural resolution. The rather bald form it took was merely an interesting stylistic choice consistent with the series' entire approach of eager religious inclusion.

P.S. my incorrect theory:

I guessed that the island was a "junction point" between space, time, and alternate universes. The island appeared to jump around in space and time relative to the rest of the world because its synchronization to it is continuously in flux. When the Monster spoke of being trapped and wanting to leave, I thought he meant that Jacob had somehow kidnapped him from the universe of the "flash-sideways". If the Monster managed to return to his own universe, then the survivors' counterparts in that universe would be in peril. Hence the warning that the Monster would "destroy everyone" if he managed to leave. Jacob's omniscience, sense of destiny, and comments about "progress" all came from his knowledge of every universe, time, and possibility. This "island knowledge" was absorbed on a much smaller scale by Locke and others, who experienced it as ineffable "guidance" because recognizing it consciously would overload their minds. In the finale, the consciousness of each of the survivors would be somehow completely synchronized and fused with their counterparts' in the sideways universe. This fusion would resemble Desmond's special ability to experience all points in time. By doing so, they would "live on" in a sense, after it became necessary to demolish the island in our universe to stop the Monster and prevent further such problems. The time traveling in season 5 was caused by the consciousnesses of the survivors working to stay in sync together as the island was "off its axis" and shifting around them. When the Six returned, they were pulled back in time to the others through the same mechanism ('course, that doesn't explain why Sun stayed in the present instead of meeting Jin...). I'm positive my theory had many holes, too, but I thought it would've made for an incredible finale.

P.P.S. my early-season incorrect theory (added May 30)

Early in season 6, my theory was that the explosion the ended season 5 had worked (recall Juliet said "It worked")...more or less. The "sideways" reality was in fact the new "actual" timeline. However, due to the island having a complicated relationship (to say the least!) with time itself, there were two complications: 1) the consciousnesses of the survivors were thrown back to an "island present" that existed in a limbo-like half-real state, 2) with the island now destroyed its malevolent god, i.e. the Monster, would finally be set free to do eeeeevil in the rest of the world. My metaphysical assumption was that the god was deeply tied to the island's very existence. The only reason the island continued to exist in "limbo" after the bomb went off was because of the Monster still being there. Once the Monster left, his presence would no longer support the island and its limbo reality, all of the events of the series would be fully undone, and the Monster would emerge into the new submerged-island timeline.

But the Monster couldn't leave until Jacob and his candidates were either dead or agreed to leave. A second assumption of mine was that in the far past, Jacob had somehow managed to trick the Monster into splitting power and authority with him. That is, in the ancient history of the island before Jacob, the Monster had been a cruel god who ruled harshly. Jacob's trick reduced him to a smoke monster who was 1) subservient to Jacob's dictates, 2) served an island role of protector and judge/executioner. (Jacob couldn't outright-kill the Monster because his own power and authority had originally come from him; the Monster would've just reabsorbed it.) By Jacob's dictates, the Monster couldn't leave until him and his candidates were gone, regardless of the island's actual destruction at the end of season 5.

In this theory, I guessed that the island would end up destroyed and the survivors' consciousnesses would merge with the sideways survivors'. Ultimately, the Monster would succeed in his escape from the island, but then the sideways survivors, who now have the memories of the original set, would confront the Monster and utterly defeat it by the entire group becoming the new plural Jacob. Meaning, the Monster's power would be siphoned off into so many people at once that it would cease to exist. In addition, I presumed that the Monster would inhabit Christian's corpse during that scene. Hence the coffin would return to "sideways" Jack just in time for Desmond to gather the whole group around to take on the Monster as it sat up.

As season 6 wound on, it became increasingly clear that my "time was rewritten" theory didn't match up, and that was when I switched to the preceding theory with the alternate universe. I spent less time dreaming up theories than many others on the Web, but in any case my impression is that everybody was incorrect in one way or another. And how did dead Sayid turn into living "apparently I'm evil" Sayid, anyway?

Sunday, May 23, 2010

meaning through isomorphism

Moreover, Gödel's construction revealed in a crystal-clear way that the line between "direct" and "indirect" self-reference (indeed, between direct and indirect reference, and that's even more important!) is completely blurry, because his construction pinpoints the essential role played by isomorphism (another name for coding) in the establishment of reference and meaning. Gödel's work is, to me, the most beautiful possible demonstration of how meaning emerges from and only from isomorphism, and of how any notion of "direct" meaning (i.e., codeless meaning) is incoherent. In brief, it shows that semantics is an emergent quality of complex syntax, which harks back to my earlier remark in the Post Scriptum to Chapter 1, namely: "Content is fancy form."
prelude and the problem

Months ago I finally finished reading Douglas Hofstadter's Metamagical Themas. Since it's a collection of columns about varied topics, I don't plan to comment on it with the same level of enthusiasm that I applied to I am a Strange Loop (if I were, I would've gotten around to it much sooner!). But one of its recurring ideas, also raised in Hofstadter's other books, is so fruitful that I can't resist rambling about it at excessive length: meaning through isomorphism. I'd further claim that its importance rivals and complements that of self-reference, which usually has the spotlight in commentary about Hofstadter's ideas.

The universal philosophical issue or "problem" of meaning is easily explained. It's undeniable that people experience meanings and that a meaning is a relation. One chunk of stuff "means" another chunk of stuff; noun _____ represents, defines, symbolizes, or analogizes noun _______. But how can people reconcile or harmonize this experience of meaning with a universe that, according to the best means of detection and reason, consists of pieces of matter whose interactions are consistently indifferent to relations of meaning? Does/Can meaning really exist? Assuming it does, then what is meaning, where is meaning, and how does meaning originate? I'll work my way back to this later.

isomorphisms

The preceding questions have many proposed answers. I'm convinced that Hofstadter's description of meaning through isomorphism is a pretty good one. A mathematical isomorphism has a rigorous logical definition, but in the looser sense intended here, an isomorphism is simply matching one or more parts of one aggregate with parts of another aggregate such that one or more relations between the parts of one aggregate remain valid between the matched parts in the other aggregate. In a word, relations in an isomorphism are "preserved". (In passing, note the circular definitions that an "aggregate" is a collection of "parts" and "parts" are anything in an "aggregate" collection.)

To take an elementary example, if one aggregate is the set of numbers (4, 8, 15) and the other aggregate is the set of numbers (16, 23, 42), then an isomorphism that preserves the relation "greater-than" could match 4 to 16 and 8 to 23 and 15 to 42 because 8 is greater than 4 and 23 is greater than 16, 15 is greater than 8 and 42 is greater than 23, etc. (Naturally, the relation of "subtraction" is NOT preserved since 8 - 4 = 4 and 23 - 16 = 7.)

At first glance, this may seem like dodging the question of meaning. Why should anyone care that, through a greater-than isomorphism, (4,8,15) "means" (16,23,42)? Well, that depends on the situation. Hypothetically, if someone's purpose involved the greater-than relation and he or she could more easily manipulate numbers less than 16, then that person could work on (4,8,15) and use the isomorphism to apply the results to (16,23,42). Imagine the depressing story of a pitiful calculating device that can only store its numbers with 4 bits each but its task is to find the maximum of 16, 23, 42. Still too trivial? Then ponder a comparable isomorphism between number sequences: taking the sequence 0..255, matching 0..127 to itself, and matching 128..255 to the sequence of -128..-1 . Now go read about the computer storage of signed integers to find out why this comparable isomorphism isn't a toy example at all.

Thus the basic idea is straightforward but its implications are surprisingly wide-ranging as shown by Hofstadter in his more mind-bending sections. His exemplar is the isomorphism in the incompleteness theorems between numbers and the symbols of a formal logic system, although he returns time and again to descriptions of the human capability for analogy, whether in the contexts of translation or recognition or self-image or creativity. A common thread is the logically-strange tendency to transcend by self-reference, which goes by labels like "quote", "break out", "go meta", "use-mention distinction".

applied to computers

However, apart from complicated self-reference, Hofstadter admits in his serious AI speculations that mere meaning through isomorphism remains simultaneously effortless for people yet bewildering to computer science. People can figure out an original isomorphism that works and then not rely on it beyond suitable limits, but a program can't. Whatever are the underlying mechanisms that originally evolved in the human brain for reaching the "correct" answer in a complex environment, no artificial program has quite the same ultra-flexible Frankenstein mix of (what appear from the outside to be) random walks, data mining,  feedback, decentralization, simulation, and judgment. Given its mental acts, we shouldn't be shocked by the sheer quantity of lobes and connections and structure in the brain, and maybe its operation is less a monolithic program than an entire computer packed with programs interrupting one another to get a chance at directing the body's motor functions.

On the other hand, this conspicuous lack of an AI for pragmatic isomorphisms is all too familiar to application programmers like myself. Our job is to fill the gap by the routine imposition of meaning through isomorphism. That is, we try to create a combination of algorithms and data that's an isomorphism for a specific human problem, like running payroll for a company. In a similar fashion, the total computing system is a stack of increasingly-complicated isomorphisms of the application programmer's work. As Hofstadter writes in his columns on Lisp (and properly-educated programmers know), the top-level program is compiled into an isomorphic representation, then the next level down does its own compilation, and so forth, until the original program is in the executable form appropriate for the relevant non-virtual hardware. The towering edifice is an impressive illustration of the exponential power of isomorphisms to capture and translate meaning into, ultimately, an electrical flow.

(Some technically-minded readers may be questioning which "relations" are preserved by these isomorphisms. After all, one or more parts of the "pipeline" could possibly optimize the original code in any number of ways like function in-lining, variable removal, tail calls... In this case, the relations are abstract but are in the category "the effect of the original":  order of statements that are dependent, values of constants including user-visible strings, access details of I/O performed. When relations like these in the original code aren't preserved, the pieces lower in the stack thereby fail to carry out actual isomorphisms that would express the meaning.)

applied to information theory, communications, art

Of course, meaning through isomorphism isn't the only theoretical framework around for understanding computer processing as a whole. The same claim could be made for information theory, which is throughly successful and in use every day. Fortunately, the two are compatible. Say that the communication channel's sender and receiver each have aggregates, and the message symbolically encoded and sent over the channel is an isomorphism between their aggregates. So then the symbols of the channel's message indicate each match from one aggregate's part to the other aggregate's part. Before the first symbol, the receiver is at maximum uncertainty or entropy about the isomorphism. After the first symbol and each symbol thereafter, the receiver can use knowledge of 1) the matches communicated previously, 2) its own aggregate, and 3) its own aggregate's relations between parts to make increasingly likely guesses about the remaining matches (or correct randomly sent errors on a noisy channel). In accordance with information theory, good "entropy coding" for this message would send no more bits to the receiver than are required in order for the receiver's knowledge of aggregates and relations to infer the rest of the isomorphism. The isomorphisms processed in a computer system allow for lower information entropy and therefore greater compression. The most interesting portions of a codec have the responsibility of using relations among parts of the media stream to trash or reconstruct some parts of the aggregate stream.

Given the compatibility between meaning through isomorphism and information theory, it's unsurprising that communication in general is perhaps its most natural manifestation. A language is an aggregate of spoken or written words. The universe is an aggregate of pure experience (I dare you to be more vague!). Hence a worded message is an isomorphism between language and the universe. Rather, the message is an aggregate of words that were purposefully selected in order to communicate, via the language-universe isomorphism, an aggregate of thoughts about pure experience. The relations preserved by this isomorphism are countless and endlessly varied. In the message "The quick brown fox jumps over the lazy dog", "brown" is an adjective to "fox" so the indicated fox must have the color brown in depictions, "jumps" is a verb to the subject "fox" so the indicated fox must be in the midst of a jumping action, "over" is a preposition connecting the phrase "The quick brown fox jumps" to the phrase "the lazy dog" so the indicated fox must be of higher elevation than the indicated dog. Part of the reason why computer parsing of raw human language is stymied is due to a computer's lack of a human's uncannily deep well of experiences to fuel a feedback loop between the comprehension of syntax and semantics. In practice, the nuanced syntax of sentence structure, word forms, and connectives nevertheless results in highly ambiguous statements that require worldly knowledge and/or context to disentangle.

How exactly people can decode their own words is a fiendish and glorious enigma that's convinced many speculators to tie language to the essence of humanity. Those who presume a soul frequently equate it to the explicitly verbal segments of intelligence (e.g. "confess with your lips"). It's definitely a truism that, of all earthly creatures, people have the most developed and subtle languages. They can organize their mental and social lives to levels of complexity that contrast with the simplicity of their materials. All their creations in language, art, and other domains can have symbolic depth.

applied to the distinction between form and content

These feats of abstractive composition and interpretation lead to a commonsense division between a work's "surface form" and its "meaningful content". For instance, a surface form of red is said to represent the inner content of the artist's aggression, and a milestone of any artistic genre is the point at which critics begin to tirelessly accuse its artists of betraying the genre's pioneers by producing "mindless copies" that mimic style (form) but without substance (content).

Finally I return to one of the points in the opening quote. The practical classification of an expression's qualities into form and content just described is contradicted by Hofstadter's pithy motto "content is fancy form". In his words, "[...]'content' is just a shorthand way of saying 'form as perceived by a very fancy apparatus capable of making complex and subtle distinctions and abstractions and connections to prior concepts' ". Elsewhere he writes that form and content are on a "continuum", and the gap between is "muddy". Form and content are simply the same expression evaluated on different strata or in different domains. Syntax and semantics are different in degree, not in kind. If someone isn't taken aback by this proposition then he or she might not grasp its import.

I've found it instructive to employ this perspective on John Searle's thought-provoking Chinese room argument. There's a person, completely ignorant of written Chinese, in a closed room armed with only the materials necessary to 1) receive a message in Chinese, 2) manually execute the algorithm of a program that can pass a Turing Test in Chinese, 3) send the reply generated back out of the room. Assume, as in any Turing Test, that the judge outside the room who sends the original message and receives the reply can only rely on the messages to determine whether the unknown correspondent knows Chinese. Since the algorithm in the Chinese room can pass the Turing Test by producing highly-convincing replies, isn't it true that 1) based on the replies the judge will conclude that the person in the Chinese room understands the messages and 2) the judge's conclusion is in direct contradiction to the person's actual level of knowledge of Chinese? If you grant these two points, then the Turing Test criterion for "understanding" fails to find the right answer for the person in the Chinese room. Now change the role of the Chinese room inhabitant from a person+algorithm into a computer program executing the same algorithm. Remember that the person in the Chinese room passed the Turing Test by "shuffling symbols" that had no meaning to him or her. Is it any more reasonable to think that a program that passes a Turing Test is doing anything more than "shuffling Chinese symbols" like the person in the Chinese room? The upshot of the argument is that no matter how well a message's form of linguistic symbols is processed, its content or meaning could still be unknown to the processor; understanding of form does not imply understanding of content so content cannot be form.

As I see it, the meaning-through-isomorphism interpretation leads to a disturbing viewpoint on the Chinese room argument (reminiscent of how the EPR "paradox" led to disturbing but theoretically-consistent results for quantum mechanics). I'm restricted to a single clue to deduce who in the Chinese room argument really knows the meaning/content/semantics of the message: the location of the aggregates to which the message's symbols are isomorphic. The argument postulates upfront that the person doesn't know the Chinese language. In other words, he or she doesn't have any information about the aggregate or relations of the Chinese language, but the message's symbols are parts of that unknown aggregate. Clearly no isomorphism happens in the person and so none of the intended meaning is there. I can agree that the person's lack of the necessary aggregate makes him or her clueless about the messages. But that leaves one possibility: the algorithm is the thing that understands the meaning. In the Chinese room, or indeed in any scenario alike to a Turing Test, in order for the algorithm to form convincing replies at all it must be able to decode the meaning, and to decode the meaning it must have the necessary aggregates to complete the isomorphism. Based on the usual opinion that understanding demonstrates intelligence, for the purposes of the Chinese room, the algorithm is more intelligent than the person. From the standpoint of the message's meaning, the person's participation in the communication is akin to functioning as the algorithm's tool, channel, or messenger (according the customary literary allusion, the algorithm is the person's "Cyrano de Bergerac"). When meaning occurs through isomorphism, there's no logical contradiction. The judge's guess that the person within knows Chinese is nothing more than an honest mistake. Don't blame the messenger for a passing Turing Test.

applied to philosophy and the brain

I called the idea of an intelligent algorithm "disturbing", but the delegation of various "intelligent" tasks isn't novel. Mathematical calculations were one of the first to be handed over to algorithms and devices. Then there's the long list of recommendations for sundry occurrences (do this when there's a fire, do that when someone needs resuscitation). And how much of the typical job is reducible to either rote actions or following new orders whose rationale is unknown?

The disquieting aspect of the imaginary Turing Test algorithm is the unprecedented usurping of the noblest of intellectual pursuits, understanding meaning. A traditional philosopher might declare that to be human is to understand and, furthermore, understanding is an accomplishment that can't be performed by anything else. Rocks don't understand. Plants don't understand. Animals don't understand but many are trainable. In contrast, humans experience a detailed "meaning mirror" of the universe that's symbolized in their languages. The "meaning mirror" has the name "mind" or "soul". Humans can understand the meaning of an expression by its effect on the "mind". In summary, meanings are ethereal inhabitants of minds, and only humans have minds.

Such a traditional explanation is appealing (to some people especially so) but it's complicated because it grants "first-class co-existence" to a purely mental/non-physical world. By making access to the cognitive world a special privilege of humans, it's dispiriting to the prospect of AI ever arising. It's also messy because people tend to embellish the details of the non-physical world in a multitude of opposing directions. It conflicts with the normal and productive method of the sciences, which is to find physical causes for phenomena. It outlines the existence of meanings but at numerous costs.

Dropping the traditional philosopher's explanation leaves the philosophical question of meaning unanswered...unless isomorphism is introduced in its place. Isomorphism furnishes a plausible intellectual underpinning for meaning in a solely materialistic universe. An isomorphism requires only materialistic ingredients for its elements: parts, aggregates, relations, matches.

What materials? The choices are everywhere, as boundless as creativity. Earlier, one set of materials was the software and hardware components of a computer system. In his writings Hofstadter has used DNA as a sterling example whose meaning is the proteins transcribed from it. And in keeping with the section on communication, any usable information channel is a candidate for meaning through isomorphism.

For philosophical concerns, the more relevant set of materials for isomorphism is the human brain. If we're to give up believing in our non-physical realities, we should reasonably expect a competitive brain-based theory of our mental capacities and qualia. I expect the brain's networks to be effective materials for isomorphisms. The combined excitatory and inhibitory network connections seem like prime building blocks for exquisite parts, aggregates, relations, and matches. Connections in general are implicitly essential to the definition of an isomorphism. An aggregate is parts that are connected, a relation is a connection between parts, a match is a connection between parts in separate aggregates.

One can then concede the, for lack of a better name, mind/matter isomorphism: the physical layout of the brain's network is directly responsible for all "non-physical" thoughts we feel. I don't suggest that there's a "grandmother neuron" but that the numerous neurons and even more numerous neuronal junctions, in response to the onset of the relevant stimuli, effect a mental experience of grandmother, whatever that may be. I neither suggest that one brain's network layout of isomorphisms resembles a second brain's except on a gross regional level; the variance among individuals in immediate word-association responses certainly makes a closer resemblance doubtful. I do suggest that, with sufficient prior knowledge about the isomorphism between the specific brain's network and its environment, a "scan" of the merely anatomical changes associated with the formation of a new long-term memory would enable the scanner to know with some certainty what the memory was "about". (I'm skeptical that anyone could figure out a workable procedure for it. Brain interfaces are getting better all the time, but the goal is to clumsily train the brain and the interface to work together, not to accurately read the brain's ephemeral signals.)

applied to objectivity

The proposed isomorphism between a person's brain and his or her encounters with reality puts not only the philosophical categories of "mind" and "matter" in a new light but also the categories of "objective" and "subjective" meaning. Objectively, whenever a scientist examines eroded canyons with sedimentary rock walls, maybe unearthing fossilized water-dwellers, he or she can assert the ancient history of the river that flowed there long ago. The river left traces so the river can be factually inferred. Also objectively, given the full network of a brain (and many secondary clues?), the brain's memories could be deduced in theory. The thoughts of the brain left traces so the thoughts can be factually inferred. At the time people would've called the brain's thoughts subjective, but with enough work the thoughts might as well be called objective.

Obviously the isomorphism in a human brain is incredibly dense and interwoven, which causes the complexity of the undertaking to have the magnitude of a perfectly accurate measurement and forecast of all the weather in North America. It's too hasty to proclaim it impossible, though. People have managed to translate hieroglyphics and break the Enigma code. The elusiveness of the "right" isomorphism doesn't disqualify it from discovery (well, not counting some exceptions like 1) the perfect elusiveness of "isomorphisms", like one-time pads, that by design have "matches" but preserve precisely zero relations, and 2) degradation/corruption of the aggregate's material medium).

Having seemingly decided that the derivation of meaning through isomorphism places it into the "objective" category, one could be forgiven for attempting to additionally place it into the "unambiguous and undebatable" category. In people's regular conversations, the two often go hand-in-hand; objective facts are brought in to silence the clamor of unfounded opinions. Not so for isomorphisms. In fact, an isomorphism's objective existence is why it can't have any inherent authority or precedence over other isomorphisms. Surely people can agree on any number and flavor of criteria for the selection of an isomorphism, but there's no physical coercion. (I could elaborate on how the personal selection of isomorphisms is supportive of pragmatic philosophy but I won't...)   

x + y = 815. I'm writing a message to send in a bottle, but in what language? I see a person holding two fingers against his forehead and I take for granted that he has a headache. You mention a common acquaintance by the name "Alex" and I conclude you're speaking of "Alexander" not "Alexandra". "Ambiguity" is more or less shorthand for too many isomorphism candidates to pick.

In a much more formal context, computer scientists have established ever-growing sets of problems that are proven to be solvable by the same kind of algorithm. When a fast algorithm solves any problem in the set, it could attack the rest, too. On an algorithmic basis, the problems are isomorphic. A computer scientist searching for a generalized solution to the set of problems doesn't need to "prefer" one to the rest. (He or she need not be too depressed. In most applications a "good enough" or "partial" solution is adequate.)

The "relativity" (non-preference) of objective isomorphisms is mind-blowing to me. It turns the world "inside-out". The Earth is not the center of the physical universe. Neither am I the center of the universe of meaning. After a thunderclap, the impact sets air in motion. The sound wave is one set of molecules jiggling, then the next, then the next. By moving similarly, i.e. isomorphically, aren't the air molecules transmitting the "meaning" of the thunderclap? Eventually, the air in my ear canals moves after being pushed in turn. The movement of the drum corresponds to an isomorphic shift in electrical impulses (yeah, I know I'm simplifying it). The nerve cells isomorphically react and in so doing continue to pass along the "meaning" of the thunderclap into the brain that I like to refer to as "mine". The connections in that brain isomorphically mirror my stored memories, spilling over into my language centers. "I hear thunder." In the relative terms of all these isomorphisms, who's to argue that I'm the origin of my spoken thunder message? But I may not be the terminus, either. What if my statement motivates the people around me to leap into action? Aren't their actions isomorphic to my statement? My message has made their actions meaningful. It started with a thunderclap.

Calvin and Hobbes on Ebert's opinion of video games as art

I'd imagine readers already know about it, but Ebert posted another article about his opinion of video games as art. His stance reminded me of a Calvin and Hobbes strip about the difference between high and low forms of art. I'll repeat it here, substituting "short film" for "painting", "video game" for "comic strip", and other words as appropriate.


A short film. Moving. Spiritually enriching. Sublime. "High" art!

The video game. Vapid. Juvenile. Commercial hack work. "Low" art.

A short film spoofing a video game. Sophisticated irony. Philosophically challenging. ..."High" art.

Suppose I make a video game that contains a short film spoofing a video game?
Sophomoric. Intellectually Sterile. ..."Low" art.

Monday, May 17, 2010

DDD and pragmatism

The human brain can forge the unlikeliest of connections between disparate concepts. Domain-driven design (DDD) is a software development perspective which is described in a book and a website. Pragmatist philosophy answers fundamental questions about human existence through a framework which is described among other sources in a book of writings by William James (here I'll refer to it simply as "pragmatism" although the more accurate term is probably "Jamesian philosophy" as a whole). These two strands of thought resonate with one another in a few ways. Apologies up-front if I massacre either in my descriptions.
  • DDD insists at all times on a domain model that matches up with how the code really executes. For instance, it advises 1) using the same domain language from analysis to design to code (i.e. "ubiquitous"), 2) unifying analysis and coding to prevent the accidental creation of impractical designs, and 3) starting out any refactoring by first inferring all the current domain models and contexts and the mappings in-between. In pragmatism, statements are also put into effectual, practical terms. A statement that has no consequences has no grounds for consideration. A pragmatic philosopher approaches a statement by asking, "If this statement were true, then what difference would it make, either to my experiences or to my actions?" Just as a domain model that isn't reflected in the code is worse than no model at all, a statement that posits an utterly immaterial idea is a waste of philosophers' time.
  • Early on, DDD raises a crucial distinction between a domain model's truth and its usefulness. It's neither required nor recommended that the model be an exact replica of the domain. The model's purpose is to adequately cut through the complexity of the domain such that all participants, user and analyst and developer and code, can accomplish the work effectively. A model is one particular organizational scheme that cleanly breaks up the problem along natural contours, which is why the appropriate model for a domain depends on whatever problem is to be solved. Meanwhile pragmatism also distinguishes between truth and usefulness but by redefining truth as something known-as usefulness. That is, truth itself is a process. It's obtained neither by mere abstract logical argumentation nor by mere sense experiences but by the actions and decisions and reactions of people upon the reality kaleidoscope. As DDD practitioners select a domain model according to their needs based on relevant criteria and data, pragmatists select the truth of all statements based on a range of needs and constraints that are objective or subjective.
  • In DDD, people "crunch knowledge". The software specialists learn from the domain specialists and attempt to summarize the salient factors and operations into a domain model of ordinary-named objects that "makes sense" and facilitates meaningful communication about the software. But everyone involved should recognize that the model will change. Whether the cause is a significant disruption within the domain, a realization that the model isn't suitable for implementation due to technological constraints, or a deeper level of understanding, successive pieces of knowledge are crunched into the model and ideally result in a breakthrough to the software applying greater power, simplicity, and/or flexibility to the problems of the domain. Therefore the sign of the domain model's maturity isn't eternal perfection; it's the model's suppleness, which is its relative ease of accommodating further improvements. This notion of continuous, ongoing improvement is reminiscent of pragmatism's preference for evolutionary truth. Pragmatic truth isn't found in universal conclusions reached by closeted skeptics. It's built bit by bit as people tango with realities (whether those realities happen to be "outside" or "inside" one's self). This theory of truth is "dirtier" and less "ambitious" than the confident pronouncements made by philosophies that presume that Truth stands alone. However, the total mound of individual pragmatically-obtained truths is arguably much more reflective of the reality in which humans actually live. A straw man of pragmatism is that it asserts that "all of reality is whatever someone likes it to be". However, this argument ignores the stepwise accumulation of knowledge portrayed by pragmatists. It should go without saying that it's not pragmatic at all to disregard the entirety of one's prior discoveries in one swell foop by a disembodied leap of one's imagination. "I reject your reality and substitute my own" is certainly allowable (where would we be if we never tried to falsify predominant hypotheses?) but only to the limited degree that the individual judges and then decides it to be sensible and rational in the present case.
  • When I first read about DDD, the extent to which it emphasizes communication took me by surprise. DDD repeats the importance of communication throughout, whether from customer to analyst, modeler to developer, module-team to module-team. One of the justifications behind having a communal domain model is to "anchor" everyone's language to the same meanings. Otherwise, like when there are separate models for the purposes of analysis and implementation, potentially useful information and feedback won't flow as well and people must expend effort on translation rather than forcing the domain model into an understandable shape that intimately connects the software to the domain experts' expectations. The ideal code-to-model connection is so close that the unit tests for the domain objects are largely intelligible to the domain experts who know the model and the context. (This does NOT mean that ALL code objects in the functioning system need to be known by the domain experts. Proper layering, perhaps using techniques like dependency injection to transparently and loosely connect layers, should at least partially eliminate the need for someone to know the "gory details" to comprehend the domain layer.) The model objects are commonly-acknowledged referents for project communicators who refer to them by name. Similarly in pragmatism, any name of an objective entity is an operator. Keep in mind that an untested reference doesn't imply the reference is meaningless. Part of the meaning of a location's name refers to the proposition that I would be at that location if I traveled there. In principle, what makes a reality objective is an agreement between people about that reality's implications and verification. Of course, locations (or anything in plain view) are less arguable than generalized concepts like "chair". When I say "chair" I might be referring to a chair like the chair at my desk that easily adjusts its height and can spin, while when you say "chair" you might be referring to a chair like the one in front of your television set that's extra-cushy and has a reclining function. Clearly, since the operations and sensations that I describe about my "chair" are different than your "chair", we must pragmatically be meaning different things by the same term. Although my set of experiences differs infinitely from yours in any number of ways (I'm curious if I could prove the set of differences to be uncountable by the natural numbers), we can still cooperate and communicate on a pragmatic basis provided that we can keep our meanings sufficiently attuned for whatever end we are pursuing. In DDD, the purpose is the project, and the model of the domain objects' attributes and methods and relationships is the negotiated "agreement zone" between what the software experts and the domain experts jointly affirm about the domain's problem and solution. When I say "account", I mean the account class in our domain model whose properties, behavior, and interdependencies are all explicitly laid out; when the domain expert starts stating facts about accounts that aren't captured by the model, everyone can see that the model may need to change once more.