Your SlideShare is downloading. ×
Ample SDK: A tour de force
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Ample SDK: A tour de force


Published on

An Introduction to Ample SDK presented at BerlinJS on 23rd September and Fronteers Jam Session on 6th October, 2010

An Introduction to Ample SDK presented at BerlinJS on 23rd September and Fronteers Jam Session on 6th October, 2010

Published in: Technology

  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Ample SDK: A tour de force BerlinJS 23 rd September, Berlin, Germany Sergey Ilinsky
  • 2. 1. Do you develop something similar? comScore «Sitestat» application screenshot
  • 3. 2. Web Application Architecture Evolution Previously Now UI&Data Data (Form data) UI Data (JSON/XML) Data (JSON/XML)
  • 4. 3. What do we have on the Client-Side now? HTML4/5 + SVG Problems: 1) Limited amount of [native] UI elements 2) Poor-to-none UI elements styling facilities (e.g. input type=date) 3) Hardly or not implemented in most of modern browsers 4) Zero language extensibility (until XBL lands) 5) Too low-level abstraction for application GUI needs + Severe inconsistencies in DOM implementations
  • 5. 4. Alternatives to HTML5 for App GUIs? JavaScript GUI Frameworks (ExtJS, Dojo, Qooxdoo, jQuery UI..) Drawbacks: 1) Proprietary APIs 2) UI is programmed (in JS+HTML), not declared 3) No way to re-use (to run natively later) App code written in future when browser GUI technologies catch up
  • 6. 5. What if... What if we would extend on browser approach/technologies and preserve the programming model instead? Benefits: 1) Standard technologies and APIs (no learning needed) 2) Very good separation of concerns: layout, logic and style 3) Chance to delegate browser tasks when it becomes capable 4) View logic written today can be re-used tomorrow
  • 7. 6. Ample SDK JavaScript GUI Framework Ample SDK is a JavaScript GUI Framework that smartly re-uses concepts and technologies found in web-browsers but also provides a higher-level abstraction to facilitate the needs of App GUI developers. Programming Model (that of browser!): 1) XML for Layout 2) JavaScript (with DOM and/or jQuery API) for Logic 3) CSS for Styling
  • 8. 7. Sample [primitive] page running Ample SDK <!DOCTYPE html> <html xmlns:xul=&quot;; > <head> <title>Hello, World!</title> <!-- (A) Ample SDK runtime and UI language --> <script type=&quot;text/javascript&quot; src=&quot;ample/runtime.js&quot;></script> <script type=&quot;text/javascript&quot; src=&quot;ample/languages/xul/xul.js&quot;></script> <link type=&quot;text/css&quot; src=&quot;ample/languages/xul/themes/default/style.css&quot;/> <!-- (1) Style --> <style type=&quot;text/ ample+ css&quot;> @namespace xul &quot;;; xul| button { color: red; } </style> <!-- (2) Logic --> <script type=&quot;text/javascript&quot;> function alertHelloWorld(oEvent) { alert('Element &quot;' + + '&quot; was clicked'); } </script> </head> <body> <!-- (3) Layout --> <script type=&quot;application/ ample+ xml&quot;> <!--or: <script></script> --> <xul:hbox> <xul:button onclick=&quot;alertHelloWorld(event)&quot;>Hello, World!</b> </xul:hbox> </script> <!--or: <script>ample.close()</script> --> </body> </html>
  • 9. 8. Ample SDK maintains its own DOM select option option div div div div div input button div div
  • 10. 9. Ample SDK Technologies Overview 1) Core (single file, 38/112* Kb) - DOM (Core, Events, Selectors API) - JS objects (DOMParser/XMLSerializer/XSLTProcessor/XHR/JSON) - jQuery APIs (The Good Parts only ~95%) - UI Managers (Drag & Drop, Resize, Capture, Touch etc.) - XML Processors (SMIL 3.0, XInclude 1.0, XML Schema 1.1) - CSS Processor (CSS3-UI, CSS3-NS, CSS2.1 fixes, vendor-specific prefixes expansion) - Componentization API 2) UI Languages (separate files) - HTML 5 (13/85 Kb) - SVG 1.1 (15/90 Kb) - XUL (44/273 Kb) - Charts (28/141 Kb) - XForms 1.1 (in development) 3) Plugins (Cookie, Form, Glob, Store, XPath, SOAP, XMPP etc.) * component size (gzipped/unzgipped), numbers refer to Ample SDK 0.9.3 alpha build
  • 11. 10. Ample SDK Extension Points 1) Creating jQuery-like plugins (some existing can be re-used) ample.extend({ ampleMember: function(){} }); ample.extend({ collectionMember: function(){} }, AMLQuery.prototype); 2) Prototyping core objects AMLNode.prototype.on = function(type, callback) { this.addEventListener(type, callback, false); } 3) Creating new UI elements / languages var MyElement = function() {} MyElement.prototype = new AMLElement; MyElement.prototype.localName = &quot;tree&quot;; MyElement.prototype.namespaceURI= &quot;http://...xhtml&quot;; ample.extend(MyElement);
  • 12. 11. Some Interesting Aspects (Demo) 1) Excellent rendering speed 2) APIs validation/guarding 3) DOM Mutation events (insertion/removal, attribute change) 4) Capture phase in propagation of events (modality) 5) Built-in transitions/animations (for pseudo-classes) 6) Styling in proper CSS 7) SVG in IE 5.5-8.0 … and much, much more!
  • 13. 12. Sample Code Compared (elem. instantiation) Plain HTML: <div id=&quot;multi-slider-horizontal&quot;> <div class=&quot;x-slider x-slider-horz&quot; style=&quot;width: 207px;&quot;> <div class=&quot;x-slider-end&quot;> <div class=&quot;x-slider-inner&quot; style=&quot;width: 200px;&quot;> <div class=&quot;x-slider-thumb&quot; style=&quot;left: 173px;&quot;/> <div class=&quot;x-slider-thumb&quot; style=&quot;left: 93px;&quot;/> </div> </div> </div> // + kilobytes of cross-browser javascript ExtJS: <div id=&quot;multi-slider-horizontal&quot;></div> Ext.onReady(function(){ new Ext.Slider({ renderTo: 'multi-slider-horizontal', width : 150, minValue: 0, maxValue: 100, values : [25,75], plugins : new Ext.slider.Tip() }); }); Ample: <xul:scale value=&quot;25,75&quot; style=&quot;width:150px&quot; />
  • 14. 13. Back to the App (Highlights: Team, Arch.) comScore «Sitestat» application screenshot
  • 15. Thank you! Ample SDK Web-Site: Source-Code: Discussions: Reference: me, Sergey Ilinsky Thanks Andy Beeching ( @andybeeching ) for slides review and Béla Varga ( @netzzwerg ) for revised design of drawings