Java 2 Platform, Micro Edition (J2ME) is turning into a major platform for wireless application development. Compared with desktop and server-side application development, Java-based wireless development faces some unique challenges. For example, small wireless devices have little processing power, limited memory, short battery life, and unreliable network connections. To develop wireless applications, we must design GUIs (graphical user interfaces) suitable for small devices, use lightweight components, and shift resource intensive tasks to the server side using sound network designs. As a result, J2ME supports only parts of the standard Java API libraries, with lightweight alternative APIs for handling complex tasks such as GUIs. Expertly written guides offer a great resource for wireless architects, developers, and business managers for familiarizing themselves with exciting wireless Java solutions. J2ME books are in great demand, and book publishers have responded by releasing many such books since 2000.
However, the J2ME landscape is changing rapidly. For example, the most widely deployed J2ME profile, Mobile Information Device Profile (MIDP), only reached its 1.0 release in 2001. Considering the book publishing industry's long cycles, books with mature J2ME/MIDP coverage are emerging only recently. At the time of this writing, the Java Community Process has released the MIDP 2.0 and PDA Profile specifications for public review (as of July 2002, reference implementations are not yet available). Both MIDP 2.0 and PDAP are based on MIDP 1.0, with extra add-on packages and feature sets. So MIDP 1.0 skills and general knowledge of wireless application development still prove vital for J2ME developers.
In this article, I review six J2ME books published in the first half of 2002. All are written by wireless and Java experts and published by reputable publishers:
- Core J2ME Technology and MIDP, John W. Muchow (Prentice Hall PTR, 2002; ISBN: 0130669113)
- Instant Wireless Java with J2ME, Paul Tremblett (Osborne McGraw-Hill, 2002; ISBN: 0072191759)
- J2ME in a Nutshell, Kim Topley (O'Reilly & Associates, 2002; ISBN: 059600253X)
- Java 2 Micro Edition, James P. White and David A. Hemphill (Manning Publications, 2002; ISBN: 1930110332)
- Mobile Information Device Profile for Java 2 Micro Edition, C. Enrique Ortiz and Eric Giguere (John Wiley & Sons, 2002; ISBN: 0471034657)
- Wireless J2ME Platform Programming, Vartan Piroumian (Prentice Hall Computer Books, 2002; ISBN: 0130449148)
We should remember that, while MIDP is an important J2ME profile, it is not equal to J2ME. J2ME contains several configurations and profiles suited for a variety of wireless and embedded devices. Two of the reviewed books, Java 2 Micro Edition and J2ME in a Nutshell, substantially cover non-MIDP J2ME technologies. Despite their names, Instant Wireless Java with J2ME and Wireless J2ME Platform Programming, are mainly MIDP programming technique books. Nevertheless, MIDP is crucial, and the MIDP 1.0 API comprises a major part of each book in this review.
Being the lightweight Java platform for the smallest devices, MIDP must trade functionality for size and speed. Thus, MIDP has simple programming APIs, allowing authors to easily review the MIDP application structure, API components, and give some examples. In fact, all books reviewed give good explanations and sample code illustrations on MIDP API usages.
However, wireless application development involves much more than just applying the correct API functions. For wireless developers, designing applications that are friendly to small devices with limited network bandwidths represents a crucial skill. Merely teaching a J2SE (Java 2 Platform, Standard Edition) programmer MIDP APIs does not make a good wireless Java developer. Another important aspect of enterprise-level wireless application development is the integration between J2ME and J2EE (Java 2 Platform, Enterprise Edition) applications. Since MIDP standard APIs are highly simplified, even relatively simple integration tasks, such as session tracking and communication data encryption, require much code and special techniques. So, in this review, I judge each book with the following questions:
- Does the book provide useful insights and best-practice tips on MIDP application architecture and designs?
- How useful is the sample code?
- How far does the book go in providing solutions to important wireless problems not covered by standard MIDP APIs?
- Does the book help developers integrate MIDP applications with backend application servers?
- What development tools does the book cover?
In the following sections, I review each book. At this article's end, I give a tabulated comparative summary of all reviewed books.
Core J2ME Technology and MIDP
John Muchow's book, Core J2ME Technology and MIDP, teaches beginner J2ME developers MIDP programming through abundant examples on API usages. Some samples introduce quite sophisticated techniques. For instance, he shows how to use MIDP's lightweight HTTP connections to track sessions. He then applies MIDP APIs to solve real-world problems in standalone sample applications and discusses wireless-application design issues with those applications.
In addition to MIDP programming techniques, Muchow also covers the relationship between MIDP and other Java platforms. He discusses the trade-offs MIDP must make to run on small devices. In the appendix, Muchow discusses over-the-air (OTA) application provision recommendations for MIDP applications. However, the API documentation appendix is not very helpful. I can get better information from the free online Javadocs.
This book also features excellent coverage on MIDP for Palm OS development. With the PDA profile implementations still not available in July 2002, MIDP is becoming an increasingly important platform for Java-based Palm OS application development. Muchow discusses some Palm-specific features not covered by other books in this review.
Starting from the basics, the book covers tools you need to write MIDP applications—from development tools to deployment tools and emulators. So, if you are starting to learn J2ME and want to quickly write MIDP applications to run on your Java phones or Palm devices, this book is for you. Even if you know MIDP already, you can still learn more tricks and expand your skills by studying some of the book's more advanced examples.
This book does not examine important aspects of enterprise-level wireless applications. Muchow includes little discussion on how to integrate J2ME applications with backend J2EE application servers or Web services. He also breezes through wireless network infrastructures. Core J2ME Technology and MIDP would serve as a great companion book to Manning's Java 2 Micro Edition, which I review later.
Instant Wireless Java with J2ME
As the book's name implies, Instant Wireless Java with J2ME tries to provide instant solutions for MIDP developers through a large set of sample code. You can use some of Paul Tremblett's code to directly address the standard MIDP APIs' weaknesses. For instance, the MD5 (Message-Digest Algorithm #5) login functions can both partially address MIDP's lack of cryptography APIs and add support for communication security. Another example that targets MIDP's weaknesses is the KMath package, which adds float arithmetic support to MIDP applications. Some of his samples, such as the signature verifier and the fuel-log application for tracking car gas mileage, offer useful wireless applications by themselves.
This book also provides great examples on how to work with backend databases through MIDP HTTP network connections. Throughout the book, Tremblett presents client/server programming techniques and samples.
An accompanying CD-ROM includes the book's source code. The CD also contains required server software to run the examples, a nice feature, since the other reviewed books require readers to download code and related software from the Web.
However, this book has several weaknesses. Despite the book's name, it only covers MIDP programming. The book does not paint the big picture of J2ME nor does it address application design and network architectural issues. Big pictures help developers understand wireless trade-offs and point developers to the right J2ME configuration/profile for their tasks. Instant Wireless Java with J2ME does not even cover the complete MIDP APIs; for example, it leaves out the low-level GUIs (graphical user interfaces). Tremblett should have provided more instant low-level GUI solutions for wireless game programmers.
Also, Tremblett doesn't tailor his writing style to beginner-level programmers; for example, the source code features few comments. Yes, those code samples prove useful because we can copy and paste them. But when we buy a book, we want to know how the code works and why the author designed it a certain way. In addition, the MIDP API Javadoc in Appendix B gives us no more information than the online documentation.
J2ME in a Nutshell
J2ME in a Nutshell continues O'Reilly's strong tradition of publishing excellent software technology books. Though the cheapest of the six, it doesn't skimp on quality.
O'Reilly positioned J2ME in a Nutshell to be a desktop quick reference, targeted mainly at advanced developers. Whether you're curious about a J2ME buzzword or must find a specific API function, you're supposed to find quick and accurate answers from this book, and, thanks to Kim Topley, you do. J2ME in a Nutshell thoroughly covers various J2ME configurations/profiles. Topley discusses the inner workings of J2ME virtual machines, MIDP programming techniques, API functions, over-the-air mobile application provisions, Palm MIDP tools, and various development tools (especially command-line tools, to my pleasure).
The section discussing how to embed (ROM-ize) native C code into standard MIDP KVMs offers an example of the book's extensive coverage. You can use that technique to add native functions into custom KVMs and therefore sidestep CLDC's (Connected Limited Device Configuration) lack of JNI (Java Native Interface) capabilities. The book also explains how to use the MEKeyTool to manage public key certificates on wireless devices and how to use Sun Microsystems' J2ME Wireless Toolkit to set up HTTPS secure connections between wireless devices and Internet hosts.
J2ME in a Nutshell features comprehensive tables that compare the pros and cons of different platforms and technologies. Chapter 10 compares the packages in the J2SE and J2ME platforms, which proves handy when porting J2SE programs to wireless devices. Topley includes a well-organized API documentation section illustrated with additional class diagrams.
The author's writing is extremely clear. For each MIDP GUI element, Topley shows both a cell phone screenshot and a PDA screenshot to illustrate how GUI components differ on assorted devices. That proves useful when porting your MIDP application from one device to another.
With all its strengths, the book does have some weaknesses: It lacks discussions on J2ME/J2EE integration, application design issues, and network architecture issues. As other Nutshell series books, J2ME in a Nutshell is not designed for beginners, who might find the structure and examples hard to follow.
Java 2 Micro Edition
Among all the books reviewed, Java 2 Micro Edition provides the best overview of J2ME and related technologies. James White and David Hemphill extensively discuss the philosophy and rationales behind J2ME, its architecture, advantages, and its relationship to other Java platforms. The authors go even further to present Java and non-Java alternative J2ME technologies, and give real-life best practices. It is a must-read book for advanced developers, wireless architects, and business managers interested in the J2ME technology.
For ordinary developers, this book teaches hands-on programming techniques using MIDP for cell phones and KJava for PDAs. The authors develop a wireless stock-quote application using both platforms to illustrate application designs and correct usage of API functions. Their explanation on design rationales is excellent.
Another bright spot: the book's "Beyond Specification" discussions on the integration between J2ME and J2EE applications. Without dynamic backend services, wireless applications are of little use. The authors discuss architectural and design issues before moving on to a core integration technology: XML processing. They give source code for both server- and wireless-side applications.
White and Hemphill comment and annotate all source code, which provides helpful illustrations to the main text. The book's appendix covers both command-line tools and an IDE (Sun J2ME Wireless Toolkit).
However, this book does have some flaws: The authors spend 100 pages discussing KJava for Palm PDA development. KJava is a nonstandard, pre-J2ME experimental package developed and now discontinued by Sun Labs. In fact, Sun no longer offers the Palm KJava package for download. White and Hemphill also use a development tool called JBed from esmertec to develop the KJava stock-quote application. But JBed is not a freely available tool and even esmertec's Website lacks a KJava download. You can, however, email esmertec to obtain an evaluation version.