The future of source code editing

As some of you might already know, I have developped a source code editor during a few years. It is a Free Software called Jext. During its development, I always tried to implement the features I needed or the ones I felt I could need someday. Unfortunately I never tried to catch a glimpse of the future and put it into Jext. Source code editing has evolved very slowly in 20 years. Sure we got stuff like folding, refactoring, code completion, etc. Yet, no feature ever dramatically changed the way we read and write code. At least none I am aware of. I know people are trying to get truly new things done, like James Gosling with his Jackpot project. Isn’t it about time to try doing something on my own?

Every programming language allows to write comments and they are perfect to add some meta data to source files. Adding meta data through comments is a widely used technique, see JavaDoc or XDoclet. It has proved to be efficient and easy to deal with, both for tools and programmers. I am sure we could use source code meta data to improve code reading. So far, I have only seen them used as tools guides. Visual Studio .NET or jEdit, for instance, let you add meta data to mark segments of code to be folded. We can do better and I have written a small demo in Java/Swing demonstrating one of the numerous possible uses.

Following the very well known precept “A picture’s worth a thousand words”, I created a very simple source code viewer able to show pictures right into your code. The demo is slow to load because of my crude syntax coloring code but that’s not the point. When I comment my code, I often feel like it would be great for other developers reading it to be able to take a lookt at a self explanatory schema rather than reading lengthy explanations. JavaDoc is half a solution since we need to look both at the generated documentation and the source file. I prefer this:

Don’t pay too much attention to the content, I used code from Jext and schemas from another application. In this example, the first comment contains a nice looking schema explaining how the MVC pattern was implemented into the application. Isn’t it cool to be able to see this without leaving the editor? Adding a picture into the code is very simple, you just need to write its filename enclosed by two sharps, as in this example:

Needless to say anyone can read this, even without the appropriated viewer/editor. At this moment, the demo only allows to insert picture in singe-line comments (//). Slash-starred comments have been omitted by pure laziness. It works really well though:

As you can see, this quick hack is far from perfect. For instance, it would be better to draw comment characters or a special border on the left of the picture. It can be quite hard to spot the comment start in these examples (it doesn’t really matter since a picture is necessarily enclosed in a comment). Displaying a picture could also simply be done with a special view in the editor or by making it float over the text or by putting it in a pane next to the editor area. This trick could be especially useful to comment code containing a lot of maths:

It is way easier to read a nicely rendered formula rather than decrypting the source code equivalent. I invite you to download the demo. It contains a test file with three pictures, the source code, the Eclipse project and the compiled binaries. I also invite you to send a comment to let visitors and I know of “futuristic” editors. Also, if you have any cool idea, I’d like to hear from it!