32 karma · joined March 28, 2011
http://www.linkedin.com/in/daniellamb
[ my public key: https://keybase.io/daniellamb; my proof: https://keybase.io/daniellamb/sigs/NTfD3BXKOmdq_TzXtWdijidndb-Ojv0adW5XFPXCMsM ]
There are a several factors that will help you decide whether or not to use AngularJS. In my opinion it's not so much how complex the user interface is, although that is certainly relevant. The first thing to consider is where you want to put your application logic, server-side or client-side. The more things you want to push down to the client, the more likely AngularJS will better fit your needs. Are you creating a single page application where url-to-resource routing is done in JavaScript, or will that be handled server-side? Will you be merging data with templates on the server, on the client, or both? I suggest you look at the "too long; didn't read" chart in the article, and see if you need the features AngularJS provides. How important is it to you that your client-side code is testable? While it is possible to unit test jQuery code, the way most developers write nested callbacks tightly coupled to event handlers, does not lend itself easily to isolated testing. Finally, you need to decide if your team wants to embrace the declarative style of application development advocated by AngularJS. Such as using the directive ng-click vs. $(elm).click(). This will most likely require a change in mindset, and should be carefully weighed.
This is especially nice because you don't need to add any special if statements to the module code you just load your module under test using rewire instead of require.
// file: test-stats-rewire.js
var rewire = require('rewire');
var assert = require('assert');
var stats = rewire('./stats');
// leak private method sum for testing
var sum = stats.__get__('sum');
assert.equal(sum([1]), 1);
assert.equal(sum([1, 2, 3]), 6);
- JavaScript Patterns by Stoyan Stefanov
- High Performance JavaScript by Nicholas C. Zakas
- High Performance Web Sites by Steve Souders
- Even Faster Web Sites by Steve Souders
Here are a few I haven't read yet but are on my to read list. - Object-Oriented JavaScript by Stoyan Stefanov
- Pro JavaScript Design Patterns by Dustin Diaz, Ross Harmes