Over the years I’ve experimented with many techniques for both class-based and prototype-based inheritance in Javascript. However, the fallout from the Browser Wars coupled with the lack of awareness of prototype-based languages both in and out of the Javascript community together with my background/interest in larger system issues, caused me to shift my focus in 1999 to the ends rather than the means. I was consulting with Web Crossing on using Javascript for their server-side scripting which ultimately led to the development of Community Catalyst. From the server-side, my focus was on community/social network related objects rather than the DOM and built-in language objects.
While most of today’s libraries do some interesting and useful things, fact is if you “define” enough conventions and/or exploit the powerful features lurking under the hood of of the language, you can twist and contort Javascript into doing just about anything. This is both a strength and weakness of the language - it makes it easy to pursue evolutionary paths but at the same time leads to many dead end paths. In future episodes in this saga I’ll explore the evolutionary river Javascript is sailing down in the context of Morphtron and the stack of capabilities it supports. In the meantime, given that prototypes are inherently intertwined with the creation of objects, I thought it would be interesting and valuable for folk to take a closer look at how Javascript objects get made. Doug Crockford and others have in the past few years really provided useful code and clear explanations in this regard so I won’t attempt to reinvent the wheel. What I want to point out is how important it is to understand the facilities currently at one’s disposal - especially given the controversy over Javascript 2.0. As the universe of Javascript grows understanding how to avoid conflicts with other objects becomes more and more essential. The following links should help clarify private members and their uses:
Private Static Members In Javascript
Encapsulate Your Javascript: Keep Private Methods Private
How to achieve private, public and privileged members in Javascript
Post a Comment