javascript : prototype and __proto__

Note that __proto__ is a property of the instances, whereas prototype is a property of their constructor functions. Ref : Mozilla Developer Network
With that it may seem that we have another property, which we can use. But the reality is “__proto__” is a custom implementation and only available toGecko Javascript engines, which is used in Firefox.
A lot advice to use this only to study the “prototype” chain of javascript but not use it in any practical application. Here is a nice explanation about the two.
Now even, Mozilla is deprecating the “__proto__” and instead suggests to use “Object.getPrototypeOf”. Here John Resig explains the new property.

Hope that helps.

Category and Inheritance on ObjectiveC

While Category is a nice way to add functionality to the base class, people like me who come from other object oriented technology such as Flash, will find a little difficult to understand as to how this thing relates to the inheritance chain. The same question came up to my mind and I did a quick research on the topic.

The final thing is Category does the same thing as it tells about itself. It adds functionality to the base class. If you remember this, then there would be no confusion at all.

Well, for that to understand, lets take an example. Suppose there is a Class A and Class B is a subclass of Class A. In the application Class B is used in a lot of places. Now, there is a need to add some more functionality to Class A, so a new category is written as “A+newRole”. Once this category is written, the new functionality is added to the base class and in this case, Class A. That means, all those classes which are child classes of Class A such as Class B, automatically gets the functionality. Thats freaking cool. One can straight away go ahead and call the new methods added in the Category from the child classes. The only thing necessary here is to import the Category file to the appropriate place.