Posted by: ilaksh | April 19, 2009

2D programming via composed code-generating widgets

Here’s something I’d like to code in JavaScript in the near future.  I believe this type of approach is used somewhat commonly in UIs generated by IDEs and some metaprogramming tools.  However, I feel it should actually be useful for all types of programming.

This is an example of what a function definition might look like:


This code is created by dragging-and-dropping and then editing interactive widgets.  These widgets are in the example:

  • function definition
  • parameters sub-widget or part
  • string and numeric variable
  • return
  • html template
  • division
  • multiplication

The core of each widget is a function that takes input from the widget properties and outputs Javascript code.  The simplest example could be the code generator for ‘return’, which might look something like this:

function generate() {
  return 'return ' + this.generateChildren();



  1. I like this idea.. I might even try to make something like this too, but in Flash.

    • I think it would be very useful to do it in ActionScript 3, and actually fairly similar since its just another version of ECMAScript. Then you could compile it and it would be very fast.

      I was planning on doing a lot of this along with some real-time collaboration stuff in AS3 and stopped because I wanted to do request callbacks and change code on the fly. But it is just easier to do that stuff in Javascript, and anyway I decided to go back to Flash later.

      But what I wanted to say was, since you are talking about using Flash, in case you wanted to be able to just recompile and run the generated code ActionScript bytecode on the client so that developers could immediately see their changes in action, you could use the AS3Eval library.

  2. Great. Ilaksh’ let us know if you have a link for a prototype of this sometime.

  3. Sweet blog! I found it while surfing around on Yahoo News.
    Do you have any tips on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get there! Appreciate it

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


%d bloggers like this: