MIDP: New Developers Need To Get Over It Already
I get a variety of emails every week from readers of this blog, invariably there are poeple with ideas about some cool thing they want to do on their shiny new mobile phone using Java. Then send these ideas to me, and most of the time they just aren't possible.
99% of the phones out there run MIDP 1.0, the only exception that I know if is the SonyEricsson P800 which has PersonalJava (which I'll get into in a bit). MIDP is the name of the spec and libraries that is used on mobile devices - mostly mobile phones. You can get the rundown on what MIDP is and all of J2ME, and the rest of the gory details on Sun's J2ME site. But in general MIDP is one of a variety of specifications for Mobile Java that sits on top of stack of other specs. Sun, being run by complete brains and total geeks, divided up the small device world into a bunch of different "profiles" and "configurations." Everything from 32k smart cards to PDAs. All of these different specs are completely bewildering for the first time Mobile Java developer and also completley useless - except for MIDP which you can actually use for something.
Is that a little extreme? Here's a list of mobile phones with Java from Sun's site (not complete), notice how the vast majority of them have MIDP 1.0. Why does CDLC or CDC or PBP or PP even exist? Sun has more three and four letter acronyms in their Mobile Java section than they do in their J2SE section. Does this make sense to anyone?
Anyways, to the point of this mini rant. The fact is that this confusing array of TLAs and unorganized mess of a website leads to confusion about exactly how simple the MIDP profile is. Ready? MIDP is just applets for your phone. They're almost exactly the same. The applications live in a very restricted sandbox, and with MIDP 1.0 phones can basically only save persistent data within that sandbox and connect to the internet. They cannot touch ANYTHING outside that sandbox - including the phone's address book or calendar or Bluetooth - without additional proprietary APIs from the phone manufacturer. MIDP Runs on the KVM - a specially designed virtual machine that is completely different from the JVM - thus it doesn't have a lot of power and can't even process floating point numbers (i.e. anything with a decimal!!!). And 80% of the class libraries just aren't there, and the ones that are there are only partially implemented.
And this is where I talk about the developers. If you're a Java developer all excited about programming for your mobile phone, you'll run into MIDP and within a few moments (if you're anything like me) you'll get pretty depressed about it. "Man, Java on the phone will be sweet! I can't wait to use it to program my Bluetooth connection to talk to my friend's PDA and exchange information about Calendar." Or some other thing that's totally outside of the MIDP sandbox. Then developers realize they need to go back to Vectors and Hashtables, which they probably haven't used much of since, say, 1999 when Java 2 was introduced, and get really annoyed.
The fact is that programming in "Java" using the MIDP spec is as close to programming "real" Java as programming in JavaScript is in your browser. It's *that* different. The virtual machine is different, the class libraries are different, even the syntax is slightly different (i.e. no floats and only a limited set of exceptions). This will get even more different once Java 1.5 hits.
So my comment to Developers is: Accept it. This is the way it is. Once you realize you're working within the confines of a limited application, it gets pretty fun. You can memorize most of the classes in MIDP within a couple days of working with it (i.e. you spend less time in the JavaDoc), and there's more than a lot of capabilities to play with once you've accepted that you can't touch the local hardware.
There are some already impressive games and applications using Java that I've seen like EA Sports Tiger Woods Golf (3D view of the golf course) and Ubisoft's SplinterCell. The devlopers who created these games really knew their stuff and it shows the amazing potential that Java has on these phones.
And that's all I have to say about this (too much more to say). If you're a developer getting into Mobile Java, save yourself some time and skip over that phase of the learning process... the whole grief, denial, anger and acceptance phases and just accept that MIDP has limitations. Then suddenly you can start to see the other possibilities that are out there.
-Russ