Wednesday, March 12, 2008

Strengths of JavaScript

JavaScript offers several strengths to the programmer including a short development cycle, ease-of-learning and small size scripts. These strengths mean that JavaScript can be easily and quickly used to extend HTML pages already on the Web.
Quick Development: - Because JavaScript does not require time-consuming compilation, scripts can be developed in a relatively short period of time. This is enhanced by the fact that most of the interface features, such as dialog boxes, forms, and other GUI elements, are handled by the browser and HTML code. JavaScript programmers don't have to worry about creating or handling these elements of their applications.

Easy to Learn:-While JavaScript may share many similarities with Java, it doesn't include the complex syntax and rules of Java. By learning just a few commands and simple rules of syntax, along with understanding the way objects are used in JavaScript, it is possible to begin creating fairly sophisticated programs.

Platform Independence:-Because the World Wide Web, by its very nature, is platform-independent, JavaScript programs created for Netscape Navigator are not tied to any specific hardware platform or operating system. The same program code can be used on any platform for which Navigator 2.0 is available.

Small Overhead:-JavaScript programs tend to be fairly compact and are quite small, compared to the binary applets produced by Java. This minimizes storage requirements on the server and downloads times for the user. In addition, because JavaScript programs usually are included in the same file as the HTML code for a page, they require fewer separate network accesses.

Objects And Object Hierarchy

What is Objects?
In order to understand what it means for JavaScript to be object-based, we need to look at objects and how they work. , objects are a way of organizing information, along with the methods for manipulating and using that information.
Objects provide a way to define specific pieces of data related to the item in question; these pieces are known as properties. In addition, these are supplemented by tasks that can be performed on or with that information, known as methods. Together properties and methods make up objects.
Because of the general nature of objects, specific instances can be created for each case where they are needed. For instance, a car object could then have several instances for Toyotas, Fords, and Volkswagens
Working with Objects in JavaScript
JavaScript includes both built-in objects to work with elements of the currently loaded HTML document, as well as performing other useful tasks, such as mathematical calculations. It also offers the programmers the chance to create their own objects.
Built-In Objects :- JavaScript offers a set of built-in objects that provide information about the currently loaded Web page and its contents, as well as the current session of Navigator. In addition, these objects provide methods for working with their properties.
The Navigator Object Hierarchy: -Most of the built-in objects in JavaScript are part of the Navigator Object Hierarchy. The Navigator Object Hierarchy is built from a single base object called the window object, as illustrated in the following outline.
[1] Window:-The window object provides methods and properties for dealing with the actual Navigator window, including objects for each frame.
[2] Location:-The location object provides properties and methods for working with the currently opened URL.
[3] History:-The history object provides information about the history list and enables limited interaction with the list.
[4] Document:-The document object is one of the most heavily used objects in the hierarchy. It contains objects, properties, and methods for working with document elements including forms, links and anchors.
[5] Forms [6] Anchors
In addition to the objects in the Navigator Object Hierarchy, JavaScript provides several objects that are not related to the current windows or loaded documents.
String: - The string object enables programs to work with and manipulate strings of text, including extracting substrings and converting text to upper or lower case characters.
Math: - The Math object provides methods to perform trigonometric functions, such as sine and tangent, as well as general mathematical functions, such as square roots.
Date: - With the Date object, programs can work with the current date or create instances for specific dates. The object includes methods for calculating the difference between two dates and working with times.

Javascript and it Characteristics

What is JavaScript?

JavaScript Is a Scripting Language :-
Scripting languages used for interactivity to Web pages. JavaScript is an object-based scripting language. JavaScript is interpreted, which provides an easy development process; it contains a limited and easy-to-learn command set and syntax; and it is designed for performing a well-defined set of tasks.
Designed for Simple, Small Programs
Because JavaScript is a scripting language, it is well-suited to implementing simple, small programs. Tasks can be easily written and performed at acceptable speeds with JavaScript and would be easily integrated into a Web page. In java script quick development and easy maintenance of every types of applications.
Of course, this doesn't mean that sophisticated applications can't be—and aren't being— developed with JavaScript. Nonetheless, scripting languages are generally used for smaller tasks rather than full, compiled programs.
Performs Repetitive Tasks
JavaScript is suited to producing small programs; it is especially well-designed for repetitive, event-invoked tasks. For example, JavaScript is ideal for calculating the content of one field in a form based on changes to the data in another field. Each time the data changes, the JavaScript program to handle the event is invoked, and the new data for the other field is calculated and displayed.
Designed for Programming User Events
Because of the way in which JavaScript is integrated into the browser and can interact directly with HTML pages, JavaScript makes it possible to program responses to user events such as mouse clicks and data entry in forms.
For instance, a JavaScript script could be used to implement a simple help system. Whenever the user points at a button or a link on the page, a helpful and informative message can be displayed in the status bar at the bottom of the browser window. This adds interactivity to Web pages makes forms dynamic and can decrease the bandwidth requirements and server load incurred by using forms and CGI programming.
Easy Debugging and Testing
Like other scripting languages, JavaScript eases development and trouble-shooting because it is not compiled. It is easy to test program code, look at the results, make changes and test it again without the overhead and delay of compiling.

Not Fully Extensible
JavaScript is not fully extensible. The JavaScript model is one of a limited set of base objects, properties, methods, and data types, which provide enough capabilities to create client-side applications. Users can create their own objects and write functions but not purely object oriented its object based scripting language.
Limited client-server interaction
JavaScript in its current form is not designed for complete client-server interaction. JavaScript is well-suited to handling client-end activity.
JavaScript will be part of the Live-Wire Web server being developed by Netscape. Live-Wire is aimed at groups and organizations developing interactive Web applications. In this role, JavaScript will provide an alternative to today's CGI scripting for server-end programming.
Integrated into HTML
JavaScript is tightly integrated into HTML files. Typically, entire scripts are in the same files as the HTML that defines a page and are downloaded at the same time as the HTML files.