I’m sure you noticed that I have been a bit distant lately. Our relationship hasn’t been functioning as well as it used to and I don’t know which one of us is to blame.
I’m in the process of converting a web application from an Apache + PHP backend to Node.js. The application being converted is based heavily around real time interaction between users, so, it was a natural fit for WebSockets.
In fact the old application used a Node.js backend for WebSockets, but an Apache + PHP backend for everything else, including page generation and AJAX endpoints. This means every AJAX driven form had a PHP endpoint which performed a desired action and a WebSocket event listener waiting to broadcast the event to other users.
Having to recode this application from the ground up in a new asynchronous language presented an interesting question to me.
Why should I use AJAX when I have WebSockets?
One of the biggest hangups I had when starting to program was deciding what technology to use. At the time I was only writing server side code and was working in shared hosting, so my options were limited to various versions of PHP.
Within the last year I started using cloud hosting and thus gained the ability to configure my servers to use any language I wanted. Shortly after realizing this a small amount of fear came over me. The choice of language wasn’t made for me anymore, I would have to pick from a giant pool of languages. I would also be spending at least three months learning all about this language I picked before I would feel secure in it. After that three months I might not like it and would have wasted three months of my life.
At the time I was doing a lot of freelance and was instructor at a college teaching web development. Because I was teaching I wanted to know the basics of all the languages I could use on the server, just in case my students asked me about them.
I knew the basics of most of these languages but I had never written anything substantial in them. So, over one long weekend I locked myself in a room and started writing hello world, testing frameworks, making CRUD, overall building projects in every language and every framework I could get my hands on.
Four days later here are the four things I learned.