Ready, get set, get get and set.

Last time I talked about tomatoes and the pomodoro technique in regards to time management. There wouldn’t be much need for time management without things to do and where to do them.

I found myself stumped yesterday while working on a legacy project which had used backbone.js as it’s underbelly. The main issue was accessing data and changing it based on the state of a listener. Normally I’d fall back to the old- this is that and that was this way of reassigning variables based on some condition, but in this case, there were already listeners in place waiting for my beck and call.

The question at hand was elementary, but I struggled through it nonetheless. What order of operations need to take place to change a value of an object in back bone? Do I get it, then set it, or do I set it with a ‘gotten’ value? We’ll cut off the fat and get to it:

With ‘set’ there are two ways of setting the value of object, both involve accessing the key and providing the new value you wish to overwrite the old.

let obj = {key: theValue};

using object syntax one can set the new value as such:


or alternatively, you can use the two argument method:

`this.set('key', thingIWantTheValueToBe);

get takes a sole argument:


I found the most challenging part finding where in the object the data you were trying to get was stored and accessing it, whether to ‘get’ it, or simply reassign it with ‘set’. In the end I found it is important not to be ‘dot-shy’ and use the console plenty with ‘this’ to dig down deep and find where the value you search is hiding.

Some parting code:

this.blogPost.set({status:'finished', message:'until next time!'});