Dynamic Web Development with Seaside

20.1Prototype and script.aculo.us

Prototype (http://www.prototypejs.org) is a free, open-source JavaScript framework, that aims to ease JavaScript programming. The framework was created by Sam Stephenson and enhances the JavaScript experience with utilities to perform AJAX requests and to do DOM manipulations without having to worry about web browser incompatibilities. Although the framework is called Prototype (a reference to JavaScript’s prototype-based inheritance model), it implements its features in a traditional class-based model.

Many of Prototype’s extensions to JavaScript are inspired by Smalltalk and Ruby. For example, after loading the Prototype library, a JavaScript Array is extended with methods that have familiar Smalltalk names: select, reject, collect, and detect. Up until recently, these similarities make Prototype the framework of choice to integrate with Seaside and Smalltalk. Nowadays the JQuery (http://www.jquery.com/) framework described in Chapter 21 is a nice alternative to the Prototype library.

The Prototype framework aims to make JavaScript programming simpler, and it does not have any features to make the user interface richer. script.aculo.us (http://script.aculo.us) is a free, open-source JavaScript framework, built on top of Prototype, providing visual effects, drag and drop and several ready-made user interface controls. The author of script.aculo.us Thomas Fuchs summarizes: “It’s about the user interface, baby!”

Seaside provides a complete integration of Prototype and script.aculo.us called “Scriptaculous”. This means that you can access all aspects of these frameworks from Smalltalk by writing Smalltalk code only. Every JavaScript class has a counterpart in the Smalltalk world and can be used without having to know the details of the underlying JavaScript implementation. The key feature is that Scriptaculous lets you write Smalltalk code that will generate JavaScript snippets embedded in the XHTML stream created by Seaside.

Scriptaculous Demo and Functional Test Suite

Copyright © 21 April 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.