The Allure of the Asymmetrical

Thoughts on code asymmetry, as inspired by the lowly egg.

Although I’ve lived in Charlottesville for quite a while now, I haven’t really taken advantage of the numerous and various local farms. This is perhaps odd, given my health-obsessive nature, and our local prevalence of natural, grass-fed animal products. But whatever the impediment to my action — let us suppose schoolwork, research, or entrepreneurial activity — I finally got around to patronizing Avery’s Branch Farms last week.

So what does this have to do with asymmetry?  Well, I’ll be short and banal and to the point: I found that the “natural” Avery eggs look nicer than their industrial-farm begotten counterparts. Consider Avery eggs:

Avery Eggs

Against that of the typical no-name brand:

Eggs Normal

At least to my eye, the local farm’s eggs look quite a bit more appealing, and not simply because of differences in color or lighting. To my unartistic perception, I would suggest that the appeal stems directly from asymmetry. If you look closely at the farm eggs, you might see that there are small but noticeable deviations in size across the carton, a slight variance in color, and a psuedo-random sprinkling of freckles across shell exteriors. This is all in comparison to the bleached look of the industrial eggs, with little or no variation in egg-size across the carton.

Rest assured, lest I be accused of inane ramblings on this wonderful subject, that there is a larger point here. I am guessing that a slight asymmetry plays nicer with human perception. It might draw our eyes to important details, and make it easier for us to perceive the totality of written information. In short, asymmetrical perception may may implications for how we write code.

Consider the comparison of a C function (taken sort-of randomly from Git) and a lisp function (taken from Gajure). First let’s look at add_files_to_cache:

Reading from the left, this function is actually quite symmetrical. The eye is not overly drawn to any particular piece of code within the curly braces — perhaps the longer lines, if anything — and functional properties are not clearly conveyed through it’s structure. Much of this, although not all of it, has to do with the imperative nature of C.  Now, consider a second function, list-crossover:

Here we see a nesting of sorts. Although this is a simpler function, to be sure, we can see by way of indentation certain functional qualities of the code (say, that take and drop are applied in the context of concat). The functional nature of clojure (or any lisp) lends itself well to this kind of visual deconstruction, and at least to my eye, meaning is more readily conveyed through such asymmetrical properties.

In closing, I don’t mean to imply that one language is better than another at conveying meaning through syntax and symmetry, merely to suggest that the way code is written (surprise, surprise, no?) has quite a bit to do with how easily it can be understood. To that end, I think symmetry, or a lack thereof, plays an important role.

This entry was posted in C, Clojure, Computer Science and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Trackback

  1. [...] This post was mentioned on Twitter by kicauan, Hacker News. Hacker News said: The Allure of the Asymmetrical | Ethan Fast: http://bit.ly/draoEo Comments: http://bit.ly/a9mgWo [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>