Let the mobile games begin, Part 2
J2ME and .Net Compact Framework in action
By Michael Juntao Yuan, JavaWorld.com, 05/16/03
In Part 1 of this series, I overviewed the two leading platforms for smart device development: Java 2 Platform, Micro Edition
(J2ME) and .Net Compact Framework. The two platforms' ultimate goals are the same: to enable rich clients for users and to
improve developer productivity. Both platforms offer similar benefits:
- Well-designed programming languages for development (Java for J2ME, and C#/Visual Basic .Net (VB.Net) for .Net Compact Framework): Compared with older device development languages such as C/C++ and eVB (eMbedded Visual Basic), these new languages are easy
to learn and have a large pool of qualified developers.
- Managed runtime environments: Applications for both platforms run inside virtual machines that manage security, memory usage, and runtime optimization.
Managed memory access improves developers' productivity by freeing them from the error-prone chore of memory management.
- Rich libraries and components: Object-oriented programming languages like Java, C#, and VB.Net allow developers to reuse software modules. Both platforms
come with a rich set of libraries for advanced UI (user interface), network connectivity, data management, and XML Web services.
Libraries for accessing common device extensions (e.g., the GPS (global positioning system) or scanner module) are also available.
- Familiar APIs from standard frameworks: J2ME and .Net Compact Framework allow desktop developers to migrate their skills to mobile development. For example, the
Java AWT (Abstract Window Toolkit) UI can be directly used in certain J2ME profiles, and the Windows Forms controls can be
used in Compact Framework applications. The IBM Service Management Framework (an OSGi (Open Services Gateway Initiative) implementation)
even brings common J2EE (Java 2 Platform, Enterprise Edition) APIs and patterns to devices.
- Extensive development tools: More than a dozen generic IDEs, development toolkits, and command-line tools are available from leading vendors in the J2ME
space. Microsoft's flagship development tool, Visual Studio .Net, is also fully integrated with Compact Framework.
Despite those similarities, the differences between the two platforms are profound. In a nutshell, J2ME is a specification
shaped by industry consensus, while .Net Compact Framework is a polished and fast-paced implementation driven by a single
powerful vendor. Below, I describe the two platforms' hardware support:
- J2ME runs on a range of devices from smart phones to set-top boxes from all major vendors, while .Net Compact Framework runs
only on devices from Microsoft Pocket PC licensees.
- Since Microsoft has control over Pocket PC hardware vendors, .Net Compact Framework developers have a specific hardware specification
to program against (e.g., screen size) and can assume the availability of certain native software (e.g., Windows Media Player).
- J2ME is also moving toward reducing the device market fragmentation via specifications like Java Specification Request (JSR)
185 (Java Technology for the Wireless Industry), which specifies the minimum hardware requirement for certain J2ME profiles.
Due to the requirements of uniform and powerful mobile devices, .Net Compact Framework is suitable for cash rich customers
with controlled mobile environments. It was initially focused on the enterprise mobile market, especially for Microsoft-centric
IT shops, while J2ME was originally active in the consumer sector. However, in the long run, most experts expect both platforms
to coexist in all market sectors. As developers, we must choose the right tools and make them all work in heterogeneous environments.
For example, we need to make J2ME clients work with .Net backend servers and vice versa. In this article, I walk through an
end-to-end mobile GIS (geographic information system) application that mixes Java and .Net on client, server, and middleware
layers. However, before we can dive into the sample application's technical aspects, we need to step back and look at the
business aspects critical to our architecture design.