@ming From a practical standpoint, I'm confident you have the requisite skills to hone your OO JavaScript skills. I mean, you already know the fundamentals and that's very important! You're probably not trying to write the next jQuery, but what you do want is a chance to move away from the procedural mess that many of us make of our JavaScript code.
Well, here's a practical example from a non-flash dashboard speedometer gauge written with Plain Old JavaScript Objects (POJOs) for its domain model, jQuery for its service layer and Raphael for SVG image manipulation. Download the example for further study and details. For simplicity sake, I'll focus on the Domain Model, since my gut tells me that's what you're interested in.
Take for example a domain model consisting of a Speedometer, Fuel Gauge and Temperature Gauge. Each have something in common. Namely, they are all derived from a gauge. So, each will have a Gauge base class. This should set the scene:
Constructor
Speedometer = function (gaugeID) {
//[State]
var mph;
//[Initialization]
this.SetGaugeID(gaugeID);
this.CreateGauge();
this.SetMPH(0); //initialize control
}
Inherit base functionality from Base Class (Gauge)
//Inherit gauge functionality
Speedometer.prototype = new Gauge();
Do pay close attention to how the base class was inherited. This is called prototypical inheritance. It's a little different from classical class based inheritance. But, not so different as to bar you from structuring your code in a DRY way.
Add some Properties (Accessors)
//[Properties]
Speedometer.prototype.SetMPH = function(mph) {
this.mph = mph;
}
Put some Methods to "work" for the Speedometer class
//[Methods]
Speedometer.prototype.Accelerate = function() {
//Do some work here...
}
Now for the fun part. We so deliciously put together our Speedometer class. Now, let's take it for a spin:
//Create new speedometer gauge instance
var speedGauge = new Speedometer("speedometer");
//Warm up your engine
speedGauge.SetMPH(5);
//Time to put the pedal to the metal
speedGauge.Accelerate();
Well, hope this gives you an idea of one possible way to structure your JavaScript code. As you can see, you already have the basics. You just need to learn to love prototypical inheritance and you're good-to-go.