Brewing Java in Japan
Senior Editor Steven Myers, our office "Java genius," explores the progress of Java in Japan from the perspective of Japanese programmers and engineers, and presents a practical case-study look at the process of using Java and object-oriented design methods to create a real-life, interactive kanji-study applet.
By Steven Myers
Java, which burst onto the internet scene in late 1995, is perhaps the only programming language to have been accorded instant celebrity status by both major computer publications and the popular mass media. While mainstream press excitement over Java has been greatly overdone, there is nonetheless much truth to the Sun (and Nihon Sun) marketing hype.
Japan takes to Java
The Japanese computer industry was quick to pick up on the Java phenomenon. Fujitsu was among the first companies to license the language from Sun, and several of the early applets on the hugely popular Gamelan repository of Java resources (http://www.gamelan.com) were submitted by Japanese programmers. Among the Japanese companies that have embraced Java are Ricoh, which has implemented a unique and intriguing applet for demonstrating its Japanese fonts, and Softbank, which has built some creative Java applets to present a dynamic online manga series by Takeichi Terazawa.
Java enthusiasts throughout Japan have done a tremendous job of translating and disseminating the publicly available API documentation and online tutorials. There is also an active fj.comp.lang.java newsgroup, as well as a vast amount of Japanese-language Java information related to Java programming on the Java House mailing list.
Java's immense popularity in Japan is all-the-more impressive since there is as yet no Japanese version of the language. It is possible to display kanji strings in non-GUI applications on Unicode-based operating systems, such as Windows NT, but there is currently no way to place multiple-byte Japanese characters in graphical applications and applets. (Except in the title bar and pull-down menus -- those strings are handled by the native window system.)
In its present form, the Java AWT (Alternative Window Toolkit), which handles the GUI components, supports just five fonts: Helvetica, Times Roman, Courier, Dialog, and Symbol. While the Sun marketing department has been making much of Java's support for developing "international software applications" through the use of Unicode, the present reality is that Unicode is of little help if there is no font support to go with it. (Some Japanese computer publications have reported that a fully Japanese-capable version of Java will be released by the end of September, but as of late July, Sun has made no official announcement.)
Japanese-language workarounds
In the meantime, what is being done about getting kanji characters to display properly within an applet or simple application? Even without full Japanese text-processing support, there should be some way to scroll short kanji strings across the top of a Web page.
As it turns out, several solutions have been described and demonstrated on the Java House page. Some involve the use of scrollable LED panels that allow manual creation and editing of characters and strings, while others (such as the Ricoh applet) require a knowledge of the mathematics behind outline fonts. A few adventurous souls have gone so far as to manually edit the five supported font files on their systems, replacing the roman characters with their own kanji renderings.
By far, the most common work-around -- or hack, depending upon your perspective -- is simply to create a two-color GIF image of each character or string. (This is the method used for our sample kanji-learning game, introduced in the "Case study" sidebar.) The image files take a little time to create, but the procedure is not difficult, and the small size of the files allows them to load quickly over the network. This method may not be a viable solution for serious text-processing applications, but it is sufficient for animated graphical displays and educational applications.
The straight scoop on Java and OOP
Let's look more closely at the technical merits of both the Java language and the object-oriented design process in general. Perhaps because most of the early demonstrations of Java were animation-type applets used to liven up theretofore static Web pages, many Net users came to view Java as little more than an extension to HTML, one used for creating fun and flashy presentations. Yet, even as these decorative applets received more and more attention, Sun was proclaiming that Java (with its cross-platform features) would do nothing less than revolutionize computing and the Internet. Java, according to Sun, would become the universal glue connecting users and information, thereby negating much of the influence wielded by Microsoft with its massive OS (operating system) market share.
Naturally, Microsoft rushed to quell much of the early hype by pointing out that Java was merely a programming language -- but then came back a few weeks later to announce that it would license the language from Sun. Since that time, programmers and industry pundits alike have debated Java's advantages and disadvantages, while the Java craze continues unabated.
Just how much of the Java hype is true, and what does Java have to offer that other programming languages don't? One obvious merit of Java is its platform independence: because the same Java program can be run on Windows 95, MacOS, Solaris, UNIX, and so on, developers no longer have to focus on a specific platform when they design and build their applications. Also, from the perspective of programmers with experience in object-oriented design, Java is a much simpler language to learn and use than C++. (There are no pointers, and thus none of the pointer arithmetic problems that have long plagued C++ programmers. Nor do Java developers have to worry about memory allocation and deallocation.) Finally, Java has an extensive library of powerful network-related routines that make it much easier to perform such tasks as opening a socket or communicating with a Web server.
On the downside, Java still has a rather primitive development environment, and it lacks the powerful graphics toolkits and extensive class libraries of other object-oriented languages. For the time being, anyway, Windows applications developed in Java will not look as attractive as those written in Visual Basic or Visual C++ (and the huge Microsoft Foundation Class library). Also, while the similarity in syntax between Java and C++ undoubtedly makes the transition somewhat easier for C++ developers, many programmers feel that Java retains too many of the "stupid" features of C++ that should have been eliminated.
A common misconception about Java is that it is an easy language to learn. Certainly it is not difficult for experienced C++ or Smalltalk programmers, but those coming to Java with no prior background in object-oriented development will find the learning curve long and steep. The object-oriented paradigm (OOP) requires a fundamentally different way of looking at program design. Newcomers to Java are usually surprised at the ease with which they can create and configure animation applets, but quickly become frustrated when they try to progress beyond that point to develop more useful applications.
Why, exactly, has object-oriented design become so important to software engineering? Whereas the traditional structured programming model focuses on functions and procedures, object-oriented methodology places emphasis on the data (represented as objects) and ways in which data items interact. Rather than worrying about particular sets of tools and algorithms, the object-oriented developer focuses attention almost entirely on the desired end result.
The main benefit of thinking in terms of objects and methods is that developers can usually turn to extensive class libraries for much of the development code. Just as a PC vendor can buy prepackaged components like power supplies and hard disk drives to build a computer without worrying about the design details of each component, so an object-oriented software developer can shop for particular "classes" without having to know anything about how the methods of each class are implemented.
In short, the object-oriented model of programming used by Java provides a level of abstraction that makes it easy to find bugs and respond to changes, one which more closely resembles real-world entities and interactions. Over the past two decades, object-oriented languages like Java have proven their value in the development of flexible and robust applications.
Applets for the future
The sidebar to this article (see "Case study: An interactive game for teaching kanji combinations" on page 22) presents a basic outline for the process of creating an interactive kanji-related Java application using current development toolkits. Although developing non-trivial Java applets that do more than simply decorate a Web page is still a relatively involved and sometimes tedious process, the experience and excitement of building something useful and making it work can well be worth the effort involved.
While it hasn't yet lived up to all of its hype, the Java programming language has definitely opened up a whole new world of opportunity on the Internet for imaginative software developers. In particular, expect to see all kinds of interactive games (such as trivia, crossword, and lottery games that are relatively static and do not require powerful hardware) as well as a wide range of study courses and educational applets appear on the Web within the next year.
Here at Computing Japan, we'll be watching for the release of the Japanese-enabled JDK; look for a full report on the beta version in a future issue. In the meantime, though, if you have a great idea for making your own educational or entertaining applet, don't wait; get it up on the Web and let the world know about it! Let our webmaster (cjmaster@cjmag.co.jp) know about it, too; if we think your applet would interest our readers, we'll showcase it on the Computing Japan Web site.ç
The Java House Web site at http://www.center.nitech.ac.jp/ml/java-house is full of (Japanese-language) tips, tricks, and fascinating demos, and contains threaded archives of mailing list discussions dating back to December 1995 as well as a complete translation of the Java FAQ (plus much additional Japan-specific information). When Sun (or Microsoft, which recently announced the arrival of its Visual J++ beta Java kit) finally releases a Japanese-capable Java compiler, this site will be the one to watch for bug reports and workaround solutions.
Java is still very much in the formative stages. Developers (especially bilingual developers) should expect to deal with a fair amount of hacking and patching in both Sun's Java Developer's Kit and Microsoft's VJ++ (beta) development package.
|