In my previous article I showed the differences between scope and context, basic problems that arise and how to fix them. If you are just using some JavaScript and maybe jQuery, an understanding of scope is all that is needed to get you by. Once you start using objects or namespaces however, you’ll start to run into issues with context and will need to use the keyword this. But when you get into object oriented JavaScript, you’ll need an advanced understanding of context and how to make it work for you. To do this, we’ll use the call() and apply() methods, and then a backwards compatible version of the new feature Mozilla recently released in JavaScript 1.8.5 called bind().

(more…)
Archive for the ‘original content’ Category
JavaScript Context, Call and Bind – Ninja Level
Monday, December 5th, 2011JavaScript Scope and Context – Not the Same Thing!
Tuesday, November 29th, 2011In forums and other places I often see people incorrectly use the term scope when they should be using the term context. Scope applies to the variable and functional access of a function, whereas context is the property and method access of a function. Essentially, scope is function-based, and context is object-based.

(more…)
Don’t Ask the Client for the Answer
Monday, November 21st, 2011When reading the title of this article you may immediately think that it seems obvious. You’re the commissioned expert, why would you be asking the client how to do your job? That’s precisely the point; I’m giving you the answer and not the problem. When given a solution the natural tendency is to take the easy way and simply… implement it. But what is the problem you’re addressing? And is that the right solution? Will it work? How would you even know? So maybe, it’s not so obvious. In fact I would argue that being provided the solution is much more common than being told the problem.

(more…)
Building Web Applications with MDV
Wednesday, November 2nd, 2011MDV or “model-driven views”, eschews the concept of widgets in favor of template-based views which are behavior-based and update themselves when the data has changed.
Max Motovilov gave a presentation on MDV which was enlightening and thought provoking. He showed how he leveraged The Dojo Toolkit to create behaviors and data stores which update his views through his custom-built template system.
Max’s detailed presentation can be seen here, and you can also see the examples he used on GitHub.
Simple and Easy JavaScript Inheritance
Tuesday, June 14th, 2011For object inheritance, I had been using the traditional method of assigning methods and properties to the function’s prototype. Because my project was relatively simple, I could get away with this for a while. But as the project grew in scope, using the prototype started proving unwieldy. It worked, but the code was getting messy and hard to read. I decided it was time to implement an inheritance system. Not too complex, just something to help me organize my code. I ended up creating what I call my Declare Inheritance Helper.

(more…)
Video: A Conversation About REST
Tuesday, April 12th, 2011“Nobody implements REST correctly”, said Dr. Roy Fielding, the inventor of REST.
But Jeremy Brown will help you get close. He explains what REST is and also presents a variety of topics and questions you will certainly come across while implementing your API.
Video: Database Query with a drag-drop UI
Monday, April 11th, 2011Marvin Elder demonstrates his DHTMLX enabled interface that does database queries via a user interface.
RESTful Web Services and Weed Trimmers
Tuesday, April 5th, 2011By guest author Donald Smith Jr.

I was standing in the local home improvement store staring at all of the choices available for yard trimmers. Since it is spring, the annual tradition of assessing my lawn equipment needs for the season has me frustrated that it is the year 2011 and the technology available to cut weeds still sucks. My problem is that I have bought many yard trimmers over the years including gas, cordless, and corded trimmers. Each one has advantages and disadvantages.
Brendan Eich Redesigns JavaScript to Look Like jQuery
Friday, April 1st, 2011
“Obviously, due to the success of jQuery and the lack of base-knowledge of JavaScript”, Brendan explained at a recent gathering, “JavaScript is a huge failure. I’ve redesigned it to look like jQuery, and will implement it, retroactively, into the web.” (more…)
HTML5 Grows up and gets a Logo
Tuesday, January 18th, 2011
The W3C revealed the new HTML5 logo designed by Ocupop, a design firm in Hawaii that looks to me listens to too much Jack Johnson… (more…)



