We're Creating the Future

Have you seen Mary Rose Cook’s Gitlet?

Oh yeah. It’s beautiful. I wish I could program like that.

Well, I’m sure that if you practice…

No, I mean I wish I could write programs in two columns with explanation on the left and the code itself on the right.

Oh, you can. You just put specially-formatted comments in your code, then run a script to extract them and—

Sorry, no, I mean I want to write programs that way—like, actually write them in two columns in my editor.

Oh. Well, you can’t.

Yeah, I know. But why not?

…because that’s not how it works? The source code for a program is just lines of text, right? And when editors do a split-pane view, they’re just showing two different portions of the same linear text.

I get that, but if I put a two-cell table into a Word document I can do actual side-by-side editing.

Sure, but Word doesn’t store things as plain text—its document format is actually very complex.

Right, but I can do the same thing with a WYSIWYG HTML editor, right? I mean, create a two-cell table and put different text side by side. I know that’s stored as plain text with a bit of markup, so why can’t I do that with programs?

You can—you just have to write a tool that extracts the code in the cells. In principle it’s no different from using specially-formatted comments.

I get the feeling we’re talking past one another. I don’t want to have to pre-process or post-process or side-process stuff—it’ll make debugging a nightmare.

I’m sorry, but today’s programming languages only handle plain text.

What about the Jupyter Notebook? It stores everything in cells—can’t we modify it to show prose and code cells side by side?

And if we’re going to do that, and if prose cells can contain angle-bracket markup, can’t we embed editable SVG diagrams in the left-hand column as well?

I knew you were going to go there…

Yeah, OK, it’s a bit of an obsession, but every programming textbook I have uses diagrams to illustrate data structures or dataflow or systems architecture or thread scheduling and I’d really, really like to be able to embed those with my code.

But you can already! You just have to—

—launch a separate editing application and create an SVG file and then add something to the notebook to include it and then look at the rendered version.

Come on, it’s not that bad.

What it is, is ironic. Here I am using an interpreted language for programming because immediacy reduces cognitive load and makes me more productive, but when I want to explain code, I’m back to a compile-link-run cycle. It just feels…backward.

What are you talking about? Software is the most innovative industry in history—we’re creating the future!

In the wake of posts about Shopify's support for white nationalists and DataCamp's attempts to cover up sexual harassment
I have had to disable comments on this blog. Please email me if you'd like to get in touch.