Creating a Multi-Language, Serverless Chat Program - Part 1: Protocol Design
Written By: Nathan Baker
- 11 Aug 2006 -
Description: In order to explore how different languages approach GUI programming, network sockets, and object-oriented concepts, we will embark on a journey in creating a serverless chat protocol, and clients for it in many different languages. This is the first installment, where I describe the protocol and the project.
Introduction
It can be hard sometimes to choose a programming language for a project. Do I want the performance and complexity of C? The cross-platform benefits of Java? The elegance and fast development cycle of Ruby? Or maybe just the quick-n-dirty utility of a shell script. This choice is one of the most important ones you can make for your project, since changing your mind will require a rewrite of all your code. It can also affect issues such as how easy it is to port your program to a different operating system or architecture, how hard it is to maintain your code, and what sort of memory footprint and CPU usage your users will see at runtime.
But before you can choose a language, you have to be familiar with that language. You have to know its strengths and weaknesses, its particular idioms, and the ways it tries to make your job easier (or inadvertently makes your job harder). As a developer, it is important that you know a variety of languages and can choose the best one for the job. Also, sometimes you won't have a choice, and knowing the language that has already been decided on for a project may make the difference in getting that nice job or lucrative contract. And if those in charge have chosen poorly, maybe you can impress management by giving a clearly-reasoned presentation as to why your choice is better. If they accept your proposal, they'll remember you and you'll be on your way to that cushy Senior Software Architect position you've always wanted. If they reject your proposal, you can quit and make a competing product in the language of your choice, get rich, buy out your former employer, fire the person who refused to change the project language, and then retire and live a life of ease on a tropical island. So, as you can see, knowing many languages will get you very far in life (results not guaranteed. Must be 18 or older to enter. No purchase necessary, void where prohibited).
In order to help you on your way to fame and fortune, I am starting a new long-running series. In this series, we will design a serverless chat protocol--think IRC, but without the need for a computer to run the IRC server. If that wasn't cool enough, we will implement this protocol in several different languages, illustrating the pros and cons of each as we go. For each installment, I will first design a programming model that fits the particular characteristics of the language we are using. Then I will discuss the actual implementation of the client in code. Finally, I will talk about maintainability and how easy (or hard) it is to modify the code later on--this will help us evaluate both the programming language and the architecture we chose.
This first part is not addressed towards any language, but instead describes the protocol and what the program will do. I know this isn't as cool as programming, but design is very important for a large project, especially one with a specified protocol. So if this sounds like fun, then feel free to hang on for the ride! If not, well, why are you still reading? Onward!