Showing posts with label bestpractices. Show all posts
Showing posts with label bestpractices. Show all posts

Sunday, November 29, 2009

People Who Care And Share


Thankful*
Originally uploaded by zenera

It's wonderful that people care enough to share. People care about the gifts they have and share the fruits of their gift with the world.

From the software world, this can lead to books such as Clean Code by Uncle Bob Martin. From Flickr, it can be zenera who posts wonderful photos and shares them freely.

Thank you all. I am grateful.

Saturday, September 19, 2009

Be Privileged And Skip JavaScript's Prototype

Reading Pro JavaScript's second chapter "Object-Oriented JavaScript" reminded me that I do not use the prototype property to add public methods to a JavaScript object. I use "Privileged Methods" (pg 36) instead.

In the book, John refers to Douglas Crockford's JavaScript site and the Privileged technique described in the web page titled Private Members in JavaScript. I quote from the web page:
"A privileged method is able to access the private variables and methods, and is itself accessible to the public methods and the outside."

If you are looking for more code examples beyond what Douglas Crockford provides, Quizzpot shows more code examples at Private and privileged methods in JavaScript

Using Privileged Methods is a great technique when coding JavaScript objects. Have fun doing it.