Introduction

Portland JavaScript Admirers is a group that meets monthly to discuss topics on JavaScript and ECMAscript ranging from client-side web frameworks, to functional and prototypal programming theory. Meetings take place on the fourth Wednesday of every month from 7-9pm at Jive Software.

New members and speakers are always welcome! Please send a message to pdxjs@googlegroups.com if you would like to give a presentation, or if you have a suggestion for a topic. And feel free to join our mailing list if you too are a JavaScript admirer.

Reporting from the Closures

Cappuccino

08 November 2009

This month we had a great detailed talk on Cappuccino, given by Howard Lewis Ship. Cappuccino is a JavaScript framework for creating rich graphical interfaces in the browser. It is an effort by some former Apple engineers and is the flagship product of their company, 280 North. They essentially re-created OS X’s Cocoa library and adapted it to run on Objective-J, a dialect on top of JavaScript that is designed to be similar to Objective-C. The advantage of using Objective-J instead of pure JavaScript is that you can use the Cappuccino libraries with pretty much the same API that you would use when building native Cocoa apps. Real live Cappuccino apps that you can try out are 280Slides by 280 North and almost.at, which is an independent effort.

One of the most impressive points that Howard brought up has to do with Cappuccino’s interoperability with Apple’s Xcode IDE. Xcode includes an Interface Builder tool which acts as a powerful WYSIWYG interface for building graphical interfaces. Interface Builder outputs an XML description of your design called a nib file. Cappuccino includes a tool that can automatically convert a nib file into its Cappuccino equivalent. So you can design your views in Interface Builder and run them in the web browser with Cappuccino in the same way you would expect from a native Cocoa app.

So far Interface Builder is the only component of Xcode that Cappuccino integrates with. But the 280 North team is working on better IDE support in the form of Atlas, their own IDE. Atlas is intended to be a cross-platform tool for building Cappuccino apps. It also happens to be written in Cappuccino. The web site hints that Atlas may include an option to create builds of Cappuccino-based web code that look and feel like desktop apps. It looks like 280 North is planning to use Atlas as their revenue stream since it will be a paid app. The Atlas Developer Beta Program will launch on November 15th.

Cappuccino will be most comfortable to to programmers who have experience with Objective-C and with Cocoa - or NeXTSTEP which is what Cocoa is based on. Howard mentioned that Cappuccino’s documentation can be unhelpful and incomplete. But because Cappuccino is modeled so closely after Cocoa you can generally use Cocoa reference materials instead, which are very complete. Similarly, developing Cappuccino apps will be easiest for Mac users with access to Xcode.

Objective-C was created as a way to bring some of the powerful features of Smalltalk to C programming. In the same way that Objective-C is a layer on top of raw C code, Objective-J is a layer on top of JavaScript. To use Cappuccino’s APIs your classes and methods will have to look like Objective-C code. But within your methods and in your support code you can use pure JavaScript. Objective-J compiles down to JavaScript when a Cappuccino app is compiled. Writing interfaces to Objective-J APIs from pure JavaScript takes a little work but is possible.

Objective-J makes some deviations from Objective-C in addition to its JavaScript foundation. Objective-J has no header files: all of the declarations you need are put straight into code files. And though Objective-J requires you to declare types in your method signatures and instance variables, it does not actually perform any type checking. One pitfall when coming from Objective-C is to try to declare local variables with a specific type. In fact you are required to declare all local variables with JavaScript’s native var keyword. There is also no syntactic distinction for pointers in Objective-J because all non-primitive values are passed by reference in JavaScript.

The advantage of Cappuccino is that you can use it to build very powerful, cross-browser, graphical interfaces quite easily. And you get the advantages of existing tools, like Xcode’s Interface Builder plus proven technologies of Cocoa and NeXTSTEP. If you have experience with those technologies you have a shot at a very smooth transition to building web applications. And unlike Cocoa, Cappuccino is completely open source.

