Josh responds to an article by Bill Higgins, which ponders the nature of simplicity for humans and computers and just where those notions diverge. I’ve got a few things to say on the subject, in true Emo Programmer spirit.
The example Bill cites compares two XML fragments, each describing the same person:
<person>
<firstName>Lou</firstName>
<lastName>Gerstner</lastName>
<emailAddress>lou@us.ibm.com</emailAddress>
<city>Armonk</city>
<state>NY</state>
</person>
<person firtName="Lou"
lastName="Gerstner"
emailAddress="lou@us.ibm.com"
city="Armonk"
state="NY" />
According to Bill,
“Structurally, the element-based system is much more complex, but most people considered it much easier to read. So why is it easier for humans to “parse” one version, and easier for a programming language to parse the other.”
I agree that the latter example is harder to read, and I also agree that Josh’s proposal for pretty printing XML attributes helps out a great deal. However, even the more readable attribute based system seems more complex to me, as I emotionally examine it. :) Ok, so Kathy and David were April Fooling around with their emo programmer book, but I actually think such a book might not be a bad idea. Perhaps a less laughable name like “The Psychology of Code,” or “Humans and Markup,” would be more accepted in the anti-emo coding circles, but I think it would have much of the same content.
The key here is to understand what each fragment is asking you to presuppose in order to consume it’s structure and marshal the code into a synaptic concept. Both fragments demand that you understand the following:
- Concept Declaration
- Assigning Named Qualities to Concepts
The elemental fragment uses only one analogy to accomplish these notions, while the attributed fragment uses two. I think this is one of the reasons why it seems to be innately more complex to humans. The elemental analogy is this:
For every named concept, there is a <Concept> tag. For every qualitative assignment, a new concept will be placed before the </Concept> tag.
The attributed analogy is this:
For every named concept, there is a < Concept> tag or a Concept= declaration. A Concept= declaration will be placed inside another <Concept> tag to which the attribution belongs.
To me, this is another case of simplicity as a red-herring. Certainly the structure of the attributed fragment is simpler. It’s linear, and where the elemental fragment demands a sort of recursive definition for qualitative assignment, the attributed fragment does not.
Humans are good at understanding relationships and matching patterns. The recursive definition of the elemental block is a kind of analogy that humans appreciate and for which computers find little use.
This is because humans and computers are different. Humans specialize in receiving color emotionally, turning complex facial expressions into feelings, and developing compassion. Computers specialize in applying rigorous logic to constraints.
Simplicity, be it through brevity or structure, can be misleading. Instead, we Emo Programmers (look, they’ve created a monster) should strive for intuition. Because flagrant complexity and verbosity can lead to some very unintuitive code, there is a huge overlap between simplicity and intuition. This example, I believe, stands in their difference.
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment