Java Reference
In-Depth Information
Layered on top of the device OS is the CLDC (including the JVM) and the MIDP APIs. MIDP
applications use only the CLDC and MIDP APIs. Device-specific Java applications may also use
Java APIs supplied by the device vendor.
Advantages of MIDP
Given the spectrum of configurations and profiles, why is this topic about MIDP? First, MIDP
comes at a critical time, a time when MIDP devices, like mobile phones, are an exploding
market. Simultaneously, MIDP devices are achieving the kind of processing power, memory
availability, and Internet connectivity that makes them an attractive platform for mobile
networked applications. MIDP is already deployed on millions of handsets all over the world.
Second, of course, MIDP is the first J2ME profile that is ready for prime time. You will start
writing applications as soon as you head into the next chapter!
Portability
The advantage of using Java over using other tools for small device application development is
portability. You could write device applications with C or C++, but the result would be specific
to a single platform. An application written using the MIDP APIs will be directly portable to any
MIDP device.
If you've been following Java's development for any time, this should sound familiar. It's
the same “Write Once, Run Anywhere” (WORA) mantra that Sun's been repeating since 1995.
Unfortunately, WORA is a bit of a four-letter word for developers who struggled with cross-
platform issues in JDK 1.0 and JDK 1.1 (particularly the browser implementations). While Java's
cross-platform capabilities in Java 2 are generally successful, WORA still has the taint of an
unfulfilled promise.
Does MIDP deliver painless cross-platform functionality? Yes. There will always be platform-
specific bugs in MIDP implementations, but we believe MIDP works as advertised because it is
so much smaller than desktop Java. Less code means fewer bugs when porting to multiple
platforms. Most of the cross-platform incompatibilities of JDK 1.0 and JDK 1.1 were caused by
the nightmare of trying to fit disparate windowing systems into the AWT's peer-based compo-
nent architecture. MIDP has nothing approaching the complexity of AWT, which means there's
an excellent possibility that MIDP applications will seamlessly run on multiple platforms right
out of the starting gate. Furthermore, while the JDK 1.0 test suite only included a few dozen
tests, the MIDP compatibility test suite includes several thousand tests.
Security
A second compelling reason for using Java for small device development is security. Java is well
known for its ability to safely run downloaded code like applets. This is a perfect fit—it's easy
to imagine nifty applications dynamically downloading to your mobile phone.
But it's not quite such a rosy picture. For one thing, the JVM used in the CLDC only imple-
ments a partial bytecode verifier, which means that part of the important task of bytecode
verification must be performed off the MIDP device.
Second, the CLDC does not allow for application-defined classloaders. This means that
most dynamic application delivery is dependent on device-specific mechanisms.
Search WWH ::




Custom Search