Nov 27, 2008

Prototype - A JavaScript Framework

Prototype is a JavaScript Framework developed by Sam Stephenson to ease development of dynamic web applications.
It is a JavaScript library which allows to manipulate DOM in a very easy and fun way that is also safe (cross-browser).
Scriptaculous and other libraries, such as Rico build on Prototype's foundations to create widgets and other end-user stuff.

key points:
* Extends DOM elements and built-in types with useful methods.
* Has built-in support for class-style OOP including inheritance.
* Has advanced support for event management
* Has powerful Ajax features
* is not a complete application development framework.
* does not provide widgets or a full set of standard algorithms or I/O systems.

How can prototype help us in developing a Dynamic Web Application?

Cross Browser Support: While doing JavaScript programming, it is required to handle different Web Browsers differently. Prototype Library has been written in such a way that it takes care of all the compatibility issues.

The Document Object Model: Prototype provides helper methods that ease some of the strain of DOM programming. Using Prototype, you can manipulate DOM very easily.

HTML Forms: With Ajax, other input mechanisms, such as drag and drop, can be used as part of a conversation between the browser and the server. With conventional JavaScript programming it is difficult to capture these inputs and pass them to the server. Prototype provides a set of utilities for working with HTML forms.

JavaScript Events: Prototype provides some excellent cross-browser support when coding events, and also extends the Function object to make it easy to work with event handling.

Ajax Utilities: The most important feature of Prototype is it's support for Ajax. All major browsers support a version of the XMLHttpRequest object that makes Ajax possible, either as an ActiveX component or as a native JavaScript object.

XMLHttpRequest, however, exposes the HTTP protocol at a very low level, which gives the developer a lot of power, but also requires her to write a lot of code in order to do simple things.

Prototype uses it's own object inheritance system to provide a hierarchy of Ajax helper objects, with more generic base classes being subclassed by more focused helpers that allow the most common types of Ajax request to be coded in a single line.



No comments: