Nov 7, 2015
Literate Programming in Mu
(This post was retconned from one I wrote in 2019.)
I've been building built a text editor in my programming language Mu.
The language is a little unconventional. It is purely statement-oriented, like
Assembly or Basic. Every statement has just one operation, and its arguments
have to be variables or literals.
The editor is a little unconventional. It is built up out of layers (1, 2, 3,
4, …) arranged so that layer 1 will build and run and pass any tests
defined in it. Similarly, so will layers 1+2, 1+2+3, and so on.
Later layers add to the code of earlier layers using directives like
`before
` and `after
` on labels. (A
statement-oriented language really helps here.) But later layers never modify
tests of previous layers. Layers monotonically accumulate constraints.
Read more →
* *
Sep 6, 2015
Teaching taste
“You can know the name of a bird in
all the languages of the world, but when you're finished, you'll know absolutely
nothing whatever about the bird." —
Richard
Feynman
I've been teaching programming using my new UI for just
about six weeks now, and it's been miraculous and endlessly fascinating to
watch a young mind up close. I'm still processing many of my observations and
lessons, but I want to describe how one of my students learned something I
never meant to teach: consistent indentation.
The only thing I did to help him learn indentation was this: I never ever
brought it up. Mostly because I just don't
consider it very important, especially at such an early stage. When I
wrote programs to demonstrate features I indented as I normally would, then
I'd hand over the keyboard, and ignore the fact that my student was abutting
each line of code with the left margin.
Read more →
* *
Jul 21, 2015
An experimental UI for teaching programming
Six months ago I fell into a little gig to teach two students programming, and it's been an eye-opening experience. Where I was earlier focused on conveying codebases to programmers, I've lately been thinking a lot harder about conveying programming to non-programmers. I think the two might be special-cases of a grand unifying theory of software representation, but that's another story. For now I don't have a grand unifying theory. What I have is a screenshot:
Let me describe the tool and the problems that it tries to address. When I started out teaching I picked an existing platform that I'd always liked. But quickly I started noticing many limitations. Today's platforms are great for experienced programmers and one can do great things with them, but they are very alien to noobs, who suddenly have to learn many different things at once.
Read more →
* *
Oct 3, 2014
Literate programming: Knuth is doing it wrong
Literate programming advocates this: Order your code for others to read,
not for the compiler. Beautifully typeset your code so one can curl up in bed
to read it like a novel. Keep documentation in sync with code. What's not
to like about this vision? I have two beefs with it: the ends are insufficiently
ambitious by focusing on a passive representation; and the means were insufficiently
polished, by over-emphasizing typesetting at the cost of prose quality.
Elaboration, in reverse order:
Read more →
* *
Sep 9, 2014
Consensual hells: Geopolitics for individuals
My third guest post at ribbonfarm.com.
permalink
* *
Apr 9, 2014
Consensual Hells: The legibility tradeoff
My second guest post has just been published over at ribbonfarm.com,
on the subject of building capture-resistant organizations. Tl;dr - constrain
individual discretion at the top, and empower it on the fringes. But the
direct ways to do that won't work. What will? Read on →
permalink
* *
Feb 12, 2014
Consensual Hells: From cognitive biases to institutional decay
I've just published the first of a series of guests posts over at ribbonfarm.com. Check it out.
permalink
* *
Oct 7, 2013
A new way to organize programs
If you're a programmer this has happened to you. You've built or known a
project that starts out with a well-defined purpose and a straightforward
mapping from purpose to structure in a few sub-systems.
But it can't stand still; changes continue to roll in.
Some of the changes touch multiple sub-systems.
Each change is coherent in the mind of its maker. But once it's made, it
diffuses into the system as a whole.
Soon the once-elegant design has turned into a patchwork-quilt of changes.
Requirements shift, parts get repurposed. Connections proliferate.
Veterans who watched this evolution can keep it mostly straight in their
heads. But newcomers see only the patchwork quilt. They can't tell where one
feature begins and another ends.
What if features could stay separate as they're added, so that newcomers could
see a cleaned-up history of the
process?
Solution
Read more →
* *
Oct 6, 2013
How I describe my hobby to programmers
(I still haven't found a way to describe it to non-programmers.)
Wart is an experimental, dynamic, batshit-liberal
language designed to eventually be used by small teams of hobbyists writing
potentially long-lived software. The primary goal is to be easy for anyone to
understand and modify. This goal goes for both code written in Wart, and
the code implementing Wart.
$ git clone http://github.com/akkartik/wart
$ git checkout c73dcd8d6 # state when I wrote this article
$ cd wart
$ ./wart # you'll need gcc and unix
ready! type in an expression, then hit enter twice. ctrl-d exits.
1+1
⇒ 2
Read more →
* *
Aug 13, 2013
The trouble with 'readability'
We programmers love to talk about the value of readability in software. But
all our rhetoric, even if it were practiced with diligence, suffers from a
giant blind spot.
Exhibit A
Here's Douglas Crockford on
programming style. For the first half he explains why readability is
important: because our brains do far more subconsciously than we tend to
realize. The anecdotes are interesting and the presentation is engaging, but
the premise is basically preaching to the choir. Of course I want my code to
be readable. Sensei, show me how!
But when he gets to ‘how’, here is what we get: good names,
comments and consistent indentation. Wait, what?! After all that discussion
about how complex programs are, and how hard to understand, do we really
expect to make a dent on global complexity with a few blunt, local
rules? Does something not seem off?
Exhibit B
Read more →
* *