Gut Reaction

I’ve always preferred working on the backend of applications, especially web apps. This stems from my lack of confidence in trying to make functional, and pretty, interfaces. This had lead to, by proxy, a strong dislike of JavaScript. Over time I had come to dislike it less, especially with things like jQuery to make the DOM less painful to work with.

This recently changed when I started using Node for little projects here and there. It gave me access to the reactor pattern without having to convolute the syntax of a language I like, such as what Twisted does to Python. It took me a couple weeks to find a project that I could start using Node for, the answer was an IRC bot that I have named ZenIRCBot.

The design of this bot takes the reactor pattern to heart. Using an asynchronous IRC library called node-irc to connect and manage its IRC session it connects and provides me with various events I can listen for and react to. But that is just the core bot, it just takes whatever messages it sees and puts them in a Redis pub/sub channel.

This allows the core bot to remain very simple and just implement a protocol that I have come up with. Then I have services that implement the protocol as well but run as separate processes. This allows me to add or remove functionality to the bot without ever having to log the bot out or restart it. This makes development of services rather rapid as I can write the service, start it, test it, edit it, restart it, and not have to wait for the time it takes the bot to do a full connection.

This also leads to the ability to write services (or in as Eric Holscher did, the core bot) in any language, as long as it implements the protocol. Letting anyone who knows at least one programing language that is listed on this list or can implement a Redis client for the language they are using, can use and contribute to this bot.

The end result of all of this is that I have a new found like for JavaScript, and got better at some skills like using the reactor pattern. If you haven’t tried Node out, I strongly suggest you go play with it, maybe write a service or two for my bot while you’re at it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s