ComposeJS: Robust, Lightweight Object Composition

This entry is part 3 of 4 in the series Dojo Foundation Packages

ComposeJS is a JavaScript package/module for object-oriented programming available in the Dojo Foundation package repository. JavaScript itself is already a highly object-oriented programming language, and the prototype-based inheritance system is very powerful. Rather than simply porting a “class” system from another language, the core philosophy of ComposeJS is to leverage JavaScript paradigms and enhance it with clean, terse syntax and modern composition and resolution concepts for simple, high-performance, and robust object constructors. ComposeJS uses concepts from class inheritance, multiple inheritance, mixins, traits, and aspect-oriented programming to compose functionality in the most efficient manner possible.

Continue reading

Git-Linked Packages for NPM/Node

This entry is part 2 of 4 in the series Dojo Foundation Packages

The new Dojo Foundation Package repository is an easy and powerful new way to host Node packages for installation with NPM. This new repository allows you to directly link packages to git repositories and it works with NPM without changes. Developing a Node package couldn’t be easier. Simply submit your package URL to the repository, and instantly it will be available for installation for NPM! Not only that, but you never have to resubmit version updates. Since the package repository is linked to git, any new version tags that you create on your github package repository will automatically be reflected as a new package version available for NPM installation. NPM does not need to be reconfigured at all, just run install like you would with any other package:

npm install my-new-package

When you have updates for your package that you want to designate as a new version, simply tag it in Git. And that’s it! Next time your package is installed or upgraded the newest version will be there.

Continue reading

Asynchronous Modules Come to Dojo 1.6

Dojo (core) and Dijit 1.6 have been refactored to follow the proposed CommonJS AMD API.

Module Compatibility

Dojo modules are now completely compatible with:

Flexibility, Performance, and Stack Traces

This refactoring gives Dojo excellent flexibility going forward, to support both legacy synchronous loading mechanisms, as well as new asynchronous script-tag based loading that provides significant performance boosts and debugging improvement (including real stack traces!).

Continue reading

Many Comet Solutions for your Real-time Apps

We’ve been interested in Comet for a long time, dating back to the days of mod_pubsub and early talks on event-driven user interfaces. Now, with the arrival of WebSockets in WebKit-based browsers, and expected in Firefox 4.x and Internet Explorer 9 once the next WebSockets specification draft is completed, and with Comet techniques used by many of the world’s most popular sites, Comet has arrived as a viable necessity for rolling-out real-time capabilities for your web applications.

Continue reading

Resource Query Language: A Query Language for the Web, NoSQL

Data querying is a critical component of most applications. With the advance of rich client-driven Ajax applications and document oriented databases, new querying techniques are needed, and Resource Query Language (RQL) defines a very simple but extensible query language specifically designed to work within URIs and query for collections of resources. The NoSQL movement is opening the way for a more modular approach to databases, and separating out modeling, validation, and querying concerns from storage concerns, but we need new querying approaches to match more modern architectural design.

Continue reading

Dojo WebSocket

Dojo 1.6 introduces a new API for Comet-style real-time communication based on the WebSocket API. WebSocket provides a bi-directional connection to servers that is ideal for pushing messages from a server to a client in real-time. Dojo’s new dojox.socket module provides access to this API with automated fallback to HTTP-based long-polling for browsers (or servers) that do not support the new WebSocket API. This allows you start using this API with Dojo now.

Continue reading

Patr: Promise-based Asynchronous Test Runner

This entry is part 4 of 12 in the series Server-Side JavaScript, Pintura, and Persevere 2.0

Patr (Promise-based Asynchronous Test Runner) is a simple lightweight cross-platform test runner for promised-based applications. Patr executes tests by simply executing functions of an object and is intended to be used in combination with the “assert” module (which is available on NodeJS and Narwhal), so tests can be as simple as:

var assert = require("assert");
tests = {
  testSomething: function(){
    assert.eq(3, 3);
  }
}
require("patr/runner").run(tests);

Continue reading

Promised-IO

This entry is part 3 of 12 in the series Server-Side JavaScript, Pintura, and Persevere 2.0

Promises are a well-established mechanism for modeling future or asynchronous actions. Promises allow asynchronicity while maintaining the core programming principles of composability and encapsulation. Writing asynchronous code in JavaScript can often be a confusing exercise due to the extensive need for callbacks, but promises help to define composable units of asynchronicity to encapsulate actions and reliably separate caller and callee’s concerns.

Promised-IO

Promised-IO utilizes promises as an abstraction for I/O operations on top of Node, Narwhal/Rhino, and the browser (where possible). This serves two purposes. First, this package provides the benefits of promise usage: clean separation of concerns and proper encapsulation of eventual values. Second, Promised-IO provides a consistent normalized interface for I/O that will work on multiple platforms without sacrificing any of the advantages of asynchronous I/O, making it easy to build modules that can be used by developers on many platforms.

Continue reading

Nodules: Better Module/Package Handling for Node.js

This entry is part 2 of 12 in the series Server-Side JavaScript, Pintura, and Persevere 2.0

Nodules is a module loader for Node that provides a powerful set of features for application development and distribution. Nodules was written to solve the two major missing pieces of functionality I needed for efficient application development: flexible dependency resolution and module reloading. Nodules runs on top of Node’s simple base module loader, and nicely compliments the base loader with additional functionality. Furthermore, it provides this functionality using idiomatic asynchronous techniques, a smart package layout, and powerful module reloading.

Continue reading

Real-time Comet Applications on Node with Tunguska

This entry is part 8 of 12 in the series Server-Side JavaScript, Pintura, and Persevere 2.0

Node is a server-side JavaScript platform that is known for being well suited for Comet-style applications that utilize long-lived connections to allow applications to send messages from the server to the browser asynchronously. In fact, the beginning of the front page of nodejs.org starts out with an example of a web application that delays for a couple seconds before sending a response without any type of blocking; the code is asynchronous and efficient.

However, building a real-life real-time application involves more than just a platform that gives you asynchronous communication, there are a number of other important techniques to understand. We will look at these techniques and introduce project Tunguska that provides some helpful tools to assist in building applications. While a number of Comet projects out there attempt to provide a black box solution to Comet, Tunguska recognizes that most real-time applications involve deep integration into the application and its security, messaging, and data structures. Consequently Tunguska is a set of tools for building real-time applications rather than a closed black box that can’t easily be integrated with. Let’s look at some of these tools.

Continue reading