Java and the new Internet programming paradigm

An excerpt from Rise & Resurrection of the American Programmer

One of the most significant technological developments since the publication of Decline and Fall of the American Programmer has been the introduction of a new breed of languages and development tools for creating applications on the Internet and the World Wide Web. The "information superhighway" is the hottest thing in the computing industry today, but when the Internet and the Web first burst on the scene a couple years ago, they seemed completely divorced from the traditional application development community in IT organizations. Many of the frantic discussions of security and firewalls that take place even today make it evident that many IT managers would like to keep it this way.

[Image - cover of book]

In the spring of 1994, with Sun Microsystems' formal announcement of the Java programming language, it became apparent that this comfortable view of the Internet/Web as a phenomenon distinct from traditional application development was about to change dramatically. Internet aficionados were and still are excited by Java's ability to bring live content to the user's workstation. But for traditional programmers, there are far more profound consequences: Just when programmers were getting used to client-server technology and languages like PowerBuilder, Visual Basic, and Delphi, the Java phenomenon promised to change the nature of application development completely. While technical concepts like object-orientation will continue to play an important role in tomorrow's Web-based applications, just about everything else is going to change in this new world. For example, programmers are likely to spend their time building tiny applets rather than large, monolithic applications -- and the marketplace could end up paying for these applets on a "per usage" basis, rather than on the licensing basis so prevalent today. If you're going to ride this new technology wave, you're going to need to change a lot of your assumptions and plans about the tools you'll be using, the development processes you'll be following, and the professional skills of the people in your organization.

I believe that Java represents an enormous opportunity for the North American software industry. As with all of the other technologies discussed in my book, there are no guarantees and no monopolies -- that is particularly true of technology associated with the Internet. Java-related development is going on all around the world, but the concentration of activity is much higher in the U.S. than elsewhere. We may only have a head start of two to three years, but that should be enough to capture a great deal of the market share before the software industries of Western Europe, Asia, and the developing nations begin making serious efforts to catch up.

What is Java all about?

