Today's Question:  What does your personal desk look like?        GIVE A SHOUT

Illiterate Programming

  David Nolen        2012-02-10 06:20:52       2,629        0    

Donald Knuth cleverly imprisoned the phrase "Literate Programming" - if you're not documenting your source with his particular methodology then you must be a proponent of "Illiterate Programming," which sounds truly awful.

I very much believe in documented code but I think no amount of pontification in English will ever make a piece of code clearer than the code itself (I'm not talking about project or API documentation). I'm also not talking about the superficial notions / arguments of "readability" that are bandied about these days (Python, CoffeeScript, etc).

Most languages have no deep notion of readability in their core. 

Take a look at this page of Smalltalk:

One of the most lovely ideas in Smalltalk was the ad-hoc categorization, "protocols" - here you see initialization, accessing, private. These were not reified in the language but instead were a level of documentation baked right into the software writing experience.

In a similar vein, one of my favorite features of Clojure and ClojureScript is protocols. Their least celebrated benefit is readability - here's how JavaScript primitive arrays are extended to participate in some core language concepts:

(extend-type array
ISeqable
(-seq [array] (array-seq array 0))

ICounted
(-count [a] (.-length a))

IIndexed
(-nth
([array n]
(if (< n (.-length array)) (aget array n)))
([array n not-found]
(if (< n (.-length array)) (aget array n)
not-found)))

ILookup
(-lookup
([array k]
(aget array k))
([array k not-found]
(-nth array k not-found)))

IReduce
(-reduce
([array f]
(ci-reduce array f))
([array f start]
(ci-reduce array f start))))

view raw gistfile1.clj This Gist brought to you by GitHub.

Smalltalk has so very few concepts - it's truly stunning. There's nothing more powerful in aiding readability than a small core set of concepts. In this sense I think Smalltalk continues to be one of the few languages to get anywhere near LISP. Most languages these days are just an abomination of features trapped inside of a compiler.

Yet I think Smalltalk still fundamentally failed (remember this is a programming language originally designed to scale from children to adults) because Objects are really hard and no-one really understands to this day how to do them right. This isn't to say they aren't incredibly useful but I think we've truly gone down the wrong path by putting then onstage. They should be backstage patiently waiting for those folks when they're ready to see how the pudding is made (Art of the MetaObject Protocol).

So I suggest repurposing "Illiterate Programming" to mean something very different. Programs, programming languages, and programming paradigms which strive for readability at a deeper level - the elegant self-evident architecture of very simple concepts. "Literate Programming" is admission of defeat.

Source:http://dosync.posterous.com/illiterate-programming

PROGRAMMING  ILLITERATE 

Share on Facebook  Share on Twitter  Share on Weibo  Share on Reddit 

  RELATED


  0 COMMENT


No comment for this article.