Here's the good stuff:
A few years ago, I hacked up someone else's Perl script to write custom messages on HP printer LCDs. Today I found someone else's script to do the same thing in NodeJS so I hacked that one up too =)
Here's the good stuff:
What I found out was that I had actually been using classes for a while since Backbone is built on the concept. But actually understanding the application of the concept was a great help in advancing my understanding.
The short version (as I interpret it) is that with classes, a developer can write well-defined and scoped code and then make that well-written code available elsewhere in the application without re-writing it. As with most concepts in coding, actual code is often more helpful than textual descriptions, so I'd recommend looking at a blog article that John Resig wrote about this very topic and even shared a smallish bit of code to make it easy to use classes.
I thought this was pretty awesome and I immediately set about putting it to use in some code that I was working on at the time. At the moment, the most useful class that I've written is one that allows for simply inheriting the EventEmitter in NodeJS.
Using the 'class.extend' module, which is a copy/paste of Resig's code, I created this batch of code that I use as the parent for most of my other classes so that the resulting objects can emit and consume events.
With this pattern, I can write very focused classes and tie them together with something of an event bus where data is passed back and forth in an evented manner. Nesting callbacks is gone, but tracking event chains is in.
I've been developing an app that is strictly for the use of one guy and all it does is provide a graphical interface for the guy so that he doesn't have to learn how to interact with a Mongo database. This one user started complaining recently that the app is too plain, "There's not enough color on it," he says. "Can you put a tye-dyed background on it or something?"
"Sure," I say as I look for a picture of a TIE fighter exploding. A minute later I send the user a note saying, "Ok, it's got a TIE die background now."
The joke lasted for a day and he started complaining that the picture was too distracting. He asked that I remove the picture and expand the text boxes to fill the space that the picture was consuming.
"Ok," I said again. But this time, I modified a troll-face picture and stuck it in the background of each textarea in the app. It's pretty faint, so I doubt he'll notice it, but I get a kick out of it =)
In the course of my development, I've sometimes found it necessary to simulate delay or latency as I'm often requesting resources that are on my local development machine and I get response times that don't reflect the real world. To help create this simulated latency, I whipped together a simple little delay function that inserts random wait periods to better reflect what might happen in a production, publicly served web app.
A few days ago, I published my first NodeJS module, The Guvna!
It's intended to manage concurrency of a function and I'm pretty pleased with it. You can check it out on GitHub or you can get it via the command line:
npm install guvna
Here's a quick look under the hood:
Shortly after finding myself adrift in the sea of the intarwebs after Posterous shut down, I found harbor in Jux.com, which was cool and pretty, but it lacked a mobile app for android so it was kind of a pain.
Then Jux sent out a notice that it was shutting down too.
Granted, I'm only a few minutes into it, but dang! It's pretty sweet. And it has an app for Android! =)