Quest for the Holy Rails

May 18, 2007

Intentional Programming

Filed under: Off Topic — Jake Brownson @ 6:28 am

I apologize for the long delay in posts, my parents were in town last week, and this week I’m catching up on homework. In the meantime I discovered an interesting programming paradigm that I’d been thinking about for awhile now, but didn’t know it had a name. It’s called intentional programming.

I really like the idea of allowing flexible levels of code abstraction. Wouldn’t it be great if software engineers could work the abstraction levels up from raw assembly to C-Style to Ruby style to DSL style using the same “language”? Then domain experts could work at the DSL level. Imagine being able to read the code at DSL level, and to “zoom in” on trouble parts to see what’s going on. Comments and external documentation shouldn’t even be necessary anymore. Instead you can just zoom out until it’s clear what the block you’re looking at does. This is already almost going on, but the abstraction levels are almost completely separated. We have assemblers, compilers, interpreters, and libraries. Putting all this into an integrated stack could be really powerful.

I also really like the idea of separating code source storage and presentation. Why are we all still working with ASCII fixed width text files? Source code should be stored as XML (or something like it) and the editor should present and allow us to edit it any way the programmer chooses. To one programmer the file looks like a standard text file w/ tabs and fixed width font, to another maybe it looks like a bunch of balloons connected with arrows. Maybe the first programmer is a software engineer and needs to be able to dig deeper down the abstraction layers, and the latter is the domain expert.

I’d like to see a “language” that has as close to zero primitives as possible. It should simply be able to translate one layer of abstraction to another. The terminal layer being assembly/machine code (or maybe even bytecode?). The programmer would be able to build as many abstraction layers on top as were needed. It wouldn’t have an if statement primitive, but in a library would have some “code” describing how to translate “if (true) then i = 1 + 0” to the appropriate machine code. Instead of including “if”, “for”, “while”, etc as primitives in the language they should be in libraries. Then it would be possible to extend the syntax of the language. You could include a library that would let you write ANSI compliant C with for_each support on arrays perhaps. This last bit reminds me a bit of the .NET stuff where you can write code using different languages. I think it’s a bit different though as I believe .NET is just a collection of separate compilers that generate CLR code that can be interlinked. I’d like to see the “primitives” or even syntax of a language defined as much as possible in libraries that can be extended.

If the compiler were able to understand the mathematical properties of the machine code (like adding or subtracting 0 doesn’t change the number) then it could know that “i = 1 + 0” is the same as “i = 1”. It could figure out on the fly what could be done statically at compile time and what needs to be done dynamically at runtime. It’s all still pretty rough in my mind, but I think there is a ton of potential for optimization. I think a lot of the ideas of generic programming fit in very well here.

I can’t really put it into concrete examples yet, but it’s really interesting as a dual-major hardware/software engineering student to see the differences between “programming” hardware and software. I think the software engineering community could really take some lessons from the hardware community. I love how I can describe how I want a block of logic to work using if’s/cases/boolean logic and the compiler will break down all the barriers I’ve set up to keep the code modular and optimize it down to a minimal set of logic equations. That seems pretty close to intentional programming. I’m writing what my intention is, and the compiler figures out how best to do it. When I write C I feel like I’m just using shorthand for assembly. I need to study how optimization works in today’s compilers, maybe it’s more like hardware than I think, but today’s programming languages are still based heavily on the principles of C which was initially intended to map quite directly to machine code.

Well this turned out to be a longer, and less organized post than I intended it to be. I really think there’s some great potential in a combination of this Intentional Programming idea and Generic Programming. I really need to read up on some of these ideas when I get a chance to see what work is already being done.

Update: There’s a great paper from the company Intentional Software that goes into really good detail on some of these ideas. If you find these ideas interesting, or don’t quite understand what the ideas mean I would highly recommend reading it.


1 Comment »

  1. Hi Jake,

    You make a lot of good points and I could not agree more. We are working on realizing this vision. Feel free to contact me if you want to learn more.

    Comment by Magnus Christerson — May 19, 2007 @ 8:27 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: