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.
The authors tried to use KJava to give readers a feeling of real Java-based Palm PDA programming in the absence of the PDA Profile (MIDP was not originally designed for PDAs and therefore cannot fully leverage many PDA features). But now, since the PDA Profile's release, KJava is almost completely irrelevant.
Mobile Information Device Profile for Java 2 Micro Edition
C. Enrique Ortiz and Eric Giguere do not claim to have written a general J2ME book. They accurately titled this book Mobile Information Device Profile for Java 2 Micro Edition and thoroughly explained MIDP APIs with extensive examples. When it comes to using MIDP API functions creatively for real-world problems, this book is the best in the bunch. It covers advanced issues such as how to maintain HTTP sessions, object-to-record-store mapping, and multiple alerts. The authors also go beyond MIDP specifications and devote two chapters to security and XML processing.
Chapter 10 "Techniques for Writing Better MIDP Applications" is excellent; every MIDP developer should read it. The authors discuss several techniques and patterns designed to produce better mobile code. For example, you should probably put a network-download process in a separate thread to avoid blocking the user interface when the wireless connection is slow or lost. Another useful technique: Simulate J2SE's
ResourceBundle in MIDP to support wireless internationalization and localization.
On the server-side integration front, this book contains simple examples to illustrate how to access backend data through a servlet gateway. The book even illustrates how to process Web services SOAP (Simple Object Access Protocol) messages on the wireless device side. The authors demonstrate those techniques in real-world sample applications. The book's email application has both educational and practical values.
The security section, however, is disappointing. The authors could have written a better discussion on how to use the Bouncy Castle Crypto APIs to implement communication security solutions in MIDP applications. Instead, they waste time explaining basic, well-known security concepts and cut/paste Bouncy Castle source code without much explanation. Generally, the source code listings have too few comments. However, novice readers who have little security knowledge might find this book quite useful.
The API documentation at the end of the book eats up more than 60 pages and basically copies the Javadocs available on the Internet. The authors could have better used this space by presenting some big-picture and general J2ME issues. Overall, Mobile Information Device Profile for Java 2 Micro Edition is a hands-on book for MIDP developers at all levels.
Wireless J2ME Platform Programming
In plain terms and easy-to-follow examples, Vartan Piroumian discusses the structure and life cycles of MIDP applications, development tools, and usages, and the all-important MIDP APIs in Wireless J2ME Platform Programming. The MIDP low-end API chapter is particularly well written and could prove quite useful to wireless game developers. For beginner-level developers, this book offers an excellent introduction to basic MIDP concepts and techniques. As expected from a Sun author, this book extensively covers Sun's powerful J2ME Wireless Toolkit.
The last three chapters of the book are excellent. In Chapter 9, the author gives a comprehensive discussion on wireless internationalization issues and offers a solution, with sample code, for simulating J2SE
ResourceBundle on the MIDP platform. Chapter 10 details over-the-air mobile application provision issues. Since the formal OTA spec and network carrier support are still in their infancies, discussing OTA in accurate terms that prove useful to developers is impossible. But this book's OTA discussion proves valuable to business managers and strategic developers who want to know how Java-based digital wireless networks work. Chapter 11 discusses the general structure of wireless data networks and some architectural issues.
However, Piroumian could have improved a number of discussions. From the viewpoint of MIDP programming, this book lacks small device application design topics. Because the book is targeted for beginner-level programmers, it doesn't cover J2ME/J2EE integration topics. The author limits the development tool and platform coverage to J2ME Wireless Toolkit and fails to discuss Palm OS MIDP tools.
Since this book is titled Wireless J2ME Platform Programming and is from Sun Press's Java series, I expected to find some balanced discussions on the different J2ME platforms and techniques. I was disappointed that the book covers only MIDP programming.
To see how the books compare to each other, check out the table below. However, remember that a 1-to-5 numerical scale is often too coarse to judge a book. Different books target varying audiences, emphasize different materials, and present ideas differently. I recommend reading the individual reviews carefully before purchasing any books.
All six books reviewed in this article are satisfactory. But none stands out as the best for all occasions. If you are just beginning J2ME programming and want to learn MIDP skills, Core J2ME Technology and MIDP and Wireless J2ME Platform Programming offer the best introductory texts. If you are an advanced developer, Core J2ME Technology and MIDP and Mobile Information Device Profile for Java 2 Micro Edition can teach you new programming techniques and give you application design advice. Mobile Information Device Profile for Java 2 Micro Edition and Instant Wireless Java with J2ME provide many reusable code samples. If you already know J2ME and MIDP, J2ME in a Nutshell is an excellent reference book. If you are a wireless enterprise system architect, a business manager, or an advanced strategic developer, you must read Manning's Java 2 Micro Edition.
J2ME is a collection of fast evolving technologies. MIDP 2.0 and PDA Profile are already in public review at the time of this writing (July 2002). Other J2ME profiles such as the RMI (Remote Method Invocation) Profile, Personal Profile, and Game Profile will come out soon. Community efforts are also underway to develop enterprise-level wireless application APIs, such as XML-processing and security APIs. So, we should watch out for many more exciting J2ME books!
Learn more about this topic
- Core J2ME Technology and MIDP, John W. Muchow (Prentice Hall PTR, 2002; ISBN0130669113)
- Instant Wireless Java with J2ME, Paul Tremblett (Osborne McGraw-Hill, 2002; ISBN0072191759)
- J2ME in a Nutshell, Kim Topley (O'Reilly & Associates, 2002; ISBN059600253X)
- Java 2 Micro Edition, James P. White and David A. Hemphill (Manning Publications, 2002; ISBN1930110332)
- Mobile Information Device Profile for Java 2 Micro Edition, C. Enrique Ortiz and Eric Giguere (John Wiley & Sons, 2002; ISBN0471034657)
- Wireless J2ME Platform Programming, Vartan Piroumian (Prentice Hall Computer Books, 2002; ISBN0130449148)
- Read more JavaWorld articles by Michael Yuan:
- "Java Readies Itself for Wireless Web Services," with Ju Long (June 2002)
- "Track Wireless Sessions with J2ME/MIDP," with Ju Long (April 2002)
- "Build Database-Powered Mobile Applications on the Java Platform," with Ju Long (January 2002)
- For more information on J2ME (Sun Microsystems, 2002)
- For more information on MIDP (Sun Microsystems, 2002)
- Browse JavaWorld's Book Reviews index page
- Browse the Java 2 Platform, Micro Edition section of JavaWorld's Topical Index
- Chat about devices galore in JavaWorld's Device Programming discussion
- Sign up for JavaWorld's free weekly Micro Java email newsletter
- You'll find a wealth of IT-related articles from our sister publications at IDG.net