Archive for October, 2011

Common Backbone errors and what they mean.

Posted on October 22nd, 2011 in backbone | 16 Comments »

I’m a big fan of Backbone, the open-source JavaScript MVC framework. It’s lightweight, extendable, has an awesome event model that allows one to bind to changes from just about anything – it’s error messages, however, can be quite cryptic. Simply referencing a missing template file can lead to half an hour of wasted time tracking down the issue. Without further ado here’s a quick list of the day-to-day errors I occasionally encounter and what the problem ended up being:

TypeError: ‘undefined’ is not a function (evaluating ‘func.apply(obj, args.concat(’)

You probably created an event listener in view that binded to a function that doesn’t exist.

invalid ‘in’ operand attrs

You probably passed a string instead of an object to a Model.set. This frequently happens to me during an ajax callback using jQuery – for some reason Webkit browser return and object while Firefox returns a string.

Uncaught TypeError: Cannot call method ‘replace’ of null (underscore.js:768)

You’re calling an underscore template put not passing in the data it uses in the template. You’re referencing an underscore template that doesn’t exist. You could have created a new template but forgot to change it’s id.

TypeError: ‘undefined’ is not an object (evaluating ‘func.bind’)

You probably set a _bind or _bindAll in your view initiailize code and that method doesn’t exist in this view. Double check for a typo.

TypeError: ‘null’ is not an object (evaluating ‘func.bind’)

In your view you could be binding an event to a callback that got overwritten during initialization. Commen when your model is called “contact” and your model is called the same and gets passed in.

TypeError: ‘undefined’ is not a function (evaluating ‘this._configure(options || {})’) backbone.js #881

Something went wrong in the routing. You may have not instantiated a new view.

Uncaught TypeError: Cannot call method ‘extend’ of undefined (yourfile.js)

Your probably extending an object that extended a backbone object, but the reference to the object is wrong or missing.

Uncaught SyntaxError: Unexpected identifier (underscore.js:782)

Your template logic might have an error in it. Check that you closed open parens and such.

If you’ve experienced a Backbone error that’s not on the list, feel free to post it in the comments.

Response Times: The 3 Important Limits

Posted on October 22nd, 2011 in General Web Dev | No Comments »

Regardless of new technology and devices the basic advice regarding (perceived) response time has been the same for forty years in counting. I find that I’m always having to google around to find this link when the subject pops up so I’ll post the basics here, and link to the rest if you’re interested in reading more.

  • 0.1 second is about the limit for having the user feel that the system is reacting instantaneously, meaning that no special feedback is necessary except to display the result.
  • 1.0 second is about the limit for the user’s flow of thought to stay uninterrupted, even though the user will notice the delay. Normally, no special feedback is necessary during delays of more than 0.1 but less than 1.0 second, but the user does lose the feeling of operating directly on the data.
  • 10 seconds is about the limit for keeping the user’s attention focused on the dialogue. For longer delays, users will want to perform other tasks while waiting for the computer to finish, so they should be given feedback indicating when the computer expects to be done. Feedback during the delay is especially important if the response time is likely to be highly variable, since users will then not know what to expect.

From the book Usability Engineering (1993). More info here.