Structural Programming and Rational Metaprogramming

January 15, 2008 – 6:14 pm

I keep trying to put extensible programming aside, but it just won’t let me let go. (Yes, I know, the eighties want their lyrics back…) Most recently, Michael Feathers posted this piece about what he calls structural programming. As he says:

A structural program (or program snippet) is a program that is essentially a data structure on a page. The structure both dominates and conveys the semantics.

I realized years ago that this was the real difference between agile languages (like Python and Scheme) and sturdy ones (like C++ and Java): the former let you type in your data structures pretty much verbatim, and allows those data structures to include functions as easily as integers and strings. As a result, you really can work in the Turing Paradise in which programs are data and vice versa.

What’s holding us back now is our unwillingness to do more than overload operators. I can, if I try very hard, abuse this to create a mini-language that lets me type in things that look like decision tables—but Alan help me when I have to debug it. There’s a ton of good research waiting to happen here, and dozens of innovative products waiting to be built…

Coincidentally, I just saw a post from Diomidis Spinellis about rational metaprogramming. It has to lie at the heart of any extensible programming system; there are some interesting comments around his article that are worth following up.

  1. One Response to “Structural Programming and Rational Metaprogramming”

  2. Isn’t what you describe something like domain-specific languages? Martin Fowler has been advocating these in Ruby. I think your point about debugging is an important consideration, though.

    By Neil on Jan 15, 2008

Post a Comment