Saturday, February 2, 2013

How to teach anyone to program using Xerblin

I have long maintained that anybody who can solve a sudoku puzzle is more than capable of learning to program.  The Xerblin system provides a programmable metaphor for normal people to enable them to use their computers to greatest effect.

If you go step-by-step, in the right order, it is very easy to teach the Xerblin metaphor to anyone in about a half an hour.  This gives them the ability to program the various versions (firmware, server, web page) as well as a solid foundation to learn more.

Stack of Plates

Everyone already knows what a stack is: you put down a plate, and then put another one on top of it, then another, and so on. When you need a plate you take one off the top of the stack ("TOS").

Dictionary of Words

Again, everybody knows what a dictionary is: it's a bunch of words and their definitions. In Xerblin the words are all commands that work on the stack at first, but the user can "inscribe" anything they like in the dictionary.

Put Numbers on the Stack, Be a Calculator

So put some numbers onto the stack and use the four math commands to do some simple math.  Everybody knows how a calculator works, so you explain this as "just another kind of calculator." If you're doing it right they'll be getting impatient with you for explaining such obvious stuff.

Put "Strings" of Text on the Stack

Most people won't have encountered the term "string" for a sequence of characters yet, so be careful to explain that before you use it.  I've hit that whirlpool a couple of times.
"What's a string?"

"You know what a turtle is?"


"Same thing."

I'm not the best and most highly focused teacher sometimes.

Anyhow, put some strings on the stack. Show how they are just data like the numbers.  Add a couple of strings together.  Multiply a string by an integer. Go nuts.

Now that you have established that you can have a string on the stack...

Lookup & Inscribe

Show how the strings-as-data become strings-as-names. This is the power of names and is the single fundamental phenomenon underlying all computation and, indeed, all thought. The fact that one piece of the universe can serve as a "name" for another piece of the universe is completely incontrovertible and yet totally inexplicable.

This sentence does not describe itself.

Naming enables programming.  When the folks can put named things into the dictionary and get them back out again the key is in the lock.

Put a Command on the Stack

Turn the key, unlock the door. By putting a command word (function) onto the stack using a string as the name, it becomes data and can be subjected to manipulation just like numbers and strings.

This is the very essence of programming: verb becomes noun, action becomes recipe, and we can reason about the static pattern we see.

Programming is the alphabet of thought.

sqr() = (dup(), mul())

There is no one-true-computer-language (except Lisp, heh) in the same way that there is no one-true-circle, or one-true-triangle. But this metaphor is both useful and as simple as I could make it, and I have already taught several people how it works.

Now that I have a proper format I am teaching people how to use it in earnest. I have a client who is producing SVG animations using it.  (I'll add links when he's ready to publicly show it off.)

I see a great potential for programmability to become commonplace. It would make developers' lives easier and free users from the tyranny of crappy interface design.

1 comment:

Simon Forman said...

After this preamble the user is ready to proceed to