Darwin Among the Prototypes II: Private Members

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 members

Private Static Members In Javascript

Encapsulate Your Javascript: Keep Private Methods Private

How to achieve private, public and privileged members in Javascript

Private Instance Variables With Prototypal Inheritance

Private Javascript

A Javascript Module Pattern

Prototypal inheritance

ECMAScript
Resources

Comments (0)

Permalink

Darwin Among the Prototypes

During the course of evaluating the various currently popular Javascript toolkits - YUI, Prototype, JQuery, Dojo, Extjs and TIBCO GI as well as the language itself - ECMAScript 4(ActionScript 3, Javascript 2.0), it’s been interesting to observe the evolution of object creation. The name of this blog is a reflection of my early embrace of the language at a time when most people didn’t think it was object-oriented. It was precisely because of my interest in prototypes that I found Javascript appealing! The name of this entry is taken from a post on my Squeak blog that traces my history of exploring prototype-based programming. One thing that most of these toolkits have in common is some kind of support for class-like objects. This is important because

Programs contain many objects. Way too many to make each of them by hand. Objects need to be mass-produced. There are basically two ways of mass producing objects.

  • The industrial way - building factory objects that build other objects.
  • The biological way - building prototype objects that can be cloned.

Prototype-based Ruby 

Javascript is at an interesting stage in it’s evolution now and it will be interesting to see how the toolkits evolve with the language. For now, I’m focusing on YUI and looking closely at Prototype because of it’s use in Lively Kernel and Extjs because of it’s symbiosis with AIR and Aptana.

Related Links

Brendan’s Roadmap Updates: Javascript 2 and the Open Web

Ajaxian: Brendan Eich Javascript 2 Evolution

Make It Up As You Go: Broad Comparison Chart

Beyond Feature Comparisions

Prototype, Dojo, YUI, JQuery Comparison(Fall 2007)

Ajaxian Roundup Nov 2007

JS OO Ruby style

Chris Norton: First Impressions of ExtJS

Javascript Library World Cup(Prototype, Dojo, YUI, Mochikit - Summer 2006)

Javascript Library Loading Speeds(John Resiq of JQuery)

AJAX

Comments (1)

Permalink

Lively Kernel @ Google Tech Talks

Dan Ingalls did an hour long(demo, slides, Q&A) tech talk at Google last month that was very informative on a number of levels. Even if you are already familar with the basics of the Sun Lively Kernel project, it’s worthwhile but if you haven’t seen it, there’s nothing like getting it from the horses mouth.


The Q&A was very interesting - So many people seem to miss the simple albeit very subtle value of a clean architecture. In the fast-moving world of the web, it’s been hard for many to see that when you blindly rush ahead focused only on getting stuff done now, you inevitably create messy situations from which you later have to dig out from under. As I’ve noted before wrt AJAX, the long path taken to Web 2.0 was considerably longer than it had to be. The seeds of REST & AJAX were in HTTP-NG over a decade ago if folk had been open to listening. OTOH, if one wants the cleaner approaches to get better traction, sooner then it’s necessary to make sure that the less interesting but vital work gets done earlier on in the process. Which reminds me - time to get back to coding :-)

FreeDOM
Lively
Morphtron

Comments (1)

Permalink

Index To The Lively Kernel Tutorial

The Lively Kernel Tutorial has quite a few pages which I’d like to return to so I made up a quick index linking to each one. Continue Reading »

Lively

Comments (0)

Permalink

CouchDB

CouchDB the incredibly cool distributed non-relational database that stores data in JSON format and uses Javascript for queries is a significant component in the FUNK ecosystem. I recently saw this Helma post listing code for CouchDB but this well-documented, step-by-step example looks more generic.

FUNK

Comments (0)

Permalink

Towards A Universal Scripting Language

With AJAX/RIA moving beyond the browser with things like AIR and lower level capabilities expanding with JSON, SQLite, XMPP et al, all we need now is real 3D! Well, as Russell Beattie notes

I think we’re moving in that direction, already, no? I just want it to move faster!

AIR
AJAX
Server-Side

Comments (0)

Permalink

Server-Side JS

Since recently stumbling upon POW - the incredible Plain Old Webserver plugin for Firefox, I’ve been looking at Server-Side Javascript implementations. Here are some rambling thoughts.

Jaxer from Aptana is a full featured AJAX server that’s integrated with the Aptana IDE - WOW! If they find a way to make hosting for this cheap and easy to set up it’s going to be a barn burner. Until then though, Jaxer provides a next level of capability beyond POW wrt turning your pc into a powerful peer. As exciting as POW is, running under Firefox there’s no way to get really good uptime under the best of circumstances and I wouldn’t be shocked to find it chewing up huge amounts of memory if left running for extended periods.

AppJet is an interesting hosted service but it’s not clear what their business model will be going forward.

Looking at all this good stuff had me feeling like I really need to get to Part 2 of AJAX and the New Web: Back to the Future Again but then I came across this great cartoon - The Development Circle of Life which gives me til 2010 - LOL :-)

Aptana
New
Server-Side

Comments (0)

Permalink

O’Reilly AIR Book Available Online

 Adobe Integrated Runtime for Javascript Developers

via Dan Shafer

AIR

Comments (0)

Permalink

Back To Aptana

I got a small performance boost on my main machine and decided to load Aptana to see if I could tell the difference. Although eventually I’ll just have to get more RAM, Aptana now feels responsive enough for regular use. I’m also now after two weeks pretty comfortable with the AIR environment so I’m taking Aptana off the back burner. It’s also been updated to support ExtJS directly. If you’re a Mac person and are interested in a free performance boost read on.

Continue Reading »

Aptana

Comments (1)

Permalink

ECMAScript 4 As The Next Big Language

Not A Doubt In My Mind 

ECMAScript

Comments (0)

Permalink

FireStats iconPowered by FireStats