programming in the
twenty-first century

It's not about technology for its own sake. It's about being able to implement your ideas.

The World's Most Mind-Bending Language Has the Best Development Environment

I highly recommend that all programmers learn J. I doubt most will end up using it for daily work, but the process of learning it will stick with you. J is so completely different from everything else out there, and all your knowledge of C++ and Python and Scheme goes right out the window, leaving you an abject, confused beginner. In short, J will make you cry.

But that's not what I want to talk about. Though it's a bizarre and fringe language (yet not one of those programmer attempts at high humor), J is the most beautiful and useful development system I've come across. I'm not talking about the language itself, but the standard environment and add-ons that come with the language.

The IDE is more akin to Python's IDLE than monstrosities which may come to mind. There's a window for entering commands and seeing the results, and you can open up separate, syntax-colored editor windows, running the contents of each with a keypress. It's nothing groundbreaking, but it's something that most languages don't provide. And in the spirit of IDLE, J's IDE is written in J.

(I'll interject that J is cross-platform for Windows, OS X, and Linux, including 64-bit support, just in case anyone is preparing to deride it as Windows-only.)

Then there are the standard libraries: 3D graphics via OpenGL; full GUI support including an interface builder; memory-mapped files; performance profiling tools; a full interface to arbitrary DLLs; regular-expressions; sockets. Again, nothing tremendously unusual, except maybe memory-mapped files and the DLL hooks, but having it all right there and well-documented is a big win. Beginner questions like "What windowing library should I use?" just don't get asked.

The first really interesting improvements over most languages are the visualization tools. It's one line of code to graph arbitrary data. Think about that: no need to use a graphing calculator, no need to export to some separate tool, and most importantly the presence of such easy graphing ability means that you will use it. Once you get started running all kinds of data through visualization tools, you'll find you use them to spot-check for errors or to get a better understanding of what kinds of input you're dealing with. It goes further than just 2D graphs. For example, there's a nifty tool that color codes elements of a table, where identical elements have the same colors. It makes patterns obvious. (Color code a matrix, and you can easily tell if all the elements on a diagonal are the same.)

What makes me happiest is the built-in tutorial system, called "Labs" in J lingo. It's a mix of explanatory text, expressions which are automatically evaluated so you can see the results, and pauses after each small bit of exposition so you can experiment in the live J environment. Labs can be broken into chapters (so you can work through them in parts), and the tool for creating your own labs is part of the standard J download.

While many of the supplied labs are along the lines of "How to use sockets," the best ones aren't about J at all. They're about geometry or statistics or image processing, and you end up learning J while exploring those topics. J co-creator Ken Iverson's labs are the most striking, because they forgo the usual pedantic nature of language tutorials and come across as downright casual. Every "Learn Haskell" tutorial I've read wallows in type systems and currying and all the trappings of the language itself. And after a while it all gets to be too much, and I lose interest. Iverson just goes along talking about some interesting number theory, tosses out some short executable expressions to illustrate his points, and drops in a key bit of J terminology almost as an afterthought.

If you're wondering why I love the J environment so much but don't use it as my primary programming language, that's because, to me, J isn't suited for most projects I'm interested in. But for exploration and learning there's no finer system.

(If you want to see some real J code, try Functional Programming Archaeology.)

permalink August 24, 2009

previously

archives

twitter / mail

I'm James Hague, a recovering programmer who has been designing video games since the 1980s. Programming Without Being Obsessed With Programming and Organizational Skills Beat Algorithmic Wizardry are good starting points. For the older stuff, try the 2012 Retrospective.

Where are the comments?