In a nutshell, Java is an object-oriented programming language based on C++ that allows small programs -- or "applets" -- to be embedded within an HTML document. When the user clicks on the appropriate part of the HTML page to retrieve it from a Web server, the applet is downloaded into the client workstation environment, where it begins executing. [Editor's note: Since this text was written, the definition of Java has expanded beyond Web-based applets; Sun expects the language to be used for all sorts of applications, and promises a Java operating system, Java microprocessors, and more -- and now refers to Java as a platform.]

Java's origins go back to 1991, when Sun Microsystems began looking for ways to create platform-independent code to support consumer electronic products. After some initial efforts with C++, the Sun project team abandoned it and created its own language initially called Oak, later renamed Java. Oak first was used to create software for a personal, hand-held remote control device, but when the project team lost a bid to develop a television set-top box for Time-Warner, attention switched to the Web. The Sun project team then built a Web browser, originally called WebRunner and then renamed HotJava, in the Java programming language. The rest, as they say, is history: Sun formally announced Java and HotJava at the SunWorld '95 conference in San Francisco on May 23, 1995.

The relationship among Java programs (or "applets"), the Java-enabled browser, and the Web is illustrated in Figure 1. Users access a Web page and pull it down to their client. In this case, though, the Web page contains an additional HTML tag called "APP," which refers to a Java applet, and that applet can be located anywhere on the Web. If the user's Web browser is Java-enabled (for example, Sun's HotJava browser or Netscape's Navigator 2.0), then the applet is pulled down into the user's client computer and executed within the browser environment.

Figure 1. Relationship between Java applets, Java-enabled browser, the user, and the Web

Java is often described as a "cross-platform" programming language; it's also common to refer to Java programs as "architecture-neutral bytecodes." It has to be this way, of course, because the Web server that delivers the Java applet to the Web client doesn't know what kind of hardware/software environment it's running on. And the developer who creates the Java applet doesn't want to worry about whether it will work correctly on OS/2, Windows, Unix, and MacOS.

The key to Java, as used on the Web, is the notion of executable content, rather than static content. What capability does this provide us? Thus far, most of the demonstrations and examples have involved fairly simple graphics -- a bouncing ball on a Web page, for example. But there are some other examples you can look at, if you have a Java-enabled browser, of course:

  • The Rolling Stones' Web site ( contains animated flags and a puzzle that allows the user to slide squares around to form the "tongue" logo.

  • The NandO Times Web-based news service ( displays a ticker tape of headlines about sports, politics, national news, and world news that scrolls continuously across its primary page. Each of the four categories of news stories is illustrated with a picture; the pictures change in synchronization with the news stories in the ticker tape, thus providing an interesting amalgamation of the best of TV and newspapers.

  • ESPNET SportsZone ( an up-to-date scoreboard of football, baseball, and basketball scores.

  • HotWired ( uses Java to animate its Web pages for the digital version of Wired magazine.

  • Dimension X ( has been working on Iced Java, a 3-D rendering engine.

  • VPRO (http://www.vpro.n1), a public broadcasting organization from Hilvershum, Holland, uses Java to provide an automated, hands-off tour of its Web site.

  • Sun Microsystems ( has a number of Java examples and demos as well. This Web page links to several other important resources about Java; see the references below for details.

The Java environment

The full Java Development Kit contains the following components:

  • The Java compiler, javac, which translates human-readable Java source code to architecture-neutral bytecodes.

  • The Java interpreter, which executes Java programs on the user's PC or workstation.

  • The C header and source file generator, javah and java_g. These are used to generate header files for C, as well as source files for making "methods" (roughly equivalent to procedures or subroutines in other languages) within Java.

  • The Java disassembler, javap, which prints out information about a class file (a file containing a Java applet).

  • The document generator, javadoc, which is capable of generating an HTML file from a Java source-code file.

  • The profiling tool, javaprof, which formats the performance data created if the programmer uses the -prof option in the Java interpreter to obtain statistics on run time and performance.

Simplicity and familiarity

By basing the language on C++, Sun obviously hoped to take advantage of a large installed base of experienced C++ programmers; in so doing, they were able to make use of important features of object orientation, which Microsoft will find far more difficult to do if it continues using Visual Basic as the foundation of its Internet programming technology. (Visual Basic supports the concept of encapsulation, for example, but does not support inheritance or polymorphism.)

Further, as we'll see in the more detailed discussion of the Java language below, Sun has removed several of the more esoteric and troublesome features of C++, such as multiple inheritance and pointer arithmetic. The primary reason for doing this was to ensure robust behavior, but it has also resulted in the creation of a language that's easier to learn and understand. And in the tradition of C++ and other object-oriented languages, Java gives access to existing libraries of tested objects that provide functionality ranging from basic data types to network interfaces and GUI toolkits.

Though experienced programmers may find Java easy to learn, neophytes and users probably won't have the same experience. As Andrew Leonard points out in a recent issue of Web Review:

A more critical question is what effect Java-esque technologies are having on the average individual's ability to use the Net/Web creatively. The online universe is becoming more complex. Is it leaving us behind? Forget about The Future of the Net. Time to switch memes. What about The End of the Net as We Know It? Once upon a time, the World Wide Web was a truly democratic medium. Learning enough HTML to put up a Web page took an afternoon. Anybody could become publisher of their own Webzine. As a petri dish for Do-It-Yourself cultures, the Web offered astonishing potential. That was then. Try learning to write a Java applet in an afternoon. Unless you're already an accomplished programmer, the kind of person who spits out Perl scripts like sunflower seed shells or reads C++ manuals as if they were comic books, you might find yourself moving a bit slowly. And it's not just Java. Creating a 3-D VRML world isn't trivial either. Just mastering all the possibilities of a new version of Netscape before the next upgrade rolls along is an exhausting challenge. And so on. The Web is stratifying. A priesthood of technonerds -- a Webmaster aristocracy pulling down high salaries and wielding great power -- is emerging.

The solution, I believe, will eventually involve two "levels" of Java language: the professional level and a "light" level for users who need to create simple, one-line applets to control the behavior of their HTML pages. Netscape has already taken the initiative, with the scripting language built into Navigator 2.0. And in December 1995, Netscape and Sun announced a joint effort to continue this work in the form of a scripting language called JavaScript.

Security and robust behavior

Security and robustness are obviously important in the distributed environment represented by the Internet; if you download a Java applet from a Web server, for example, you really don't want it to run amok on your computer and delete all the files on your hard disk. This is not as far-fetched as it might sound, because the incorporation of Java applets into Web pages means that you may be invoking computer programs written by people anywhere in the world, located anywhere on the Web. Indeed, once you begin using a Java-enabled browser, you're automatically at risk since you don't know at the moment you decide to retrieve a Web page (say, by clicking on a hyperlink within an existing page being displayed on your computer) whether it will contain embedded Java applets.

Sun has addressed this concern by imposing severe constraints on the Java programming language, as well as extensive run-time checking in the interpreter located inside the Java-enabled browser. The Java language, for example, forbids the use of address pointers and pointer arithmetic found in C and C++; this eliminates a large class of innocent errors that might otherwise plague the user of Java applets. In addition, the following steps have been taken to increase the level of security and robust behavior:

1 2 3 4 5 Page 1
Page 1 of 5