Sunday, February 1, 2009

Alternatives to JavaScript...

Several other programming languages can add interactivity to web pages, but
they all differ from JavaScript in important ways. The four main alternatives
are CGI scripting, Java, VBScript, and Flash.

CGI Scripting
Before JavaScript, using CGI scripts was the only way to make web pages do
more than hyperlink to other web pages containing fixed text. CGI stands for
Common Gateway Interface. It’s a protocol that allows a web browser running on
your computer to communicate with programs running on webservers. It is
most often used with HTML forms—pages where the user enters information
and submits it for processing. For example, the user might see a web
page containing places for entering the length and selecting the type of a
fish, as well as a Compute button. When the user keys in the length, selects
the type, and clicks the button, the information is sent to a CGI script on the
server. The CGI script (which is probably written in a programming language
like Perl, PHP, or C) receives the information, calculates the weight of the
fish, and sends the answer, coded as an HTML page, back to the browser.

Drawbacks: CGI scripts are very powerful, but because they reside on webservers

1. The Need for Back-and-Forth Communication :
The connection between your web browser and the webserver limits the speed of your web page’s interactivity Ex: You’re filling out an order form with a dozen entry fields including name, address, and phone number but you forget to fill out the phone number and address
fields. When you click the Submit button to send the information across the
Internet to the webserver, the CGI script sees that you didn’t fill out the form
completely and sends a message back across the Internet requesting that you
finish the job. This cycle could take quite a while over a slow connection. If you
fill out the form incorrectly again, you have to wait through another cycle.

2. Server Overload by Concurrent Access :webserver running a CGI program can get bogged down if too many people call the script simultaneously.Serving up HTML pages is pretty easy for a web server. However, some CGI scripts take a long time to run on a machine, and each time someone calls the script, the server has to start up another copy of it. As more and more people try to run the script, the server slows down progressively.

3. Security Restrictions :A third problem with CGI scripts is that not everyone has access to the parts of a webserver that can run CGI scripts. Since a CGI script can conceivably crash a webserver or exploit security flaws, system administrators generally guard these areas, only allowing fellow administrators access. If you have Internet access through an Internet service provider (ISP), you may not be allowed to write CGI scripts.

VBScript
The language most similar to JavaScript is Microsoft’s proprietary language,
VBScript (VB stands for Visual Basic). Like JavaScript, VBScript runs on your
web browser and adds interactivity to web pages. However, VBScript works
only on computers running Internet Explorer (IE) on Microsoft Windows, so
unless you want to restrict your readership to people who use IE on Windows

Java
Although JavaScript and Java have similar names, they aren’t the same. Netscape, now a part of AOL, initially created JavaScript to provide interactivity for web pages, whereas Sun Microsystems wrote Java as a general programming language that works on all kinds of operating systems.

Flash
Flash is a tool from Macromedia developed to add animation and interactivity
to websites. Almost all modern browsers can view Flash animations or can
easily download the Flash plug-in. Flash animations look great, and a basic
Flash animation requires no programming skills at all. To create Flash animations,
however, you must purchase a Flash product from Macromedia.
Web page designers will often blend the two, using Flash for animations and JavaScript for interactivity that does not involve animations. Flash animations can also be made more interactive using a language called ActionScript, which is almost exactly like JavaScript.

No comments:

Post a Comment