Community/Conference2012/Talks/Android

From J Wiki
Jump to navigation Jump to search

Ladies and Gentlemen,

Welcome to Toronto. My name is Michael Dykman and I am the implementer of the J Console for Android.

It is a pleasure to finally meet you all. To date, I have been a lone soldier in the J army. Part-time, a reservist really. While I am considered rather expert in a wide variety of computer languages, my 6 years of J qualify me as a journeyman at best.

I don't mind admitting that I felt somewhat intimidated by the idea of presenting a J product to the user community. I have been lurking on the mailing lists long enough to realize that all of you are much smarter than I.

It was only last February that I met Eric Iverson in person. We had agreed to meet at a local pub, just around the corner from here as I had announced my intention to implement J for the Android on the Chat mailing list. He recognized me almost immediately as I was the only person at the bar with a laptop opened to an Android emulator which was then displaying a very early version of the app.

Almost the very first words out of his mouth were to ask, where had I come from? In what APL shop had I learned the craft? The short answer is that I hadn't. I did not learn APL in a shop, in fact I don't know APL at all. But that answer avoids the truth about my personal path to J. The fact is that I had spent 1 1/2 years in an APL shop and it is with some small chagrin that I feel I must relate that story.

I P Sharp Associates, as you all likely know better than I, was an important centre of APL founded here in the city of Toronto. They employed several luminaries of the APL world including Bob Bernecky, who I understand is to speak to us tomorrow, and was the final place of paid employment for Ken Iverson. Among their most important clients was Reuters PLC, the well known news and financial wire service. Reuters was to buy I P Sharp in 1987 which occasioned Ken's retirement and it became the home of Reuters Toronto Development Team.

Moving forward some years to the year 2001, we find Reuter's, on the advice of the Gartner group, deciding to update and centralize their now widely scattered technical operations. The pronouncement went out : “Java/Sun/Oracle”. All applications were to be migrated to Java and moved to London and the various satellite development shops to be “rolled up”.

The Toronto Development Team had very little experience with Java, less with Oracle and so, a consultant was required. I was that consultant having extensive experience with Java and all things Unix. On my first day, my supervisor, Duane Sorrey, asked me if I had ever heard of APL. I hadn't. I asked him what it stood for. When he told me, having already observed his dry sense of humour, I waited for the punch line. There wasn't one.

Beyond the duties for which I had been hired, various members of the staff would wander into my office to discuss various computer-related matters. Notably, Peter Wooster would often turn up looking for perl advice. He was always kind enough to repay me for my advice by giving me impromptu APL lessons on the white board. Puzzle as I may, I had no idea what he was talking about. That situation remained largely unchanged until very nearly the end of my tenure there.

It was Bruce Amos who allowed me to look over his shoulder at an APL terminal while he demonstrated take, head, tail, curtail, shape, reshape and grade. This gave me my first glimmer of the nature of the language but I still had no idea what one would do with it. At the end of the demonstration, when I confessed to Bruce that I was still intimidated by the glyphs, he mentioned, in parting, that I might check something called J. It uses ASCII.

It was several years later and a topic for another day how I eventually picked up J but I can say that it was my very slight APL roots that brought me here today.

When I first took up J, I had a Windows CE device at my disposal which, with J5 installed, became my constant companion. While the benefits of J's brevity have been pointed out before, the value of that brevity was made manifest to me in that format. Other languages had mobile interfaces certainly; I recall a friend of mine excitedly demonstrating his Visual Studio for CE which made it possible for him to write and compile C# wherever he happened to be. However, as those of you with even a passing familiarity of C# will agree, it is a highly verbose, bureaucratic language which typically requires hundreds of lines scattered across several files to do anything even remotely useful. It struck me that it was quite unlikely that it would get much use. J told an altogether different story.

Even on that small awkward device I could write meaningful programs wherever I happened to be. These programs could be emailed to myself to run on the Mac I used at work or the linux system which I used at home and these programs would behave the same in all environments. I thought then that, among its many other astonishing virtues, J demanded a place in the mobile world. Indeed, I visualized the potential for J to become a key language in the development of powerful mobile applications.

Gradually, the CE device faded into history and I was compelled to make my outings J-free, much to the satisfaction of family and friends who suffered much from my compulsive obsession with J during those first few years. Memories of a mobile J gradually faded.

It wasn't until the appearance of the Android on the market that I gave any thought to my old friend. Here was environment which I felt reasonably sure could do J some real justice. I lurked on the lists hoping to catch wind of new mobile development but there was none. When the source code of the J engine was released under an open source license, I thought the outcome inevitable. Surely someone else was thinking as I was and would produce a J for Android in a matter of months. I dropped a hint or two on the mailing list but there was no response. Very gradually, it dawned on me that, if I wanted a mobile J, I was going to have to be the one to implement it.

It took me most of my spare time over 4 months, working with a mixture of C, J and Java before I had something I felt I could share with this august community. I learned things about the internals of the J engine I had hoped to avoid learning but it nonetheless proved to be a straightforward process. There was no need for awkward hacks; the Android environment offered everything that a basic implementation required.

My initial concept was that I wanted to be able to run plot and viewmat. By the time those first 4 months had passed, I realized that I would be unable to adapt the Android code to run the GTK graphics which those packages required.

The first time I showed the prototype to Eric back in the same pub at which we had met, he insisted that JHS should be supported which I thought contradicted my desire to have a standalone mobile J which could be used in the absence of a network connection. Fortunately, he persisted and then proceeded to talk me through a demonstration which showed that JHS already worked! Suddenly, I had plot and viewmat although it still wasn't quite what I had wanted.

It was Bill Lam who took it upon himself to fix that, having plot produce a PDF and viewmat generate bitmaps. Ultimately, it was Bill's work that gave me what I wanted. I should also like to take this opportunity to thank Chris Burke who, together with Bill, were able to give the Android the first class pacman integration which it currently enjoys. I should also like to point out that it was Chris who suggested the soft keyboard layout which is to be found in the very latest versions.

It is no surprise to anyone in this room that J is one of the most astonishing phenomenon in all of computer science. Tacit composition when coupled with rank stands in my mind as one of the most powerful and elegant constructs I have ever seen. This is a tool which needs to be in the hands of every student, every engineer, every programmer, every thinking individual.

The decision to release the engine under the GNU Public licence was an important step for the evangelism of J. It removes the proprietary licencing concerns which may have put off many potential users in the past but there is so much more to be done.

J lives in relative obscurity. Among my milieu, it is nearly unknown. We must find the means of effectively promoting it and putting it into the hands of users. We need more publicly available applications to raise it's visibility.

It is my hope that this modest app is a move in that direction.

Going forward with Android:

    • a keyboard for processing special characters (^J, etc.)
    • access to GL and native widgets to allow apps to be composed entirely in J.
    • a graphic package manager
    • a mechanism to directly email scripts.

All of the code for this package resides in publicly accessible repositories on github. I invite anyone with an interest to check it out. The environment used to develop Android applications, particularly those which use embedded C, is somewhat convoluted. Several distinct tools are required and the setup is non-trivial. Should anyone have any questions about it or just want to know what it looks like, please feel free to ask me for a demonstration.