views:

499

answers:

5

I am interested in getting started with CommonJS.

With JavaScript frameworks getting faster all the time, and parsing engines and compilers making JavaScript incredibly quick, it is surprising that a project such as CommonJS has not been initiated sooner.

What steps are involved in getting a test project up and running with what has been created so far?

+1  A: 

Have you tried starting here?

What are you stuck on?

Noon Silk
+1  A: 

It's gelling. You're early, unless you like living on the edge.

By the way, your wikipedia link has links to the projects that use CommonJS. You had the answer before you got here.

Nosredna
I don't know, I think if you're using JS on the server you're not living on the edge, you're already falling down the cliff, and soon you'll hit the bottom.
Noon Silk
Node.js is the future, @silky.
Nosredna
New models are cool sure, but languages that aren't compiled aren't, IMHO; that's all I don't like. Anyway, this is too an important argument to have inside a 500-letter comment box, and nothing will be achieved here. Better to do than talk :P
Noon Silk
As someone who is, down deep, an assembly language programmer, I agree. But Nodejs is just about all C code. The JS is scaffolding to direct traffic. The performance numbers for Node.js are already monstrous, in a good way. :-)
Nosredna
+10  A: 

It really depends on what you're actually looking to do. Persevere, for example, is a JSON database that is built on top of Rhino but is capable of working with CommonJS modules and is being built up around JSGI (the web server interface) going forward.

Narwhal is a fairly robust library of JavaScript and is specifically looking to track the CommonJS standard as it evolves. Narwhal runs on top of Rhino by default, but you can also install JavaScriptCore (and possibly v8) as additional "engines". JSC is very fast.

There are various web frameworks available (including Helma NG).

Node.js has been getting a lot of attention as a fast, v8-based, event-driven network services stack for JS. Node recently changed to use CommonJS modules.

SproutCore has a branch ("tiki") that is built on CommonJS modules. I, personally, am using that now for Bespin of which the client side is entirely CommonJS modules. (Ironically, the server side is currently in Python, but we do have plans to migrate to CommonJS on the server as well.)

The thing to remember about CommonJS is that it's an API spec. It's possible for there to be many implementations. Thus far, the only part of the spec that is widely supported are the modules... the rest is still baking, but coming along nicely.

CommonJS is not yet to the level of interop of, say, CPython/Jython/IronPython, but it certainly has that potential going forward.

Kevin Dangoor
Helma NG is now known as RingoJS: http://ringojs.org/
Sean McMillan
+2  A: 

What steps are involved in getting a test project up and running with what has been created so far?

I found the Narhwal quick start to be the fastest way to get up and running.

Jeff Hammerbacher
A: 

I just started using Node.js at home. It works and seems great. The only issue I've encountered so far is that Windows support seems somewhat distant.

I believe Rhino works with Windows since it's a Javascript interpreter written in Java, but that also means it's slower than the Javascript-C implementations like V8. I don't think Rhino itself implements the CommonJS specification, but you can run something like Narwahl on top of it - as was mentioned by Kevin and Jeff.

I just did a quick job of installing Rhino, Ant (to build Rhino) and trying to get Narwhal running with Windows, but wasn't successful.

I suggest trying Node.js on a Linux box since that was my environment and it worked flawlessly.

AaronOman