Chapter 18 -- Development and Language Environments
Chapter 18
Development and Language Environments
CONTENTS
An Overview of Development Environments
Cyberleaf
WebFORCE
Extending the Web Through New Languages
Inferno and Limbo
Virtual Reality Modeling Language (VRML)
Broadway
Environments and Languages Check
The converters and editors described in the preceding chapter
can be a boon for developers who want to quickly translate documents
in other formats to HTML or to create and edit HTML files. These
filters and editors are at the file or package level of granularity
in web development (see Chapter 7, "Web
Design" and Chapter 11, "Design
and Implementation Style and Techniques"). As described in
Part II, "Web-Development Processes," web development
involves many considerations other than just creating individual
HTML files. Web development involves larger processes of planning,
analysis, design, promotion, and innovation at the web and systems
level. Tools are available that take a piecemeal approach to these
processes, with mostly a focus on web implementation. This chapter
focuses on some of these higher-level development tools and environments.
Because web development also has been expanded by languages specifically
designed for network communication, this chapter gives you an
overview of the role of two of these languages, Java and Limbo,
as well as the Broadway project.
An
Overview of Development Environments
Software systems that integrate several tools to provide more
comprehensive support for web developers are being introduced.
These environments offer steps toward more integrated support
environments for web development and information delivery. Although
still very much oriented toward the technical construction of
HTML rather than the content-development processes, these systems
might be the first steps toward even more sophisticated help for
the web developer.
Ideally, a development environment seamlessly integrates a set
of powerful, flexible tools. For software developers, the UNIX
operating system is a good example of a very flexible and powerful
environment for software development. A skilled programmer using
UNIX can create more tools and build applications using them.
This "tool to build a tool" capability is key to large-scale,
high-level development. Environments are not easy to create, however.
Software engineers have tried to create Computer-Aided Software
Engineering (CASE) tools for years, with only moderate success.
Although developing information for the Web is in some ways analogous
to creating software, web development is not software development.
Web development may involve programming (gateway programming,
as discussed in Part IV) as well as programming-like activities
such as creating HTML files, checking HTML syntax, and managing
computer files on networked computer systems. The first generation
of web development environments, however, mainly addresses these
file-management tasks.
Cyberleaf
Cyberleaf from Interleaf, Inc. (http://www.ileaf.com/ip.html)
is a software system for web development that approaches the document-production
process of web development-specifically, the needs for large-scale
document production. Cyberleaf is not an HTML editor; it uses
word processors as the basis for creating information. Cyberleaf
converts documents from many standard word processing formats
to others and uses a filtering system that includes file management
and style conversion.
Cyberleaf is offered on many platforms, including Digital Equipment,
Hewlett-Packard, IBM, and Sun. Cyberleaf works with text, graphics,
and tables from standard word processors such as Word RTF (rich
text format), WordPerfect, Interleaf, and FrameMaker and can convert
these files to HTML with GIF illustrations. The conversion is
done using a system of style matching that takes into account
GIF picture size. Cyberleaf can perform multiple document conversions
in batch processing. Figure 18.1 shows a sample screen of Cyberleaf
showing the checks available at each stage in this conversion
process.
Figure 18.1 : A Cyberleaf software sample screen (courtesy of Interleaf, Inc.).
Cyberleaf's system takes a web-level approach to managing information,
not just page-level conversion and formatting. After updating
source documents, styles, or parameters, an entire web can be
regenerated. This allows for incremental changes as well as web-wide
changes in style or links. This generation process also identifies
broken links and file system changes using relative path names.
Cyberleaf's particular strengths are its openness (it requires
only standard word processors as the authoring interface), its
sophistication of style conversion, and functions for life-cycle
file management. Although not a total integration of all web-development
processes, Interleaf's Cyberleaf is a step toward a more integrated
approach.
WebFORCE
Integration is also the theme of Silicon Graphics, Inc.'s commercial
product called WebFORCE (http://www.sgi.com/Products/WebFORCE/).
WebFORCE's tagline is "to author and to serve,"-an appropriate
motto because the software approaches both the development "authoring"
as well as the dissemination "serving" sides of web
development on both the Internet and on intranets.
WebFORCE for authoring provides developers with WebMagic-a graphical
user interface for hypermedia development. Bundled with WebMagic
are professional-grade tools for multimedia, image, and illustration,
such as Adobe Photoshop and Illustrator.
WebMagic is intended to be a WYSIWYG interface for HTML document
creation. Integrated with Indigo Magic, a user environment for
graphical development; the Digital Media Tools Suite for multimedia
development; and the InPerson software for group communication;
the WebFORCE tools for authoring approach many tasks. Figure 18.2
shows the Indigo Magic user environment, illustrating
(1) The teleconferencing options using InPerson
(2) Audio and video
(3) Shared whiteboard
(4) Shared files
(5) through (14) The multimedia tools for movies,
work spaces called desks, digital video recording and teleconferencing,
movie player, sound editor, video capture, sound filter, and image
editor.
Figure 18.2 : A sample work space from Indigo Magic user environment (courtesy of Silicon Graphics, Inc.).
WebFORCE's integration of hypermedia plus teleconferencing provides
a very broad range of not just the technical requirements for
creating webs, but support for the computer-mediated communication
and cooperative work involved. WebFORCE is certainly a much higher-end
product than those discussed so far, but it offers comprehensive
support for multimedia development. Combined with Silicon Graphic's
offering of WebSpace, the first commercial 3-D viewer for the
Web (http://webspace.sgi.com/),
this integration is poised also for the future.
Extending
the Web Through New Languages
In addition to emerging software environments, Web developers
have the prospect of using new languages that will work with Web
software. These languages make it possible to deliver innovative
content in new formats. Virtual Reality Modeling Language
(VRML), which offers the beginnings of three-dimensional representation
integrated with Web information, is discussed in more detail in
Chapter 28, "Virtual Reality Modeling
Language." Java, a language for providing distributed executable
applications, also extends the kinds of information the Web can
deliver.
Although creating tools to build tools is the next step in sophistication
for web development, new technologies have rapidly been introduced
that offer still more methods of expression. This book traces
how HTML and its new levels give rich possibilities for hypertext
and hypermedia expression. New kinds of expressions that enliven
the visual and interactive possibilities for the Web, however,
have emerged: Java, a language for creating distributed applications,
and VRML, a language for three-dimensional representation on the
Web.
Java
Although the Web's system of hypertext and hypermedia gives users
a high degree of selectivity over the information they choose
to view, their level of interactivity with that information is
typically low. Java, a computer programming language developed
by Sun Microsystems, brings this missing interactivity to the
Web. With a Java-enabled Web browser, you can encounter animations
and interactive applications. Java programmers can make customized
media formats and information protocols that can be displayed
in any Java-enabled browser. Java's features enrich the communication,
information, and interaction on the Web by enabling users to distribute
executable content-rather than just HTML pages and multimedia
files-to Web users. This capability to distribute executable content
is the power of Java. Java's origins are in Sun Microsystems'
work to create a programming language to create software that
can run on many different kinds of devices. Today, Java is a language
for distributing executable content through the Web.
A Selection of Sample Java Applications
What Java makes possible for developers and users is impossible
to show in a paper book: animated applications that can be downloaded
across the network and operate on multiple platforms on heterogeneous,
distributed networks.
By giving the browser the capability to download and run executables,
developers can create information in many new formats without
having to worry about which helper application a user has installed.
Instead of requiring helper applications for multimedia display,
a smart browser has the capability to learn how to deal with new
protocols and data formats dynamically. Information developers
therefore can serve data with proprietary protocols because the
browser, in essence, can be instructed on how to deal with them.
Figure 18.3 shows an example of the kind of animation application
that is possible with Java. In the figure, the little black-and-white
character is Duke, the mascot of Java. Duke tumbles across a Web
page displayed in the browser, cycling through a set of graphics
images that loop while the user has this page loaded.
Figure 18.3 : Tumbling Duke, mascot of Java (courtesy of Arhur van Hoff, formerly of Sun Microsystems).
Animation isn't limited to cartoon figures, however. Pages can
have animated logos or text that moves or shimmers across the
screen. Java animations also do not need to be just decorative,
pre-generated figures; instead, they can be graphics generated
based on computation. Figure 18.4 shows a bar chart applet.
Figure 18.4 : A bar charts applet (courtesy of Sun Microsystems).
Although the animations shown can be static images that are drawn
or generated, or animated images that can behave according to
a preset algorithm (such as the tumbling Duke in Fig. 18.3), animation
also can be made interactive, where the user has some input on
its appearance. Figure 18.5 shows a 3-D rendering of chemical
models. Using the mouse, you can spin these models and view them
from many angles. Unlike the source code for the graph applet
shown in Figure 18.4, of course, the source code for the chemical
modeling is more complicated. To the user, however, the chemical
models seem 3-D, giving an insight into the nature of the atomic
structure of these elements like no book could.
Figure 18.5 : Three-dimensional, manipulable chemical models (courtesy of Sun Microsystes).
The chemical models in Figure 18.5 respond to user clicks of the
mouse. Another variation on this animation involves giving the
user a way to interact with an interface in order to get feedback.
The impressionist drawing canvas in Figure 18.6 is an excellent
example of this. Paul Haeberli at Silicon graphics developed an
impressionist Java applet at http://reality.sgi.com/grafica/impression/imppaint.html.
He originally developed this technique for creating these kinds
of graphics in 1988 for a Silicon Graphics IRIS workstation. Later
patented, this technique drives his Java applet. The result is
that you can draw using various-size brushes on a canvas and reveal
one of several pictures.
Figure 18.6 : An interactive, impressionist drawing (courtesy of Paul Haeberli at Silicon Graphics).
Another variation on interactivity is real-time interactivity.
Figure 18.7 shows an interactive application that involves moving
graphics that the user manipulates. This is the game of Tetris,
in which you try to line up the falling tile shapes to completely
fill the rectangle. Using designated keys for playing, you interact
with the interface to steer the falling shapes. This Tetris implementation
demonstrates the possibilities for arcade-like games using Java
technology.
Figure 18.7 : Tetris (courtesy of Nathan Williams).
The chemical model, impressionist canvas, and Tetris game demonstrate
how interactivity and animation can work together. These applets
customized their animated output based on user input, so they
actually were performing computation. An example that shows this
computational capability in more concrete terms is in Figure 18.8-a
simple spreadsheet.
Figure 18.8 : A simple spreadsheet (courtesy of Sami Shain, Sun Microsystems).
This spreadsheet demonstrates the computational possibilities
of Java. The spreadsheet shown allows you to change the contents
of any of the 24 cells (A1 through D6) by replacing its label,
value, or formula. This is just like a real spreadsheet, which
is more of an environment in which the user can work than a fixed
game. This capability to create an environment for computation
is a profound one; using Java, a user can obtain an entire environment
for open-ended interaction rather than a fixed set of options
for interaction-opening up the Web page into a Web stage.
Java also can be used to support mass communication in new ways.
The Nando Times is a Web-based news service that has been
very innovative in news delivery on the Web. Using Java, this
news agency now provides a tickertape of headlines across its
front page. The text under the Nando
banner in Figure 18.9 scrolls continuously to show the world,
national, sports, and political top stories at the moment. The
four pictures below the labels for these categories also change,
giving a slide show that is very effective in displaying new information
without requiring the user to select it for viewing. This transforms
the Web into something that people can watch to get new information.
Figure 18.9 : Headline feed on The Nando Times (courtesy of The Nando Times).
Java Applets On-Line
Check out Gamelan, the Java directory on-line at http://www.gamelan.com, for a great collection of Java applets and information.
Java's Potential
The previous examples illustrate only some of the potential of
Java. A few of these examples are "toy" demonstrations
meant to show the possibilities of Java. What kind of communication
might Java foster? The Nando Times example shows an innovative
application for providing information in a way that allows you
to sit back and observe rather than select hypertext links.
Java opens up a new degree of interactivity and customizability
of interaction for the Web. Earlier web-development techniques
of creating pages and linking them together still are necessary
in a Java-flavored Web. Java creates possibilities for richer
kinds of content to be developed, however. The user can interact
with and change the appearance of a Web page along with the state
of a database using a Java-enabled browser. Java profoundly changes
the texture of the Web in the following ways:
Java creates places to stop on the paths of the Web. A
well-done Java application on a single hypertext page can engage
a user for a long time. Instead of just offering text, sound,
images, or videos to observe, a Java page can offer a place to
play, learn, or communicate and interact with others in a way
that isn't necessarily based on going somewhere else on the Web
through hyperlinks. If the hypertext links of the Web are like
paths, the Java pages are like the towns, villages, and cities
to stop on these paths and do something other than just observe
or "surf."
Java increases the dynamism and competitiveness of the Web. Just
as new browser technology prompted Web developers to create still
more applications and pages to exploit these features, so too
does Java technology promise a new round of content development
on the Web.
Java enriches the interactivity of the Web. Java's
interactivity is far richer, more immediate, and more transparent
than the interactivity possible through gateway programming. Gateway
programming still should have a role in Web applications, just
as page design and multimedia presentation still will play a role.
Java's inter-activity brings new possibilities to what can happen
on the Web, however. With Java, transactions on the Web can be
more customized, with immediate, continuous, and ongoing feedback
to the user.
Java transforms the Web into a software delivery system. Java's
essential design as a language to deliver executable content makes
it possible for programmers to create software of any kind and
deliver it to users of Java-enabled browsers. Instead of focusing
on the interface, the Java programmer focuses on the interaction
desired and lets the built-in features of the graphics take care
of the rest of the implementation. The result is that very simple
programs like the drawing and spreadsheet applications can be
created quickly and distributed worldwide.
The true potential of Java to transform the Web is still in its
initial stages. New potential applications for commerce, information
delivery, and user interaction still await the imagination and
skill of future Java developers.
Java's Technical Model for Distributable, Executable Content
Executable content is a general term that characterizes
the important difference between the content that a Java-enabled
Web browser downloads and the content a non-Java-enabled browser
can download. Simply put, in a non-Java Web browser, the downloaded
content is defined in terms of Multipurpose Internet Mail Extension
(MIME) specifications, which include a variety of multimedia document
formats. This content, after downloaded by the user's browser,
is displayed in the browser. The browser may employ a helper
application (such as in displaying images, sound, and video).
The overall pattern for the use of this content is user choice,
browser download, and browser display.
A Java-enabled browser also follows this pattern, but adds another
crucial step. First, the Java-enabled browser, following requests
by the user, downloads content defined by MIME specifications
and displays it. However, a Java-enabled browser recognizes a
special hypertext tag called APPLET.
When downloading a Web page containing an APPLET
tag, the Java-enabled browser knows that a special kind of Java
program called an applet is associated with that Web page.
The browser then downloads another file of information, as named
in an attribute of the APPLET
tag, that describes the execution of that applet. This file of
information is written in what are called bytecodes. The
Java-enabled browser interprets these bytecodes and runs them
as an executable program on the user's host. The resulting execution
on the user's host then drives the animation, interaction, or
further communication. This execution of content on the user's
host is what sets Java content apart from the hypertext and other
multimedia content of the Web (see Fig. 18.10).
Figure 18.10 : Java's technical model.
The process of using executable content in a Java-enabled browser,
for users, is seamless. The downloading and start of the execution
of content happens automatically. Users do not have to specifically
request this content or start its execution. This executable content
is platform-independent; Java programmers do not
need to create separate versions of the applets for different
computer platforms, as long as the users have a Java interpreter
(or Java-enabled browser) installed on their computer.
So, when surfing the Web with a Java-enabled browser, you might
find not only all the hypertext content that the pre-Java age
Web offered, but also animated, executable, and distributed content.
Moreover, this executable content can include instructions for
handling new forms of media and new information protocols.
The Java Language
According to the information provided by Sun Microsystems (http://java.sun.com/),
Java is a "simple, object-oriented, distributed, interpreted,
robust, secure, architecture neutral, portable, high-performance,
multithreaded, and dynamic language."
This characterization identifies the key technical features of
Java, which are discussed in this section.
Simple
The developers of Java based it on the C++ programming language
but removed many of the language features that rarely are used
or often are used poorly. C++ is a language for object-oriented
programming and offers very powerful features. As is the case
with many languages designed to have power, however, some features
often cause problems. Programmers can create code that contains
errors in logic or is incomprehensible to other programmers trying
to read it. Because most of the cost of software engineering often
is code maintenance rather than code creation, this shift to understandable
code rather than powerful but poorly understood code can help
reduce software costs. Specifically, Java differs from C++ (and
C) in these ways:
Java does not support the struct,
union, and pointer
data types.
Java does not support typedef
or #define.
Java differs in its handling of certain
operators and does not permit operator overloading.
Java does not support multiple inheritance.
Java handles command-line arguments differently
than C or C++.
Java has a String
class as part of the java.lang
package. This differs from the null-terminated array of characters
used in C and C++.
Java has an automatic system for allocating
and freeing memory (garbage collection), so it is unnecessary
to use memory allocation and deallocation functions as in C and
C++.
Object-Oriented
Like C++, Java can support an object-oriented approach to writing
software. Ideally, object-oriented design can permit the creation
of software components that can be reused.
Object-oriented programming is based on modeling the world in
terms of software components called objects. An object
consists of data and operations that can be performed on that
data called methods. These methods can encapsulate, or
protect, an object's data because programmers can create objects
in which the methods are the only way to change the state of the
data.
Another quality of object-orientation is inheritance. Objects
can use characteristics of other objects without having to reproduce
the functionality in those objects that supports those characteristics.
Inheritance therefore helps in software reuse, because programmers
can create methods just once that do a specific job.
Another benefit of inheritance is software organization and understandability.
By organizing objects according to classes, each object in a class
inherits characteristics from parent objects. This makes the job
of documenting, understanding, and benefiting from previous generations
of software easier, because the functionality of the software
grows incrementally as more objects are created. Objects at the
end of a long inheritance chain can be very specialized and powerful.
Figure 18.11 summarizes the general qualities of data encapsulation,
methods, and inheritance of an object-oriented language.
Figure 18.11 : Object-oriented systems.
Technically, Java's object-oriented features are those of C++
with extensions from Objective C for dynamic method resolution.
Distributed
Unlike the languages C++ and C, Java is designed specifically
to work within a networked environment. Java has a large library
of classes for communicating using the Internet's TCP/IP protocol
suite, including protocols such as HTTP and FTP. Java code can
manipulate resources via URLs as easily as programmers are used
to accessing a local file system using C or C++.
Interpreted
When the Java compiler translates a Java class source file to
bytecodes, this bytecode class file can be run on any machine
that runs a Java interpreter or Java-enabled browser. This allows
the Java code to be written independent of the users' platforms.
Interpretation also eliminates the compile and run cycle for the
client, because the bytecodes are not specific to a given machine
but are interpreted.
Robust
Robust software doesn't "break" easily because of programming
bugs or logic errors in it. A programming language that encourages
robust software often places more restrictions on programmers
when they are writing the source code. These restrictions include
those on data types and the use of pointers. The C programming
language is notoriously lax in its checking of compatible data
types during compilation and runtime. C++ was designed to be more
strongly typed than C; however, C++ retains some of C's approach
toward typing. In Java, typing is more rigorous; a programmer
cannot turn an arbitrary integer into a pointer by casting, for
example. Also, Java does not support pointer arithmetic but has
arrays instead. These simplifications eliminate some of the tricks
that C programmers could use to access arbitrary areas of memory.
In particular, Java does not allow programmers to overwrite memory
and corrupt other data through pointers. In contrast, C programmers
often can accidentally (or deliberately) overwrite or corrupt
data.
Secure
Because Java works in networked environments, the issue of security
is one that should be of concern to developers. Plans are in the
works for Java to use public-key encryption techniques to authenticate
data. In its present form, Java puts limits on pointers so that
developers cannot forge access to memory where not permitted.
These aspects of Java enable a more secure software environment.
"Java Security," later in this chapter, outlines the
layers of Java's security in more detail.
Architecture Neutral
The Java compiler creates bytecodes that are sent to the requesting
browser and interpreted on the browser's host machine, which has
the Java interpreter or a Java-enabled browser installed. With
this model, programmers can write code once and know that it will
run the same way on any hardware architecture with a ported interpreter.
Portable
The quality of being architecture neutral allows for a great deal
of portability. However, another aspect of portability is how
the hardware interprets arithmetic operations. In C and C++, source
code might run slightly differently on different hardware platforms
because of how these platforms implement arithmetic operations.
In Java, this method has been simplified. An integer type in Java,
int, is a signed, two's complement
32-bit integer. A real number, float,
is always a 32-bit, floating-point number defined by the IEEE
754 standard. These consistencies make it possible to have the
assurance that any result on one computer with Java can be replicated
on another.
High Performance
Although Java bytecodes are interpreted, the performance sometimes
isn't as fast as direct compilation and execution on a particular
hardware platform. Java compilation includes an option to translate
the bytecodes into machine code for a particular hardware platform.
This can provide the same efficiency as a traditional compile-and-load
process. According to Sun Microsystems testing, performance of
this bytecode-to-machine-code translation is "almost indistinguishable"
from direct compilation from C or C++ programs.
Multithreaded
Java is a language that can be used to create applications in
which several things happen at once. Based on a system of routines
that allow for multiple threads of events based on C.A.R. Hoare's
monitor-and-condition paradigm, Java presents the programmer with
a way to support real-time, interactive behavior in programs.
Dynamic
Unlike C++ code, which often requires complete recompilation if
a parent class is changed, Java uses a method of interfaces to
relieve this dependency. The result is that Java programs can
allow for new methods and instance variables in objects in a library
without affecting their dependent client objects.
HotJava Marked the Emergence of a New Kind of Web Browser
The HotJava browser that showcases Java marks the start of a new
generation of smart browsers for the Web. Not constrained to a
fixed set of functionality, the HotJava browser can adjust and
learn new protocols and formats dynamically. Developers of Web
information using Java no longer are constrained to the text,
graphics, and relatively low-quality multimedia of the fixed set
available for Web browsers in the pre-Java age. Instead, the HotJava
browser opens new possibilities for new protocols and new media
formats never before seen on the Web.
Through the past half-decade of development of the World Wide
Web, new browser technologies often have altered the common view
of what the Web and on-line communication could be. When the Mosaic
browser was released in 1993, it rocketed the Web to the attention
of the general public because of the graphical, seamless appearance
it gave to the Web. Instead of a disparate set of tools to access
a variety of information spaces, Mosaic dramatically and visually
integrated Internet information. Its point-and-click operation
changed ideas about what a Web browser could be, and its immediate
successor, Netscape, likewise has grown in popularity and has
continued to push the bounds of what is presented on the Web.
HotJava, however, marks a very new stage of technological evolution
of browsers. HotJava breaks the model of Web browsers as only
filters for displaying network information; a Java-age browser
acts more like an intelligent interpreter of executable content
and a displayer for new protocol and media formats. Release 2.0
and later of Netscape Communications' Navigator browser is Java-enabled.
Netscape justifiably characterizes its browser as "platforms"
for development and applications rather than just a Web browser.
Pre-Java Browsers
The earliest browser of the Web was the line-mode browser from
CERN. The subsequent Mosaic-class browsers (Mosaic and Netscape
from 1993 to mid-1995) dramatically opened the graphical view
of the Web. The Mosaic-type browsers, however, acted as an information
filter to Internet-based information. Encoded into these browsers
was knowledge of the fundamental Internet protocols and media
formats (such as HTTP, NNTP, Gopher, FTP, HTML, and GIF). The
browsers matched this knowledge with the protocols and media formats
found on the Net and then displayed the results. Figure 18.12
illustrates this operation as the browser finds material on the
Net and interprets it according to its internal programming for
protocols or common media formats. These browsers also used helper
applications to display specialized media formats, such as movies
or sound.
Figure 18.12 : Pre-Java browsers acted as filters.
Pre-Java browsers were very knowledgeable about the common protocols
and media formats on the network (and therefore very bulky). Unfortunately,
pre-Java browsers could not handle protocols for which they had
not been programmed or media formats for which no helper applications
were available. These are the technical shortcomings that Java-age
browsers address.
Java-Age Browsers
A Java-age browser is very lightweight because it actually has
no predefined protocols or media formats programmed
into its core functionality. Instead, the core functionality of
a HotJava browser consists of the capability to learn how to interpret
any protocol or media format. Of course, the HotJava browser is
told about the most common protocols and formats as part of its
distribution package. In addition, a HotJava browser can learn
any new format or protocol that a Java programmer might devise.
As Figure 18.13 shows, a Java-age browser is lightweight; it doesn't
come with a monolithic store of knowledge of the Web, but with
the most important capability of all-the capability to learn.
Figure 18.13 : The Java-age browser can learn.
Java in Operation
Another way to put the Java language, a Java-enabled browser,
and the larger context of on-line communications into perspective
is to review the processes that occur when a user with a Java-enabled
browser requests a page containing a Java applet:
The user sends a request for an HTML document to the information
provider's server.
The HTML document is returned to the user's browser. The document
contains the APPLET tag,
which identifies the applet.
The corresponding applet bytecode is transferred to the user's
host. This bytecode was created previously by the Java compiler
using the Java source code file for that applet.
The Java-enabled browser on the user's host interprets the
bytecodes and provides the display.
The user may have further interaction with the applet but
with no further downloading from the provider's Web server. This
is because the bytecode contains all the information necessary
to interpret the applet.
Java Software Components
Another aspect of the technical makeup of the Java environment
is the software components that comprise its environment. See
the Sun Microsystems Java site (http://java.sun.com/)
for complete details on obtaining the Java Developer's Kit
(JDK). Programmer's need to learn the vocabulary of the pieces
of the JDK as well as terms for what can be created with it.
Java Language Constructs
Java is the programming language used to develop executable, distributed
applications for delivery to a Java-enabled browser or the Java
interpreter. A Java programmer can create the following:
applets Programs that are referenced in HTML
pages through the APPLET
tag and displayed in a Java-enabled browser. The simple "hello
world" program is an applet.
applications Stand-alone programs written in
Java and executed independently of a browser. This execution is
done using the Java interpreter, java,
included in the Java code distribution. The input and output of
these applications do not need to be through the command line
or text only. The HotJava browser itself is a Java application.
protocol handlers Programs that are loaded into
the user's HotJava browser and interpret a protocol. These protocols
include standard ones, such as HTTP or programmer-defined protocols.
content handlers A program loaded into the user's
HotJava browser that interprets files of a type defined by the
Java programmer. The Java programmer provides the necessary code
for the user's HotJava browser to display/interpret this special
format.
native methods Methods that are declared in
a Java class but implemented in C. These native methods essentially
allow a Java programmer to access C code from Java.
Java Distribution Software
The Java Developer's Kit available from Sun Microsystems includes
the following pieces:
Java applet viewer Lets you run and test applets
without having to create an HTML page to refer to it. Note that
the beta release of the JDK included an applet viewer instead
of an updated HotJava browser.
Java compiler The software used to translate
the human-readable Java source code to machine-readable bytecodes.
The Java compiler is invoked by using the javac
command.
Java language runtime The environment for interpreting
Java applications.
Java debugger API and prototype debugger A command-line
debugger that uses this API.
The Java API
The Java API is a set of classes distributed with the JDK that
programmers can use in Java applications. The documentation of
the API provided on-line is key reference material for Java programmers.
The API consists of the packages in the Java language. The API
documentation includes a list of
All packages:
java.applet
java.awt
java.awt.image
java.awt.peer
java.io
java.lang
java.net
java.util
Information on each package, describing the following:
Interfaces
Classes
Exceptions
Documentation on each class in the package that describes the
class:
Variables
Constructors
Methods
The Java Virtual Machine Specification
A document available from the Sun Microsystems Java site (http://java.sun.com/)
called The Java Virtual Machine specifies how the Java language
is designed to exchange executable content across networks. The
aim of this specification is to describe Java as a nonproprietary,
open language that may be implemented by many companies and sold
as a package.
The Java Virtual Machine specification describes in abstract terms
how Java operates. This leaves the details of implementation up
to the programmers who create Java interpreters and compilers.
The Java Virtual Machine specification also concretely defines
the specific interchange format for Java code. This is called
The Java Interchange Specification.
The other part of the Virtual Machine specification defines the
abstractions that can be left to the implementer. These abstractions
are not related to the interchange of Java code. These include,
for example, management of runtime data areas, garbage-collection
algorithms, the implementation of the compiler and other Java
environment software, and optimization algorithms on compiled
Java code.
Java Security
Because a HotJava browser downloads code across the network and
then executes it on the user's host, security is a major concern
for Java-enabled browser users and Java programmers.
HotJava includes several layers of security, including the following:
The Java language itself includes tight
restrictions on memory access that are very different from the
memory model used in the C language. These restrictions include
removal of pointer arithmetic and removal of illegal cast operators.
A bytecode verification routine in the
Java interpreter verifies that bytecodes don't violate any language
constructs (which might happen if an altered Java compiler were
used). This verification routine checks to make sure that the
code doesn't forge pointers, access restricted memory, or access
objects other than according to their definition. This check also
ensures that method calls include the correct number of arguments
of the right type and that there are no stack overflows.
During loading, each class name and its
access restrictions are verified.
An interface security system enforces
security policies at many levels.
At the file access level, if a bytecode
attempts to access a file to which it has no permissions, a dialog
box pops up that enables the user to continue or stop the execution.
At the network level, future releases
will have facilities to use public-key encryption and other cryptographic
techniques to verify the source of the code and its integrity
after having passed through the network. This encryption technology
will be the key to secure financial transactions across the network.
At runtime, information about the origin
of the bytecode can be used to decide what that code can do. The
security mechanism can tell whether a bytecode originated from
inside a firewall. You can set a security policy that restricts
code that you don't trust in some browsers (such as HotJava).
Java Code
The code-level details of Java reveal its object orientation,
its similarity to C++, and its simplicity. A Java class is written
in a source file using a syntax similar to C++. A file called
HelloWorld.java, for example,
might have the source code shown in Listing 18.1.
Listing 18.1. The HelloWorld.java
source code.
import java.awt.Graphics;
/**
Program: HelloWorld
Purpose: demonstrates a Java Applet;
@author
john@december.com
@version Java beta; 18 Oct 95
*/
public class HelloWorld extends java.applet.Applet {
public void init() {
resize(600,
300);
}
public
void paint(Graphics context) {
context.drawString("Hello,
world!", 50, 100);
}
}
The java.applet.Applet class
is the root class of all Java applets. The class defined in this
sample file, HelloWorld,
extends this root class by creating specialized methods for initialization
(init) and display (paint).
The source code for a Java class is connected to an HTML page
through a new element: APPLET.
Browsers that don't support Java should ignore this tag. The HelloWorld
class defined in Listing 18.1, for example, can be used in an
HTML page; Listing 18.2 shows the Hello.html
code.
Listing 18.2. Hello World HTML code.
<HTML>
<HEAD>
<TITLE>Hello Java</TITLE>
</HEAD>
<BODY>
<APPLET Code="HelloWorld.class" Width="150"
Height="100"> </APPLET> </BODY>
</HTML>
When viewed through a Java-enabled browser, Hello.html
displays the string "Hello world!".
Programmers can create subclasses of the HelloWorld
class and other subclasses of the root class Applet.
The Java language can express many kinds of constructs, involving
animation, event handling, and multimedia display. All of these
class definitions, written in Java, are connected to HTML and
compatible browsers through the APPLET
element.
Java On-Line Information Sources
For pointers to more on-line information sources about Java, see http://www.december.com/works/java/info.html.
Inferno
and Limbo
The development of the World Wide Web into a major means to distribute
information on-line globally has strained the patchwork of operating
systems and languages that support the Internet and the applications
that are distributed on it. Java addresses the need for a write-once,
run-anywhere (where a port has been completed) language for networks.
Inferno is Lucent Technologies' (http://www.lucent.com/)
entry into the network software arena. Inferno is actually a networked
operating system that supports a programming language called Limbo.
Limbo, in turn, relies on its virtual machine called Dis
and a communications protocol called Styx.
Inferno is a more comprehensive solution to network programming
than Java. Inferno includes the full range of operating system
functions plus language and other utilities to support application
development. Inferno, like Java, approaches the problem of distributing
software on a network. Inferno is a networked client-server environment
with the goal of making resources available throughout heterogeneous
networks on heterogeneous host computers.
The components that work together-Inferno, Limbo, Dis, and Styx-each
play a role in the computing environment. Figure 18.14 illustrates
these roles.
Figure 18.14 : Inferno system components.
A computer programmer writes Limbo code that is compiled into
a binary (object) file. Dis, Limbo's virtual machine, interprets
the object file. The resulting application, using the Styx communications
protocols, can communicate with other applications or client/server
systems. Styx talks to Inferno, the operating system itself, which
in turn is an interface to the computer's hardware.
Inferno's outlook on computing is that all resources are files
within a hierarchical file system that acts as a consistent namespace.
This namespace allows applications to communicate with each other
and client/server relationships to occur. The namespace is virtual;
files might be located anywhere on a local network or on a global
network, but the applications just view all resources in terms
of this coherent namespace. File operations between any two machines
take place through requests and replies via Styx messages.
Inferno can be deployed on computer hosts as the native operating
system. In such cases, Inferno's components each serve a role
in the operating system layers, as shown in Figure 18.15.
Figure 18.15 : Inferno system layers.
In the case of Inferno deployed on a host with a different operating
system, an Inferno kernel emulation environment sits on top of
this host operating system, so that the upper application layer
remains consistent.
The operating systems supported by the Inferno emulation kernel
in release 1.0 include Solaris, Irix, Microsoft Windows NT, and
Microsoft Windows 95. Hardware architectures supported include
MIPS, SPARC, Intel 386, 486, Pentium, AMD 2900, and ARM.
Inferno On-Line
As of this writing, Inferno hasn't even been released to the public. For the latest on Inferno, check the Lucent Technologies Web site at http://www.lucent.com/inferno/.
Virtual
Reality Modeling Language (VRML)
Like Java, Virtual Reality Modeling Language extends the kind
of expression possible on the Web. VRML approaches the information-display
issue by attempting to create a system for 3-D representation
of objects on the Web. VRML issues include physical rendering,
the language definition for VRML, and network references. The
collection of material at http://vrml.wired.com/
gives an excellent on-line overview of some of the issues involved.
Chapter 28 delves into VRML and how it
interacts with the Web in more detail.
Figure 18.16 illustrates a sample VRML environment, "The
House of Immersion," at the U.S. National Institute of Standards
and Technology's "Open Virtual Reality Testbed," a web
devoted to demonstrating the capabilities of virtual reality.
Figure 18.16 : A sample VRML image (courtesy of Sandy Ressler, U.S. National Institute of Standards and Technology).
The new languages and information formats on the Web are sure
to add new dimensions to the web-development process. Although
satisfying user needs through a continuous-process approach still
might be the best route for repeatable web-development success,
the kind of expression possible on the Web is just in the beginning
stages.
Broadway
Broadway is the name of a project to bring universal access
to network applications. Under development by the X Consortium
(http://www.x.org/), Broadway's
goal is to allow users to "use any application, anywhere."
Broadway grew out of the X Consortium's success with the X Window
System (X), a device-independent windowing system that has been
around for more than a decade. X provides a way for programmers
to create graphical user interfaces that than can be run on a
variety of hardware platforms, relieving the need to create interface
code for every platform.
The goal of Broadway is to extend this device independence to
the Internet, while at the same time preventing a requirement
to rewrite the vast amount of X software that exists. Broadway
does this essentially by treating a Web browser as a desktop that
can run X applications. The application itself remains on the
host or server machine, not the client's. This is very different
from the Java model, in which the executable content is downloaded
to the client's host.
Broadway's model is built on the capability to invoke remote applications.
UNIX commands like rexec
and others have made this possible, but not over all computing
platforms. Broadway addresses the need to be able to run an application
on a host but then present the user interface for that application
on a client Web browser. Essentially, this makes the applications
platform independent.
Broadway On-Line
Broadway is expected to be released in late 1996. See http://www.x.org/consortium/broadway.html for the latest on its release status.
Environments
and Languages Check
The next generation of web-development environments and languages
provides more expressive ways for a web developer to work. New
languages such as Java and VRML give developers a way to create
innovative information display and interactive applications.
Language environments such as Cyberleaf
approach HTML composition from a web- and systems-level perspective,
in which file management and web-wide parameters and styles are
under more control of the developer.
Systems such as Silicon Graphics' WebFORCE
software integrate many multimedia capabilities into a system
for creating innovative hypermedia applications and serving those
to the World Wide Web.
Java, by recasting the browser as a flexible,
multiprotocol viewer, transforms the Web from a set of fixed protocol
and format experiences to one in which format and protocol can
be negotiated dynamically between client and server. As a result,
animations and hypermedia expressions in many formats can be created
for use with capable browsers.
The Java programming language works with
a special kind of browser and bytecode interpreter. Java can exist
within the context of World Wide Web communication and therefore
"sits on top of" a set of applications on networks for
data communications to support information retrieval.
Inferno, developed by Lucent Technologies,
addresses the need for a networked operating system to run on
a variety of devices across many networks. Limbo is the name of
the computer programming language used with Inferno.
Broadway, growing from the X Consortium's
successful X Window System software, like Inferno and Java, addresses
the need for developers to be able to distribute applications
over networks to many different kinds of hosts.
Advances in web-development environments
can free web developers to concentrate on the creative tasks of
integrating all processes of web development to meet user needs.
Advances in language environments can create new possibilities
for new forms of creative human communication on the Web.
Wyszukiwarka
Podobne podstrony:
ch18CH18ch18 (2)ch18ch18 (12)ch18ch18 (11)ch18 (5)BW ch18ch18ch18ch18CH18 (16)ch18ch18więcej podobnych podstron