Getting the stuff later.
Aaron's got a great post that's kind of about teaching yourself new programming tricks and identifying old ones. His example is about callbacks (a programming pattern) which he's being more careful about using these days. We're using them often over in our corner. (This corner in question holds Mihai and myself for sure.)In regards to making asynch requests for information I still find the following pretty elegant:
Obj.prototype.Foo = function() { // get necessary stuff ... if (iDontHaveTheStuff) { var self = this; getStuff(function() {self.Foo();}); return; } // do something with the stuff... }But I like Aaron's point about the tradeoff of spread-of-logic for cleaner and easier to understand interfaces. The kid is teh smart and I'm gonna think harder about how these patterns can be improved.
Speaking of teh smart ... if you're a Javascript junkie and you're not reading Continuing Intermittent Incoherency (by Alex Russell of Dojo fame), well, why not start? I think you really should - it's great. I highly recommend it for the fun times and debauchery.
Debauchery's relative. You know, term-wise.
0 Comments:
Post a Comment