Monday, 6 August 2007

Making code editing a better experience, part 2

Few ideas

Well, to be honest, I intended to split my previous article into two. This part was to describe some further ideas. All of them were addressing the same issue: handling repetitive code.

The first one could be called 'programming by example'. People (I at least) tend to think in examples. Why couldn't we make our languages and IDE's support it. You could write your function once just like you write any other code, and then, when you find out you could use it again, you do 'intelligent copy&pasting'. The code still looks quite dumb and easy (I mean: no loops were extracted) but the link exists and you make hard use of it when your code needs change.

The other idea was inspired by spreadsheets. I still remember how impressed I was on excel's unfolding characteristic values (I was around 10 then). When you enter '1' in one cell, and '2' in the cell below, you can grab the corner, and all following cells get filled with values 3, 4 etc. It worked even for months and weekdays!

Again: why couldn't we implement similar feature in some IDE? I know, that you don't use 1-10 enumeration very often, but if you could get your values filled from lists and other enumerables from within your code, that could do the job.

Yet another idea came from reflexions over lisp. I met too many people claiming that lisp is the king. Why did they say so? One of the killer features of lisp are of course macros. Unfortunately, they tend to become really hard to code in other languages. That's because most languages first need to get parsed into what's called Abstract Syntax Tree. Lisp is an AST itself. The parsing is dumb easy. That makes writing macros possible.

The idea is: if whatever we do, we do it on AST, why not interact with it directly? And no, I'm not talking about using lisp or scheme. I'm talking of a GUI that let's you drag&drop tree elements, fold and unfold them and visualize yourlogic this way.

The good news: subtext

Imagine my surprise, when I found out, that all these ideas are already in use. What's more: I have only scratched the surface. There's a whole new way of programming being built around that. For three years already! The conclusion is conditional: either I'm getting overexcited on something that's not so hot, or we're about to experience a big change soon...

No comments: