The Practicality of J2ME Applications
ecc-comp.blogspot.com
ecc-comp.blogspot.com
When we shipped, this application ran on about 300 different devices which, for those of you who ever wrote J2ME code, is pretty impressive. J2ME development was an absolute nightmare. There was no debugging on device, pretty much no tooling, even doing a println to find out what was going on in your code was not supported (I had to write entire libraries that would display debug messages in the window titles).
The default J2ME widgets were absolutely horrendous (and they all looked different on various phones) so we had to write our own widget library. This came at a price but it was invaluable in being able to make the app work on hundreds of devices.
Looking back, I honestly don't know how we did it, but the team was absolutely brilliant.
Shortly thereafter, I joined Android where I was asked to create the Gmail application and help build up the operating system. With my experience on J2ME, I knew exactly what I wanted Android to have:
- Seamless on device debugging
- IDE support
- Powerful view system
- Java API's that look familiar to Java developers
In short, everything we never had on J2ME.
Needless to say, my subsequent work on Android was infinitely more pleasant than the year I spent on J2ME, which I don't miss one bit :-)
[1] http://googleblog.blogspot.com/2006/11/gmail-mobile-client-i...
BTW Huge fan of your work since BEA Days.
- up to date Java language version
- official tooling support for the major alternative JVM languages
- a proper simulator that does not require alternative solutions like Genymotion
- proper tooling support for editing Renderscript and OpenGL shaders
- OpenCL support instead of NIH Renderscript
Another problem was that each carrier pretty much determined what you could do, such as using GPS or network access. So one some phones it works, others it doesn't. Of course, that's assuming you can get it onto a customers phone in the first place. There were app stores, but they sucked. We used Nextel's "store", and it was not fun.
I hope the situation is better today for J2ME, since when the iPhone and Android came out, it showed the carriers that people actually do want to use their phone's full capabilities. And have an easy way to get apps onto the phone.
The first app was a general purpose data collection app. It was purely data driven. I could define a template on our server which defined what fields you wanted information for, the type of field (text, number, list selection, etc) and if it was geo enabled. This would be sent out to the phone, and a user could enter the information, send it up to our server and view it on a map. Doesn't sound to exciting, but you could pretty much create a template for anything, This was before google maps, so we also had to manage the shapefiles and handle displaying and rendering them on our website.
The other app was a payroll app for harvesting crews. We could set up the crew members on the server, they would get downloaded to the phone where we used a bluetooth card reader to scan them in/out. Also added some bluetooth printing.
Overall, you could be productive using J2ME. It was just all the stuff that went with getting it out to users.
J2ME is used a lot in embedded systems for factory control, automotive systems, network aware measure equipment, copiers, ...
Edit: forgot to mention that in the mobile area it is actually sad, specially with Oracle pushing ADF Mobile instead. So back to C++ for multi-platform code.
I also found that among the handful of J2ME/LCDUI implementations required to cover a broad range of handset models, they all had different bugs, and I had to make a compatibility layer to smooth over these differences and bugs. BUT, nevertheless, it is possible to make a UI in single digit KBs that is portable across multiple J2ME implementations.
Back then, I wrote a Twitter client app for them J2ME phones with some processing offloaded to the server, which was done in Erlang :) Ah, the times.
I do not ever want to go back to that time and any developer romanticising horrible tech needs to develop an actual real world app or two on a number of handsets before going all gooey eyed.
It makes me sad to read this.
The first iPhone had no third party applications, no API, no SDK, nothing. It was impossible to write apps for the iPhone then, Steve Jobs thought that HTML 5 should be good enough.
He changed his mind only after Android shipped with a full SDK.
There may have been an Android SDK before there was an iPhone SDK, but iPhone was the first whose apps actually ended up in the hands of the general public. Apple had their App Store up and open to developers and the public by July 2008. The first shipping Android phone was still three months away.
I was just debunking this claim.
Android 1.0 went to market with a full blown SDK and the vision that the future belongs to third party apps.
Steve Jobs completely disagreed with this vision and he only changed his mind after Android shipped.
Jobs changed his mind sometime before October 17, 2007. We know this because it was on that date that Apple published a note in his name announcing that they were going to allow third party apps and that the SDK would be available by February 2008 [1].
At that date in the Android world, Android only existed as an alpha within Google, and had not yet even been officially announced. It wasn't announced until the first beta, November 5, 2007. The first Android SDK was released November 12, 2007.
By the end of the first weekend that the Apple App Store was available, they had 10 million downloads from real customers. By that weekend in the Android world, there were 0 apps in the hands of real customers. So yeah, it was indeed the Apple App Store that kickstarted the "App on a phone" market.
[1] http://web.archive.org/web/20071020040652/http://www.apple.c...
I've written android applications so it'll be something to compare this experience to.
Yes I am naive in J2ME development X) But everyone's stories have been interesting to read!
I predict that in a few months from now, you'll be coding on Android exclusively and you'll never try J2ME ever again.
Unfortunately JRE 1.3 is almost 15 years old, and it's just annoying to e.g. not even be able to use java.util.List. And MIDP just isn't very rich in support for ... anything.
But FWIW you can compile C to J2ME, and it kinda works: https://code.google.com/p/cibyl/
Hopefully it's as simple as it appears.
Early on, this led developers to having to make a choice... Code to pure (or mostly pure) J2ME and run everywhere, or fully embrace the BB-specific APIs. The former was attractive in theory, but the latter was a necessity to make your app actually look-and-feel correct and actually integrate with the platform.
As time dragged on, however, it felt like the BB SDK got all of its limitations from the J2ME base without actually deriving any benefits. Meanwhile, Android showed that you could actually do modern Java on a mobile device.
Additionally, most developers are aware that mobile app purchases most often happen immediately after the purchase of a device, and lots of users never buy another app again. This is even more stark a scenario in the J2ME world (particularly in the US - though we make up a small amount of the J2ME devices in use).
I'm really just highlighting that while some of the aspects have allure, many of the challenges that are present in the current 'mobile' (android|iOS) landscape are simply heightened in the j2me world.
But one day I had to write a MIDlet that would need to receive a more complicated data structure. As I was the one person in charge of writing both the MIDLet and the server side servlet I could choose any format I wanted for the data.
I decided that XML was too verbose, and I decided to use lisp-like S-expressions to encode the data. Writing the parser, which took a string and converted it to a list of cons cells and atoms, took me about 2 hours. Then I decided that the best way to debug it was to write another routine to translate those cons cells and atoms back into a string, then to write a loop that read a string parsed it and then took the data structure, converted it back to a string and printed it. About half an hour later, I had a program that could read S-expressions and print them back (running it on my computer using the subset of Java that could run on a mobile phone).
Then I realized that I had a read-print-loop, and if I added an eval to that loop then I would have a lisp interpreter. Nine hours later, I had a simple Lisp interpreter that could run on J2ME devices!
I was so happy about my J2ME lisp interpreter that I decided to add support for lisp macros. That turned out to be harder, it took me three days to have a version with a working defmacro.
Then I added a way to open a bluetooth connection to my computer, where I had a small program that would send anything it read from standard input to the mobile phone and then print out on standard output the response it got from the phone. I now had an interactive REPL to execute Lisp code on my phone. With this I could write and debug MIDlets much faster than before.
All the MIDlets I wrote in the following weeks were written in Lisp.
I then decided that my Lisp interpreter was too slow for some applications and decided to write a compiler that turned Lisp code into bytecodes I could efficiently interpret in a J2ME lisp virtual machine. I took the scheme compiler described in Norvig's "Paradigms of Artificial Intelligence Programming" and translated it into my version of Lisp (which was very similar to scheme). Then I used my Lisp interpreter to compile the compiler itself into bytecodes. This part turned out to be much harder than I expected, it took one month of hard work to make the transition from interpreted Lisp to compiled Lisp.
The result was a very compact J2ME Lisp environment. A MIDLet with the Lisp virtual machine, Lisp compiler and basic runtime libraries was about 32 KB (and a full MIDlet with application specific code was usually less than 50 KB). It could connect to a server over bluetooth or TCP/IP to give me an interactive REPL, and it could also dynamically download new code to extend its functionality without requiring the user to install a new version of the MIDlet.
This post somehow made me think of the first English language blog post from early 2006 that really appreciated what we (me and my team) accomplished:
http://www.russellbeattie.com/blog/1008770
"Opera Mini: Best Mobile Web Browser Bar None
Posted Tuesday, January 24, 2006 12:41 pm"
I really think that if the goal of firefox os was to create smartphones affordable to everyone , they should have gone with opera mini - they've would've got better performance at lower costs.