In This Chapter
Extending the Web
In the "old days" of the World Wide Web (three whole years ago), there were two ways to get information (also called content) to the user. The primary way was through HTML (HyperText Markup Language), the language used to write Web pages. HTML enables you to present text and certain types of graphics (as well as links to connect one page to another page) either on the same computer or somewhere else in the world. As HTML has evolved (the current standard being worked on is version 3.2), other features have been added, such as forms, frames, tables, and so on. However, even with all the new features, HTML basically deals with Web content by:
Although this provides a wealth of possibilities for content manipulation (just spend a little time on the Web to see for yourself), it doesn't allow for more advanced things like accessing a database, ordering catalog items online, or making animated graphics within a Web page. For these capabilities, you need to understand the Common Gateway Interface, or CGI.
CGI provides a means of extending the capabilities of HTML by allowing the Web designer to write custom programs that interact with Web pages to do more complex things. A CGI program is a file that resides on the Web server and that the server runs in response to something inside the Web page. With CGI, you can:
An image on the image map
Which part of an image you click determines what happens next.
Most CGI Programs Are Written in Perl
Because the Internet originated within the UNIX world
(before Windows computers or Macintoshes
were hooked up to it), much of what drives the Internet (and the Web) is based in UNIX. CGI stems
from this same root, and the Perl language is a UNIX-based language. However, a CGI program
can be written in any language that the Web server supports.
Finally, to use CGI, you must have access to the CGI interface of the Web server thats serving up your pages. As Ive mentioned, some providers might not support CGI access, or it might be offered for an extra (in many cases, costly) fee.
In other words, CGI is more complex than most Web authors are interested in, and doesnt support all of the visually fancy things authors want to include in their pages. But something else is necessary, and that something is Java.
Java: Web Programming for the Common Man
You cant surf the Web today without hearing about Java. Java, a programming language developed by Sun Microsystems, was designed to allow more power and flexibility for the presentation of material on the Web. With Java, you can...
Java works the floor in 3D rotating glory.
Before Java, if you wanted to view a graphic, play a movie, or listen to a sound file on the Web, you had to have a helper application (an independent program unrelated to the browser) installed on your computer and connected to your browser. Whenever a particular file (movie, sound, or whatever) was retrieved from the Web, the helper would be run to display or play back the file. If you didnt have the necessary helper, you had to find it, download it, and install it.
Java handles these things internally. No more helper applications, and no more CGI programming. All you need is a Java-enabled browser to view Java programs, and the Java Developers Kit to design them (its available for free from Suns Java Home Site, http://java.sun.com/). And, as an added bonus, the Java programs you create (called applets or mini-applications) will run on any Java-enabled browser on any platform: Macintosh, Windows, or UNIX. You dont need to create a program for each machine type. One size fits all.
However, Java is not without its problems. It also is a programming language, and as with all programming languages, you must learn it relatively well in order to use it. The applets you create must be compiled (by a compiler) before you can use them. A compiler is a special program that reads your own program and crunches it into machine-readable binary code. In spite of the existence of several nice development packages for building Java applets, compilers can be a hassle because you have to use them every time you make a change to your program, and it can take a long time to compile a program.
Scrolling ticker tape Scrolling ticker tapestrust me; they scroll.
Once upon a time (not too long ago), Sun Microsystems conjured up the complex and powerful programming language now known as Java. Although Java is highly capable, it's best suited for more complex tasks and experienced programmers. Netscape Communications saw the need for an in-between languageone that would allow individuals to design Web pages that could interact with the user or with Java applets, but that would require a minimum of programming experience. Always one to be first on the block, Netscape whipped up LiveScript.
Whats a Scripting Language?
Its impossible for a computer program to be all
things to all people. Software publishers try their
best to make sure their programs can handle most of what users want, but they can never anticipate
everything. To make their programs more flexible, many provide the capability to extend or change how t
heir program behaves through a script.
A script is nothing more than a sequence of
program instructions (called statements). The
steps through the statements one at a time and performs whatever the script tells it. This is exactly the
same as "programming," except that scripts tend to have simpler rules and require less learning time.
Some examples of programs that provide scripting are dBASE, Paradox, and Microsoft Access (though
there are many more). Some examples of stand-alone scripting languages are Perl and REXX.
Scripting languages make extending these packages
easy. (And you dont have to be a programmer,
purchase an expensive compiler, learn some strange pseudo-English language, or start wearing plaid
shirts and pocket protectors.)
Thinking of Objects
You can think of objects as little black boxes. You poke things into it (which is called setting an object's properties), and the black box does something in response. Actually how it works isnt important, just that it does work. This is the basis for the concept of object-oriented programming, in which the programmer is more concerned with what an object is doing than how it gets the job done.
For example, if you had a screen object, we could change the color of the computer screen by telling the screen object to set its color property to, say, green. Whether the computer is a Macintosh or an IBM PC, the object would do the same thing.
In Chapter 5, you begin an up-close and personal look at objects in their natural habitat.
The Least You Need to Know
For comments or technical support for our books and software, select Talk to Us.
Copyright © 1997, QUE Corporation, an imprint of Macmillan Publishing USA, a Simon and Schuster Company.