Popular Posts

Tuesday, March 22, 2011

"i'm used to writing async code already and this is all neatly tied to the posix layer, which makes non-blocking network stuff ridiculously easy. there's also the package system (npm), async test suites, no worries about messing up the global namespace, etc. you gotta OOP tho if you just throw literals around you can't have or protect a local scope"

Javascript (node.js) http://nodejs.org/ review:


  • downside, requires libssl-dev (fixed with -no-ssl)
  • install with “git clone https://github.com/joyent/node” (ryan is now joyent)

Use Prototype Programming, Delegation.
prototype based programming -http://coweb.cc.gatech.edu/cs2340/4288
// Example of true prototypal inheritance style in JavaScript.
// "ex nihilo" object creation employing the literal object notation {}.
var foo = {one: 1, two: 2};
// Another "ex nihilo" object.
var bar = {three: 3};
// Gecko and Webkit JavaScript engines can directly
// manipulate the internal prototype link.
// For the sake of simplicity, let's just pretend
// that the following line works regardless of the
// engine used:
bar.__proto__ = foo; // foo is now the parent of bar.
// If we try to access foo's properties from bar
// from now on, we'll succeed.
bar.one // Resolves to 1.
// The child object's properties are also accessible.
bar.three // Resolves to 3.
Don’t bother with Normal OOP. tho you can :
  • http://msdn.microsoft.com/en-us/magazine/cc163419.aspx
  • http://en.wikipedia.org/wiki/Prototype_based_programming
  • delegation http://en.wikipedia.org/wiki/Delegation_%28programming%29
  • http://www.w3schools.com/JS/js_intro.asp (javascript)
  • http://nodejs.org/docs/v0.4.1/api/all.html#__filename (node api)
operator overloading (not supported, this spec is fake)

node examples:
https://github.com/nodejitsu/nexpect/blob/master/demo.js (uses spawned procs)

“DOn’t bother with OOP, just learn the DOM”

look at the GOOG custom search API, it’s in JSON:

No comments:

Post a Comment