The application demonstrated in this chapter, TextTool, is divided into two tiers: the user interface (or UI) and the back-end. It is a Flash- and Java-based text editor, which allows a user to write, save, load, and delete simple text files on any device that supports Flash 5, Java 1.1.8 or higher, and TCP/IP socket connections. Although TextTool is almost completely platform independent, I have chosen to demonstrate the application on a Compaq iPAQ H3630 running Microsoft Pocket PC.
Why Use Flash for TextTool?
Although Java generally provides a comprehensive set of interface design tools with the Swing Java extension, the versions of Java that we are confined to on the Pocket PC platform limit us to the decidedly less functional Advanced Windowing Toolkit (AWT). Even if we were to have Swing at our disposal, however, it would be hard to imagine any interface programmatically built in Java measuring up to the rich, dynamic, interactive creations that are possible with Flash. Additionally, interface designers are rarely programmers (and in my experience, hard-core programmers are rarely designers of intuitive, interesting user interfaces), so implementing the UI in Flash allows us the most effective allocation of expertise.
Why Also Use Java?
Unfortunately, Flash only gets us so far. Through the UI, users can enter and edit text, click (or in this case, tap) buttons, and manipulate dialogue boxes; however, when it comes time to do the actual work of saving, loading, or deleting a file, Flash has no choice but to defer to a backend capable of file IO (input/output). Although I could have used any language capable of accepting socket connections, I chose to implement the back-end in Java primarily because of its platform-independent nature, general ease of use, wide ranging support, and exploding popularity. Because both Java and Flash are platform-independent, I was able to do the majority of my development and testing on my PC without having to install any special emulators. Additionally, the fact that Java is executed in its own virtual machine meant that I could concentrate on application logic rather than such platform-specific details as memory allocation and de-allocation. And finally, because of Java's relative simplicity and accessibility, it currently enjoys the largest developer community of any other programming language in its class, which means it's going to be around for a long time.