The page is basically unreadable in FF 7.0.1 on RHEL 5.3. I realize light grey on white with a really thin font is dead sexy on your Mac (probably looks great on my home computer as well) but it's useless to me at work.
IME light-gray on white actually tends to be more readable on PCs than Macs due to the still-rather-different default gamma setup/color profiles. Cheaper PC screens especially often default to darker, bluer shifts.
I normally hate comments that simply criticize something not related to the content of the article, but in this case I found the lack of contrast made the article basically unreadable (on a MBP, using either the internal screen or a nice external display).
I've now shipped an Ember.js application and a knockout.js application. I enjoyed ember quite a bit but feel that knockout gives me all the magic with half the complexity.
It is true as the author mentions that it doesn't aim to fix the UI/statefullness issue, but I slapped on Backbone Routing on to my knockout code and it made capturing 'state' and urls a breeze.
The last time I used ember was 0.9.6 and I don't think this routing stuff was even in it so I was excited to see talk about it. Unfortunately it looks to be even more complicated then I expected it to. :(
Knockout may be creating some massive memory footprint in the background that will bite me down the line, but I'm writing significantly less code than I was with Ember. For example, In ember you have to create view objects and if you want your view objects to sync data with your controller you have to explicitly define them:
In knockout just have to do:
App.UserController = {
content = ko.observable(new content());
}
ko.applyBindings(App.UserController);
And now I get to do a knockout template inline with my html:
<div data-bind="text: content.firstName"></div>
It just seems like there are fewer steps with knockout and I'm getting more done. The html is a lot uglier, but it also clearer what is going on when I read it.
The ember guys have come a long way on their doc and they should be commended on it. I like the patterns they are talking about I'm just not sold that it has to be done the way they are doing it. Thanks to the author for putting together such an in depth post to me in the right direction in getting back into Ember.
I've also shipped an Ember app and a Knockout App. To me, there's no comparison: Ember development was easier and produced a faster app and a better organized code base.
Once my app grew complex, Knockout grew increasingly hard to reason about how it's view updating was working. It also grew slow.
Also, Knockout lacks any legitimate data laye (knockout-mapping isn't a data layer). Ember has ember-data.
It's a little hard to take the example seriously when you've clearly padding the Ember version with code you don't have (but would need) in the ko version.
As the guy who wrote the first bits of the Rdio code in question, it seems worth mentioning that the part in question has nothing to do with Backbone, or Ember, or anything else. That code is a cleanup function on an object that helps to abstract HTML5 <audio> vs our Flash fallback.
No matter what framework you are using, if you are solving the problems that we are solving, you are going to end up with that code.
Now, that said, I agree that learning all of the frameworks out there is advantageous, but you can't assume that the code in the blog post is indicative of anything having to do with Backbone or any other framework.
Is this entirely true? Clearly cleanup of event names like "loadedmetadata" is related to the audio element but '_bubbleProfilingEvent', '_logEvent', and general .unbind calls are on backbone-related objects, yeah?
Thanks for the comment. Before reading it, I admit to being lured into thinking the code in TFA was there to clean up after Backbone. Sneaky bit of writing...
Let me tell you why I don't care about Ember.js at the moment:
It's an "all or nothing"-solution. I couldn't care less about Stateful Single-Page Applications. I'll take a stateless, curlable, crawlable (remember Google?), old-style web site any time. Of course, some parts might require more dynamicness than other, and in that case it's lovely to jump to client side MVC. But it doesn't seem that Ember.js wants to play this game. Every time I look at Ember it seems that it wants to define the architecture of my application. Thank you very much, I like my stateless-ness very much!
Ember is primarily for web apps, not web sites. Apps that require a login are not concerned about crawlability. So, if you're just building websites, you are correct to not choose Ember.js.
Also, it's trivial to have some pieces of your app rendered by rails or whatever you're using server side.
We're using Ember to build the next generation of our product (a web app) and it has been an extremely pleasurable experience.
> I couldn't care less about Stateful Single-Page Applications. I'll take a stateless, curlable, crawlable (remember Google?), old-style web site any time
I take it that all of your applications involve public content with minimal if any enhancements to logged in users?
it seems ember is targeting web apps, which are generally behind a login for the bulk of the app, making most of your contentions moot. Not disagreeing with you, just making the point that Ember is probably not trying to be a one size fits all solution
I was concerned about this as well, but I'm successfully using an Ember app as just part of my application. The plan is to use multiple ember apps within the same rails app.
Perfect article and explanation. After having bought into Ember a couple months ago and using it heavily, it's been really hard to express to others why it feels so revolutionary.
Ember really changes JS development in ways that the other frameworks don't even attempt. And in a way this hurts it in the perception of developers, since it more often than not is just tagged as "too complicated" or "too much to learn".
The more great articles like this, and I think there'll be a solid chance Ember catches on in a big way the same way Rails did. With 1.0rc, the tech seems to be solid enough now and it just needs a push on the other stuff (education, marketing, etc). And most importantly: some more successful Ember apps out in the wild (I'm working on that one).
But Rails was built for a different world, so trying to recreate what made Rails nice in the browser feels like an answer searching for a problem. Client-side JavaScript frameworks should be compared to UIKit and the Android SDK, not to Rails, which was only interested in routing, fetching, and rendering. Giving me code organization without giving me structure is only helping with a tiny sliver of the problem.
Does anyone else thing that the documentation for ember.js is really lacking? Some of the classes it has aren't even documented (ContollerMixin comes to mind) and others are lacking in the documentation depratment. Also, I don't seem to be able to find a full listing of instance methods for a class, I have to climb up the inheritance tree in the docs class by class.
With regards to view cleanup code in Backbone - in the github develop branch [1], the view is now a little more active in its memory cleanup. A dispose() function was recently added which removes any handlers added in the view's 'events' object, as well as any collection or model listeners where the view is passed as the third argument (callback context). This function is also called by the view's .remove(), taking care of the majority of basic memory cleanup needs when the element is cleared from the screen.
Ember looks cool, but knockout lets me ship fast and it's less "magic".
Also, I think single page apps have a place as part of a greater architecture, but not as the entire app. If I wanted an entire app everything to be JS, fine, use Ember or something like it, but most parts of the web don't need this and single page apps make the web a bit worse if not done correctly.
Single page apps are the new hotness, but once the fad is over and the newness wears off, they'll be fit into their proper place over time and won't take over the entire app.
> Ember looks cool, but knockout lets me ship fast and it's less "magic".
I'd appreciate it if you could quantify what you mean exactly by "magic". For example, one key difference between Ember and Knockout is that Ember's binding system automatically avoids triggering the same side-effect from multiple pieces of code.
For example, if you had a piece of the DOM that was calculated from several observables (the stupid example is a full name calculated from a salutation, first name and last name), and made changes to all three of those in separate lines of code (possibly in different areas of your codebase), Ember would ensure that the DOM only updated a single time, not three times. This is true no matter where the three lines of code are, without you needing to take any special action to coalesce the changes.
This aspect of Ember's codebase adds some magic, in that it introduces a higher-level abstraction that knows about computed properties and their side-effects (the "run loop"), but the end result is more predictable propagation of side-effects in an Ember application. Ember applications don't need to know about the specific mechanism that makes this work, but good Ember developers are aware that many side-effects happen asynchronously in an Ember application.
The browser does something similar when you make changes to DOM structures: it only updates the rendered version of the DOM once all of the JavaScript code handling an event has completed.
I would agree that something simpler would probably be a better fit for simple "islands of richness" on an existing application, but there are definitely a large number of applications with significant amounts of logic happening on the client side, even if those applications run inside of an area of a larger traditional page.
In general, I would say that Ember is a good fit for applications that will end up with more than 100k of application code. That sounds like a lot of code, but it's really only a lot of code for islands of richness. Applications like rdio, documentcloud, soundcloud and other popular Backbone applications can easily reach 500k or even a megabytes or two of code.
It's all about context and single page apps definitely have their place.
In my case for example (photo portfolio websites) it makes a lot of sense to have a single page app for the user backend and plain server rendered html (with a bit of js sugar) for the frontend.
Glad to see this article. The recent buzz around convention and best practices in Backbone.js has been frustrating. A lot of the recent Backbone discussion are issues that have been thoughtfully addressed in Ember.js.
I feel that Backbone.js was first on the scene and hence has found its way into the current developer lexicon and toolset, leaving Ember.js unfairly looked over.
As I said in another thread, despite hilarious disagreement by jashkenas, http://news.ycombinator.com/item?id=4427974 that Backbone is perfect for big projects so long as you build on top of it with other libraries.
Ember.js is just too opinionated for its own good.
This is such a timely article, thanks! I was just listening to the video on this week's JavaScript Weekly and considering where to start among the js application frameworks. It would be nice if the author expanded on the different categories of js app frameworks.
Do any of these JavaScript frameworks have decent documentation yet? API docs are all well and good, but I'd really like some examples other than to-do applications. All they really need is an equivalent to the Rails guides at http://guides.rubyonrails.org, which are ample.
Frankly I'd take any example application over a to-do app at this point.
As an aside, I've been using Sammy.js (http://sammyjs.org) more than most of these other frameworks lately, as the effort involved is disproportionate to the rewards unless you're building the entire frontend in JavaScript. For any less-than-enormous project, you really don't need all that complexity.
Heard about sammy, but never looked into it until now. It looks really interesting. I've been looking at emberjs for the past couple of days and I do like what I see, but I always felt it was a little too heavy for what I really wanted. I'm just not ready to make my app just an api enpoint...it's just too much abstraction. Regardless, I'll continue to follow emberjs.
Can anyone tell me whether a website built with Ember.js's default settings suffers from the same readability problems with font and contrast? If so, that tells me that I probably won't want to invest any time in learning to use Ember.js.
[+] [-] fusiongyro|13 years ago|reply
http://contrastrebellion.com/
The page is basically unreadable in FF 7.0.1 on RHEL 5.3. I realize light grey on white with a really thin font is dead sexy on your Mac (probably looks great on my home computer as well) but it's useless to me at work.
[+] [-] majormajor|13 years ago|reply
I normally hate comments that simply criticize something not related to the content of the article, but in this case I found the lack of contrast made the article basically unreadable (on a MBP, using either the internal screen or a nice external display).
[+] [-] arnarbi|13 years ago|reply
[+] [-] natrius|13 years ago|reply
[+] [-] trek|13 years ago|reply
[+] [-] skilesare|13 years ago|reply
It is true as the author mentions that it doesn't aim to fix the UI/statefullness issue, but I slapped on Backbone Routing on to my knockout code and it made capturing 'state' and urls a breeze.
The last time I used ember was 0.9.6 and I don't think this routing stuff was even in it so I was excited to see talk about it. Unfortunately it looks to be even more complicated then I expected it to. :(
Knockout may be creating some massive memory footprint in the background that will bite me down the line, but I'm writing significantly less code than I was with Ember. For example, In ember you have to create view objects and if you want your view objects to sync data with your controller you have to explicitly define them:
App.userController = Ember.Object.create({
});App.UserView = Ember.View.extend({
});Now I get to do my handlebars template <script>
<div>{{firstName}}</div>
</script>
In knockout just have to do: App.UserController = {
content = ko.observable(new content());
}
ko.applyBindings(App.UserController);
And now I get to do a knockout template inline with my html:
<div data-bind="text: content.firstName"></div>
It just seems like there are fewer steps with knockout and I'm getting more done. The html is a lot uglier, but it also clearer what is going on when I read it.
The ember guys have come a long way on their doc and they should be commended on it. I like the patterns they are talking about I'm just not sold that it has to be done the way they are doing it. Thanks to the author for putting together such an in depth post to me in the right direction in getting back into Ember.
[+] [-] scottmessinger|13 years ago|reply
Once my app grew complex, Knockout grew increasingly hard to reason about how it's view updating was working. It also grew slow.
Also, Knockout lacks any legitimate data laye (knockout-mapping isn't a data layer). Ember has ember-data.
[+] [-] gfunk911|13 years ago|reply
[+] [-] benatkin|13 years ago|reply
[+] [-] aidos|13 years ago|reply
[+] [-] tberman|13 years ago|reply
No matter what framework you are using, if you are solving the problems that we are solving, you are going to end up with that code.
Now, that said, I agree that learning all of the frameworks out there is advantageous, but you can't assume that the code in the blog post is indicative of anything having to do with Backbone or any other framework.
[+] [-] trek|13 years ago|reply
[+] [-] marcelvr|13 years ago|reply
[+] [-] judofyr|13 years ago|reply
It's an "all or nothing"-solution. I couldn't care less about Stateful Single-Page Applications. I'll take a stateless, curlable, crawlable (remember Google?), old-style web site any time. Of course, some parts might require more dynamicness than other, and in that case it's lovely to jump to client side MVC. But it doesn't seem that Ember.js wants to play this game. Every time I look at Ember it seems that it wants to define the architecture of my application. Thank you very much, I like my stateless-ness very much!
[+] [-] Mc_Big_G|13 years ago|reply
Also, it's trivial to have some pieces of your app rendered by rails or whatever you're using server side.
We're using Ember to build the next generation of our product (a web app) and it has been an extremely pleasurable experience.
[+] [-] wycats|13 years ago|reply
I take it that all of your applications involve public content with minimal if any enhancements to logged in users?
[+] [-] erikbryn|13 years ago|reply
See the `rootElement` property of `Ember.Application`: http://docs.emberjs.com/#doc=Ember.Application&src=false
[+] [-] dchuk|13 years ago|reply
[+] [-] mehulkar|13 years ago|reply
[+] [-] railsjedi|13 years ago|reply
Ember really changes JS development in ways that the other frameworks don't even attempt. And in a way this hurts it in the perception of developers, since it more often than not is just tagged as "too complicated" or "too much to learn".
The more great articles like this, and I think there'll be a solid chance Ember catches on in a big way the same way Rails did. With 1.0rc, the tech seems to be solid enough now and it just needs a push on the other stuff (education, marketing, etc). And most importantly: some more successful Ember apps out in the wild (I'm working on that one).
[+] [-] MatthewPhillips|13 years ago|reply
[+] [-] drek|13 years ago|reply
[+] [-] Vekz|13 years ago|reply
[+] [-] tgriesser|13 years ago|reply
[1]: https://github.com/documentcloud/backbone/commit/3ae1af6df1b...
[+] [-] judofyr|13 years ago|reply
[1]: https://github.com/onsi/coccyx
[+] [-] programminggeek|13 years ago|reply
Also, I think single page apps have a place as part of a greater architecture, but not as the entire app. If I wanted an entire app everything to be JS, fine, use Ember or something like it, but most parts of the web don't need this and single page apps make the web a bit worse if not done correctly.
Single page apps are the new hotness, but once the fad is over and the newness wears off, they'll be fit into their proper place over time and won't take over the entire app.
[+] [-] wycats|13 years ago|reply
I'd appreciate it if you could quantify what you mean exactly by "magic". For example, one key difference between Ember and Knockout is that Ember's binding system automatically avoids triggering the same side-effect from multiple pieces of code.
For example, if you had a piece of the DOM that was calculated from several observables (the stupid example is a full name calculated from a salutation, first name and last name), and made changes to all three of those in separate lines of code (possibly in different areas of your codebase), Ember would ensure that the DOM only updated a single time, not three times. This is true no matter where the three lines of code are, without you needing to take any special action to coalesce the changes.
This aspect of Ember's codebase adds some magic, in that it introduces a higher-level abstraction that knows about computed properties and their side-effects (the "run loop"), but the end result is more predictable propagation of side-effects in an Ember application. Ember applications don't need to know about the specific mechanism that makes this work, but good Ember developers are aware that many side-effects happen asynchronously in an Ember application.
The browser does something similar when you make changes to DOM structures: it only updates the rendered version of the DOM once all of the JavaScript code handling an event has completed.
I would agree that something simpler would probably be a better fit for simple "islands of richness" on an existing application, but there are definitely a large number of applications with significant amounts of logic happening on the client side, even if those applications run inside of an area of a larger traditional page.
In general, I would say that Ember is a good fit for applications that will end up with more than 100k of application code. That sounds like a lot of code, but it's really only a lot of code for islands of richness. Applications like rdio, documentcloud, soundcloud and other popular Backbone applications can easily reach 500k or even a megabytes or two of code.
[+] [-] aidos|13 years ago|reply
In my case for example (photo portfolio websites) it makes a lot of sense to have a single page app for the user backend and plain server rendered html (with a bit of js sugar) for the frontend.
[+] [-] Vekz|13 years ago|reply
I feel that Backbone.js was first on the scene and hence has found its way into the current developer lexicon and toolset, leaving Ember.js unfairly looked over.
[+] [-] KaoruAoiShiho|13 years ago|reply
Ember.js is just too opinionated for its own good.
[+] [-] adolph|13 years ago|reply
Video: Beyond the DOM: Sane Structure for JS Apps: http://www.youtube.com/watch?v=cd7HHN6IkrU
[+] [-] aidos|13 years ago|reply
connnect -> connect
[+] [-] adamnemecek|13 years ago|reply
[+] [-] railsjedi|13 years ago|reply
[+] [-] davemo|13 years ago|reply
[1]: http://iwitness.adaptivepath.com
[2]: https://github.com/adaptivepath/iWitness
[+] [-] robotmay|13 years ago|reply
Frankly I'd take any example application over a to-do app at this point.
As an aside, I've been using Sammy.js (http://sammyjs.org) more than most of these other frameworks lately, as the effort involved is disproportionate to the rewards unless you're building the entire frontend in JavaScript. For any less-than-enormous project, you really don't need all that complexity.
[+] [-] bertomartin|13 years ago|reply
[+] [-] te_chris|13 years ago|reply
[+] [-] unknown|13 years ago|reply
[deleted]
[+] [-] throwa|13 years ago|reply
https://github.com/emberjs/ember.js/wiki/Production-Deployme...
[+] [-] shocks|13 years ago|reply
The font here really sucks, for me anyway. I cannot see the "cross" of the t. It just looks like an l. Anyone else see this?
[+] [-] leepfrog|13 years ago|reply
[+] [-] blktiger|13 years ago|reply
[+] [-] richardjordan|13 years ago|reply
[deleted]
[+] [-] inetsee|13 years ago|reply
[+] [-] tomdale|13 years ago|reply