The downsides are that Cappuccino’s documentation is not great, as is mentioned above. Debugging can be painful because the compiler errors that you see will often provide no information as to what the problem is - though Howard recommends using Safari for the least painful debugging experience possible. Because of its Mac roots Cappuccino development tends to be Mac-centric - at least until Atlas is released. Compiled Objective-J code does not appear to be optimized for performance; so Cappuccino apps might not perform quite as well as apps built on other frameworks. And there are some aspects of web programming that do not come up as much in desktop applications - in particular background server communication. Cocoa does not have much support for stuff like that, so you will have to use other tools or build your own solution.

The slides from this talk are online on Howard’s blog. Howard’s demo code is also online on Github.

If you have questions about Cappuccino feel free to post comments here or to send questions to our mailing list.

Sammy and Cross-Origin Resource Sharing

02 August 2009

At our July meeting Scott Becker gave us a presentation on a wonderful tool called Sammy. Sammy is a framework inspired by the Ruby framework, Sinatra, for structuring web applications on the client side. It works on the idea that a rich application can have many different virtual pages in a single browser page. Sammy maps each virtual page to a URL using the fragment portion of the URL do distinguish between different virtual pages in the browser page. For example, example.com/app/#/main and example.com/app/#/subpage could represent two different virtual pages, or ‘actions’.

continued »

PDXjs June Meeting Recap - Agile JavaScript Testing

09 July 2009

Our June meeting was the first meeting at Kongregate. This meeting was more free-form than most. But Scott Becker talked more about behavior-driven development in JavaScript. He brought up a lot of tools that he hadn’t covered in his previous talk.

Slides from Scott’s talk are online. Scott also drew up this list of links to various tools that are useful for testing JavaScript.

continued »

PDXjs May Meeting Recap

08 July 2009

At our May meeting the air was abuzz with preparations for Open Source Bridge. Scott Becker was preparing a topic on behavior-driven development in JavaScript with a focus on using Screw.Unit. Screw.Unit is a spec framework based on Ruby’s RSpec. Scott gave a preview of that talk for the JavaScript Admirers.

continued »

PDXjs April Meeting Recap

06 May 2009

This month we heard talks about several new JavaScript features and techniques. Duncan Beevers started off with a talk titled JavaScript Packaging Strategies. He recommends using Sprockets to combine JavaScript files with smart dependency handling. And he says that YUI Compressor is a good way to reduce the file size of the resulting package. Though for best results you will want to combine YUI Compressor with gzip.

continued »

PDXjs March Meeting Recap

27 March 2009

We started of the March meeting of the Portland JavaScript Admirers with a demonstration of ReverseHttp. This is a protocol that allows any HTTP client to act as an HTTP server by receiving requests on a public-facing subdomain. So it allows for a web server written in JavaScript to run in a normal web page.

A useful application of a web server in a page is that provides a flexible way to push data into a client side application. The client does not have to be specially set up for polling; and the program pushing the data does not have to be specially configured to support long-polling connections.

continued »

A Wanderer @ CubeSpace

25 February 2009

Portland JavaScript Admirers have convened for a second time. There’s a mailing list, a web site, plus you can follow on Calagator. We meet at CubeSpace, Portland’s geek HQS (for software – not competing with Free Geek). Ad: Women’s Networking Group meets in Roman on second Tuesdays. read more

continued »

PDXjs January Meeting Recap

29 January 2009

The inaugural meeting of the Portland JavaScript Admirers was a big success. We started off the evening with a round of introductions.

After that we listened to several talks on the fine language that is JavaScript. I pulled out my copy of JavaScript: The Good Parts by Douglas Crockford and went over some of the tips from the book on how to write great JavaScript code. I focused on how and why to avoid global variables - which can sneak up on your JavaScript code if you are not careful.

continued »

Admiring Javascript

28 January 2009

I’m at the first Portland JavaScript Admirers, well attended, geeks cheering for CubeSpace. We’ve got lots of independent contractors, including my Hewlett-Packard friend from Pythoneers (how I’m logged in, wearing the fleece), whom I also invited to our Ruby meetings, first Tuesdays. read more

continued »