← archive

Rubyist's view on Node JS

August 15, 2014

I've been a Ruby developer for some time, but I'm recently getting pulled into the vortex of streams and modules called Node.js.

I might not come back and if that happens, here are some reasons.

I want programming computers to be like coloring with crayons and playing with duplo blocks.

Ryan Dahl - creator of Node.js

404 hype not found

There is little to say about this, after these great blog posts by Giles Bowkett.

I've found that in order to become better programmer, I need to have open mind for things I haven't tried yet. I need to experiment.

By having more experiences with weird, unexplored stuff I become better. Hype has a negative connotation for me, so it's here to prevent me from that - therefore it's not desirable.

I try to pretend hype doesn't exist, as I gain nothing from it.

Modules all the way down

GNU/Linux is an operating system I've been using a lot and I really like all the philosophy behind it. Node was inspired by Unix, but mostly with these two rules:

  • Rule of Modularity: Write simple parts connected by clean interfaces.
  • Rule of Composition: Design programs to be connected to other programs.

Ryan Dahl's quote above is just a playful rephrasing of these rules. That's basically a Node's mantra and it's even more evident if you browse around on npm a little or when you read the source code of some libraries written by prominent Node people. It feels like they use a lot more requires than we do, in the Ruby land.

The modules are also very minimalistic and they tend to be single-purpose libraries, which leads to this look of dependency graphs, representing the structure of Node ecosystem.

There are some attempts to achieve the same in Ruby, of which microrb.com is the most evident one. It isn't very popular at the moment, but I'm hoping it will be in the future, as Rails starts getting more competitors like Lotus. Yes, it needs more competitors. Rails currently thinks it's alone in the kingdom and I would like to see some changes with that.

Community

I'm under impression that Node people are much more relaxed about computers and rules than Ruby people. Maybe I'm exaggerating a bit, but Dominic Tarr reminds me of Why the lucky stiff. Maybe it's just because they're both disguised, I'm not sure.

There isn't much obsession with TDD/BDD/DDD in the Node land and that is a great thing. We are programmers, god dammnit - we shouldn't be obsessed with things. We should be allowed to break them!

I'm under impression that there's a lot less drama around everything here, everything feels more laid back. No one will dramatize if you write a Unix tool like sed or awk in Node. Do whatever you want, we don't care. After being a Rails developer for some time, this feels very refreshing.

Gems vs modules

Since there are a lot of mad scientists in the kingdom of Node, it's common to stumble upon things with bugs and even unmaintained things. I think this is where Node community needs to learn from Ruby community, where you'll find so many awesome people dedicated to maintenance of a vastly used gem.

Node is a cutting edge technology, so playing with it comes with that cost, but there are two faces of that medal. You'll also develop a skill of module picking over time - something I've not experienced that much in Ruby. In Ruby you rarely have to think twice before choosing the right gem for your problem, but here it's common to see dozens of modules for the same thing. That's probably because of the tendency for node modules to be much smaller in size than Ruby gems - it's much easier to provide alternatives.

Because of all this, you'll become more intimate with modules you use and you'll start recognizing authors whose packages are worth a require.

Node is weird

Let's admit it - Ruby is not weird anymore. People don't do crazy things in it and I'm not sure what's the reason why. Maybe those conventions and rules influenced our thinking and have put our minds inside the box?

It kinda feels like Java now, everyone going crazy about OO patterns, code cleanliness and 100% test coverage. Is that the most important thing? When did we forgot how to play?

Go and make something crazy! Node people are good at this.

There is also another side to this medal, of course. I have zero experience with running Node.js in production, but I'm guessing it will be harder than with Rails. That's okay, I like challenges in things I know nothing about.

The future

Things that are happening in Node and JavaScript right now are the things that are blowing my mind. I think that's the biggest reason why I'm attracted to it so much. I think I've got a little bored with Ruby since it's the only language I've worked with for years.

My plan is to stick with something that is blowing my mind - I think that's the right path to improve myself. It used to be Ruby some while ago - now it changed to Node.

I know this post is biased and it's reasonable because I'm excited the most with trying new things. Node is not the silver bullet, but I currently enjoy playing with it. Maybe I'll change my mind, like with Rails - maybe I won't.

At least I'll be richer for a fun experience.

Want to talk more about this or any other topic? Email me. I welcome every email.