Ample SDK
Encyclopedia
Ample SDK is a lightweight JavaScript library
JavaScript library
A JavaScript library is a library of pre-written JavaScript which allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies....

 intended to simplify cross-browser
Cross-browser
Cross-browser refers to the ability for a website, web application, HTML construct or client-side script to support all the web browsers. The term cross-browser is often confused with multi-browser...

 web application development. Although the Ample SDK allows you to do client-side scripting
Client-side scripting
Client-side scripting generally refers to the class of computer programs on the web that are executed client-side, by the user's web browser, instead of server-side...

 in a very similar way as jQuery
JQuery
jQuery is a cross-browser JavaScript library designed to simplify the client-side scripting of HTML. It was released in January 2006 at BarCamp NYC by John Resig...

 and many other JavaScript libraries, its main purpose is to enable development of declarative GUI's for Rich Internet application
Rich Internet application
A Rich Internet Application is a Web application that has many of the characteristics of desktop application software, typically delivered either by way of a site-specific browser, via a browser plug-in, independent sandboxes, extensive use of JavaScript, or virtual machines...

s rather than enhancing HTML pages.

Because its documentation is still sparse and the examples lack clear explanation, the Ample SDK is not suited for the beginning, casual web developer. For the experienced web guru however, it offers many features, listed below.

Features

The features of Ample include:
  • Full implementation of the core level of the DOM
    DOM
    DOM may refer to:*D.O.M. , a restaurant in São Paulo, Brazil*Days on market, how many days since a piece of real estate was listed for sale*Deo optimo maximo, Latin for "to the Greatest and Best God", originally Jove, later the Christian God...

     W3C technologies.
  • Every major web-browser is supported.
  • Cross-browser XUL (supporting a desktop-like UI), the XML
    XML
    Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

     user interface markup language
    User interface markup language
    A user interface markup language is a markup language that renders and describes graphical user interfaces and controls. Many of these markup languages are dialects of XML and are dependent upon a pre-existing scripting language engine, usually a JavaScript engine, for rendering of controls and...

     developed by the Mozilla project.
  • Styleable HTML5 forms elements.
  • SVG in all supported browsers, including Internet Explorer 5.5-8.0
  • An optional API similar to jQuery.
  • Good run-time performance.
  • Extensible architecture.

Runtime

The runtime is the core module of the Ample SDK framework. It contains implementations for:

Scripting APIs


XML technologies


UI Markup Languages

The UI Markup Languages are implemented in JavaScript independently on each other:
  • XUL
    XUL
    In computer programming, XUL , the XML User Interface Language, is an XML user interface markup language developed by the Mozilla project. XUL operates in Mozilla cross-platform applications such as Firefox...

  • XHTML
    XHTML
    XHTML is a family of XML markup languages that mirror or extend versions of the widely-used Hypertext Markup Language , the language in which web pages are written....

     1.1
  • HTML 5.0 (in development)
  • XForms
    XForms
    XForms is an XML format for the specification of a data processing model for XML data and user interface for the XML data, such as web forms...

     1.1 (in development)
  • SVG 1.1
  • Charts

Plugins

There is a jQuery-like plugin system in Ample SDK, some of the plugins coming with version 0.9.3:
  • Forms (unlike jQuery, in Ample SDK this module doesn't belong to the core technologies)
  • Cookie
  • Store
  • Globalization
  • XPath
  • XSLT

Hello Ample! Example

The Ample web page is an HTML document with decorations. To use the Ample framework you would include the runtime library in the head section of the HTML document and in addition the library for one or more GUI languages.

Here is an example which includes the runtime and XHTML as a GUI language:



href="../ample/languages/xhtml/themes/default/style.css"/>

We also included a CSS style sheet for the XHTML library.

A further note to make is that the document should contain namespace declarations for the GUI languages used, which is most conveniently placed in the HTML tag:

...


If you would like to introduce dynamic behavior, you can include JavaScript functions, in a very similar way as most JavaScript libraries allow you to include behavior: as body of a document ready function:



This script says something like: for every b element in the part of the document that is controlled by Ample, there will be an alert with showing the nodeValue of the firstChiled of the element.

On purpose we were talking about part of the document, because you can designate a number of sections within the body of an HTML document to be processed by Ample and the rest of the document will remain untouched:


Hello, World!


Therefore, if the HTML document would contain more b elements outside the Ample sections, the alert would not occur when you would click on it.

Standards-based web-development

So far, we have shown nothing that could not be done slightly more easily in a JavaScript library like jQuery. The power of declarative GUI development will become clear with the next example, showing a table with a rich interface. You should contrast the source code shown in the example below, with similar functionality in a jQuery plugin, where you probably would see only a on a page and where you would have to guess what the final appearance of the element would be from looking at the JavaScript code.

User Interface

In the next example we will use XUL as the GUI language. XUL is an XML Markup Language, developed by Mozilla and used for example for the Firefox browser. Ample offers a full implementation of XUL.




Logic

The Application Logic of your client web application is written in JavaScript. For example:




Style

The styling of your application is done in CSS, for example:




From the XUL code it is easy to see what the layout of the table will be. The assumption is that for web-designers it is much easier to look at a declarative page that uses familiar, HTML like tags. The application developers can concentrate on specifying the behavior for the GUI elements. There is also a good separation between layout, styling and processing.

Componentization model

Although there is a set of pre-defined UI Markup Languages (including XUL, XHTML, SVG and HTML5) it is easy to extend the base (to adjust it to certain application needs) and create new languages and UI components. This is done by either prototyping objects in JavaScript and registering them with the framework, or by implementing these components in XBL2. The UI Languages that are currently present in Ample are prototype implementations.

Related links

  • JavaScript
    JavaScript
    JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....

  • Ajax (programming)
    Ajax (programming)
    Ajax is a group of interrelated web development methods used on the client-side to create asynchronous web applications...

  • List of web application frameworks
  • Comparison of JavaScript frameworks
    Comparison of JavaScript frameworks
    - Rationale :There are many JavaScript frameworks available. The intention of this comparison is to show some examples of JavaScript frameworks with their different features.- Table of Javascript Frameworks :- External links :* * * * * * * *...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK