archive.php
Monthly Archives: February 2012
loop.php
Classical Inheritance in JavaScript
Notes for an upcoming discussion. With some work, JavaScript can be used in an Object-Oriented design pattern similar to Java or C++. This can be a good thing, with programmers who are familiar with these languages moving to JavaScript for the first time. Setting aside the discussion on which inheritance pattern — prototypal or classical [...]
Nettuts+ Promises Tutorial
A new tutorial posted on Nettuts with the most clear explanation of the Promises Design Pattern that I have encountered so far. Understanding Promises Trevor Burnham on Feb 22nd 2012 A Promise is an object that represents a one-time event, typically the outcome of an async task like an AJAX call. At first, a Promise [...]
JavaScript Prototypal Inheritance
In this example of prototypal inheritance, we are creating a Bug prototype. It serves as a base to provide properties and methods that all bugs share. Then we will instantiate new instances of the Bug prototype for specific implementations. var clone = function(o) { function F(){} F.prototype = o; return new F; }; // Our [...]
Bricss – Simple responsive design test page
I was completely excited when I saw this post. A responsive design test page. Make sure to check out the links at the end of the article to the bookmarklets that have been generated around this idea. Very handy little tool that will be part of my tool kit going forward. Bricss – Simple responsive [...]
Primitives vs. Constructed Objects in JavaScript
A user asked me a question in a recent training session. Can you use a constructor to create primitives? In other words: var x = new Boolean(false); I thought about it, and answered, “Sure. But why?” I mean, we aren’t programming in Java here. This type of constructor is also dangerous. // Don’t do this [...]