Reading this ‘this’-free code makes me think of lexical scoping. Behaviors may grow complex, but understanding any particular layer requires only looking at the code immediate to it.
Anyone have experience debugging such code? Obviously, the object inspector is not of much help (or can they inspect closures now?)
Of course there are some cases where this approach is more appropriate e.g. mixins
A small, but powerful cognitive trick we use is to start each file with :
var context = this;
This simple change does wonders when reasoning about the meaning of ‘this.’ I know the idea of ‘this’ comes from Java and other OO languages, but maybe all the trouble simply stems from bad naming of this important variable.