To be fair, that's the compiled CoffeeScript. While it certainly is still fairly readable (even writable), the JavaScript you write by hand won't have the same "compiled feel".
This is more like what you would write by hand for the above code if the core constructors had a Backbone-style .extend function [1], which it likely would have if normal JavaScript usage was considered for the initial release (which I recognise is what this is - you can't expect everything first time):
var Shopify = Batman.App.extend()
Shopify.root('products#index')
Shopify.resources('products')
Shopify.Product = Batman.Model.extend()
Shopify.Product.persist(Batman.RestStorage)
// I'm never sure about how much I'm expected to mimic CoffeeScript code
// when using libraries written in CoffeeScript and the source code is
// written in a language I'm not practiced at reading - I've been bitten in
// the past by CoffeeScript-only examples which *assume* you're transpiling
// to JS in your head to insert the implicit return of the result of the
// last expression.
Shopify.ProductsController = Batman.Controller.extend({
index: function() {
return this.redirect({action: 'show', id: 1})
}
, show: function(params) {
return this.product = Shopify.Product.find(params.id)
}
})
If there's common boilerplate associated with each constructor, you could also go further and customise the extend method for each one to take care of it if provided with certain configuration details, e.g.:
var Shopify = Batman.App.extend({
root: 'products#index'
, resources: 'products'
})
It always puzzles me that people look at some of the implementation details CoffeeScript shields programmers from and throw their hands up in the air and admit defeat [2] when we have a language as flexible as JavaScript at our disposal to hide some of the uglier implementation details in APIs we define.
It's readable, but any framework that requires you to recreate inheritance yourself is going to have a hard time selling to a js audience when Backbone works perfectly well (and can be written in cs just as easily).
Much like the description of the framework i think people are looking for a more specific answer to this question. I'm starting to think you are a super hero yourself. Captain Vague we'll call you.
I mostly try a framework to see what it can do. Looking at the documentation it seems like they are good enough to get me started.
Not sure what all these negative comments are doing here. Feels like half the people are asking for somebody to hold their penis and the other half is crying because they can't read Coffee-Script.
Sure, I'll break it down: batman.js is a JavaScript framework for rich JavaScript applications. It's designed to make development as fast and as painless as possible for developers and designers while giving them lots of power.
We designed everything around a number of primary goals such as convention over configuration, HTML-based views, and the principle of least surprise. This is something we're using at Shopify in our future projects, so it's meeting those goals while coming out of real work.
If you want more info, the features page (http://batmanjs.org/features.html) has a list of everything we're trying to do, and the examples page (http://batmanjs.org/examples.html) has a few usage examples. There's still only a couple, but I'm working as quickly as possible to build out the gallery.
And of course, let me know if there's anything else I can answer about the framework. I hope that helped clear it up a bit, though!
"batman.js is a JavaScript framework for rich JavaScript applications. It's designed to make development as fast and as painless as possible for developers and designers while giving them lots of power."
That sounds like a pitch I would give a non-techie manager or client. Someone who's been around computers enough to know that javascript is the thingie that makes web pages do stuff.
Your target audience is developers, yes? We can take it. The first thing in your pitch should be how it helps, not "We'll save you lots of time, we promise. Trust us!"
I didn't know about batman either and I got the same impression when landing on the page. It took me a few clicks to get a handle of what it was.
Can I suggest that in the website header you include some sort of one-line description, like 'the javascript web application framework', or similar and more creative?
I still don't really understand when I would consider using it. Would you use it to create some or all of Shopify?
Maybe this blurb from the documentation could find its way to the hoe page:
batman.js is a framework for building rich single-page browser applications. It is written in CoffeeScript and its API is developed with CoffeeScript in mind, but of course you can use plain old JavaScript too.
Shopify would use this to write the client-side parts. We can now save on a lot of server-side rendering of pages every time a request happens; instead we just send back JSON and Batman.js knows how to change the page accordingly.
We’re already using it internally for non-core projects like our phone support system (Batman.js + Faye + Adhearsion) – it makes for a really responsive web app that’s easy to maintain.
Expect to see this in the core Shopify product very soon :)
Sure, I'll break it down: batman.js is a JavaScript framework for rich JavaScript applications. It's designed to make development as fast and as painless as possible for developers and designers while giving them lots of power.
Still nada. What does it actually do? A framework for doing what w.r.t. rich JavaScript applications? Is this like Cappuccino? How does this "make development as fast and as painless as possible for developers and designers while giving them lots of power"?
Cappuccino and Objective-J will certainly be extremely comfortable for those coming from a Cocoa or GNUStep background. But even for traditional web developers, Objective-J allows you to do some extremely powerful things that just wouldn't be possible otherwise. That said, it is still a strict superset of Javascript, so any valid Javascript is still valid Objective-J, and vice versa.
This was a huge release, we'll be around to help anyone who wants to get started with the new version or Cappuccino in general. Find us on Freenode at #cappuccino or the mailing list, http://groups.google.com/group/objectivej.
Thanks to everyone that helped make this release happen!