Initial Impression

When I first read about node.js I thought, “you’ve got to be kidding me. Javascript is slow and user-interface-oriented. The only reason you’d use it on the server is because you don’t know any other languages.” And I moved on.

Recommendation from a Friend

The next time I heard about it, my friend Derek Andriesian said he was using node for some of his applications. I knew Derek had experience in PHP, Ruby, and other languages, so I asked a little more why he would go with Javascript. Apparently Derek liked the event model it used. He said it was pretty cool controlling the flow of the request as it came in and went through the system. He also said to use express.js, an HTTP server for node. I still didn’t touch it.

Javascript Inundation

At my day job I started doing Javascript, client side, a lot. It became my daily grind. But I had been working in ActionScript for so long, not having proper class syntax (my opinion), packages, and imports was a major stumbling block. I had managed to get a very large jquery file, and even after breaking it apart into multiple files organized by app section, it was very hard to make changes to anything, and to share data across the sections. I needed more organization. I separated out much of the data code and more of the jquery code, but then I had a problem of having more than 20 Javascript files to deal with, then 30, then more, and ensuring they were in the correct order, and updating my build script whenever I added on, and tweaking the script when I got the new file in the wrong location. Dependency management would be really nice at this point. I found CommonJS, a standards body for dealing with more complex Javascript. They had a standard around “modules” for Javascript. I implemented it and built a build script that traversed the require statements and pulled everything into one script. Things were much better.

“Getting” Node.js

After that, I looked into node more. I knew how modules worked from my client-side journey. And I “got” what node.js is all about. Node is about handling many connections at once, without dealing with threads. Node is about simplicity for simple servers, and flexibility for complex ones. In node, I can return the results of a web request to the client and then continue to run some code (such as sending an email or logging information that isn’t important to the result). I can use function closures to hold data for connections when using websockets or regular sockets. Node isn’t just Javascript on the server for people who don’t know other languages. It’s a different paradigm for programming server-side applications. And

it’s actually pretty fast, for Javascript, because it uses some of the most advanced run-time technology around with Google’s V8 engine.

It’s Just Fun

It’s just been fun to develop in node. There are a ton of libraries available and more coming all the time. Creating REST APIs is a breeze with express.js. There is a lot of excitement and activity around node (some may call it hype, but whatever it is, it’s furthering the platform). There are some who are vehemently against node, but I haven’t read anything from anyone that was accurate and a good reason for not using node. If you’re a poor programmer, you’ll write poor programs in node same as in PHP. It isn’t a magic bullet. But if you can write code, node is a lot of fun. I also feel my code is easier to change and read, but I’ve also been writing heavy Javascript for 2 years now, so take it with a grain. Getting Started There are plenty of guides and tutorials on getting started. Be sure to check out npm too if you don’t manage to come across it in the basic guides, the node module package manager (like ruby’s gems). After than you can check out express.js a great web server for building apps and REST APIs, node.js cluster which launches several processes for each processor core to maximize performance, Socket.io that gives you websockets (or alternatives for browsers that don’t support) for realtime data streaming, Redis a key-value store which node devs seem to like a lot, and mongodb a document database which also seems to be very popular for node.js users. CouchDB and Riak are also two databases that work well with node because of their Javascript orientation. And elasticsearch is a nice search service that works well via a REST API.

This has little to do with you post, although I found it quite interesting.

I want to thank you for your development of the javascript php date function, it’s such a handy little script, especially when developing javascript/php applications that require passing of dates between the two languages.

This truely should be a javscript inbuilt function!
I don’t now how you would go about that, but it would be the perfect addition to the language since quite frankly, javascript current date functions are crap.