published on in JavaScript
tags: nodejs php ruby

Why I love Node.js

Yes I know, Node.js is the new Hype but I think it’s more than a simple overrated thing. Few years ago I met Ruby and it was love at first sight. I felt it will be the new era of development. Yes it is but not what I was expecting. One year ago a met Node.js and I felt the same but it was not only inflammation, it’s a true love. I’m a programmer. I know a lot of languages and I specialised for PHP but it’s too limited and boring for me today. So I started to use that new-old language, Node.js. It’s new-old because I use JavaScript day by day but not as backend application.

I really hate when an uncatchable exception comes towards me in PHP and it’s more simple in ruby. With rescue statement I can catch exceptions. It’s nice but why I need to handle all the time the exceptions. Some times –like multi level handling– it’s hard to understand what happening and when. In JavaScript I don’t need to use try/catch because conventionally the first parameter of callback functions is the error. If the first parameter is null then there was no error otherwise we got an error.

Of course, it’s weird logic if you are trained on Java, PHP or something else but if you can understand you can feel its awesomeness.

I know… Why I need to use as a callback instead of a simple variable assignment. Because everything around you isn’t synchronous. Please read Francois Zaninotto’s article about Event-driven programming… and pasta because it’s a really good post about it.

Yeah, it’s a little cause to love Node.js more than other languages. When I meet a seemingly unsolvable problem in PHP then I get a ton of solutions but some of them works and a lot of them doesn’t. In Ruby I get less solutions but the working/non-working ratio is better. When I ask about my Node.js problem, I get a ton of solutions. Some of them points to an npm package (or more), some of them tells me I can do it simpler and some of them just works. So I feel… Node.js community is more valuable for me than PHP or Ruby.

When I need a ready to use package in PHP then I need to include a library and I need to check if it conflicts with my system –or used framework– and need to search how can I integrate that. In Ruby I can use Gem’s and it’s nice. An npm package is similar to a gem package but I think it’s more flexible.

And last but not least in line, I can write tests in JavaScript, I can write the backend codebase in JavaScript and I can write the frontend codebase in JavaScript. Yes it’s more confortable to use one language instead of two (or more).