Running back and forth between development environments. Time traveling my development decisions.

Gal Schlezinger
Oct 6, 2016 · 7 min read

The year was 2013, and I was asked to build a project called 1500. The project was about providing email forwarding service using numeric email addresses ( At that time, I was a Java developer at work and I mostly used PHP for my side/freelance projects.

PHP felt fun and fast. I liked it way more than Java, mostly because the “save to reload” feature. Although I had a tremendous love for PHP, I secretly wanted to give a try to Ruby on Rails. For starter, learning a new programming language is always a good decision. Second, the tech media was all about Ruby on Rails these days. Given these reasons, choosing Ruby to tackle the 1500 project was obvious to me.

I shipped in one month

I have never used a package manager before, so Bundler blew my mind. Never thought I could just find a package on the internet and give it a try by running a command. I still wrote lots of the code I could get from RubyGems myself, but the change was vivid. To this day, I think that one of the greatest things around the Ruby community is that they can choose a great product all together. When I searched for Authentication, all the blog posts were the same. I felt like I shouldn’t worry myself and just trust the system and use gems.

Use devise.
- Every ruby blogpost, like, ever.

The only bad thing I had to say about Ruby on Rails was its slowness. GOD IT WAS SLOW. I had fun writing this project, but developing in Rails felt really slow to me.

Time passed on

Leaving frameworks like Ruby on Rails made me leave MySQL and other tabular databases since I was not a fan of the SQL syntax, especially the DDL, and I had no migrations. I tried to use MongoDB and really done it for some time, but I never was fan of it. Then, I found RethinkDB, which is still pretty awesome to me. I even wrote my final project for my CS degree using RethinkDB.

For most of my daily usage, RethinkDB was slow. I needed joins, aggregations. I thought that PostgreSQL might work better. Not so long afterwards, I fell in love with SQL databases again. The declarative way of writing SQL was great, and looked way better than my imperative JS queries and joins in MongoDB, and was way faster than the RethinkDB REQL queries.

When I did that switch, I was already had strong foundations with JavaScript and npm too. I used db-migrate to use migrations for my local and remote database and even wrote myself a new, simple, composable, querying system I wrote about in another post.

Image for post
Image for post
Ruby or Node.js?

Suddenly it hit me.

I have realised that most of the modules are very specific, and for a very specific mindset. That means that multiple coding styles are introduced in your codebase. Heck, I have even wrote my own db querying system. And this is a problem. See, I can get out of focus pretty easily. When I find an interesting problem, I usually think about how to solve it — even if the project could continue without solving it.

And that what Node.js made me do. Think about stuff I should not think. Why does every project have a different structure? When I go out and take a new developer for my team, would he know how the project is built? How much time would I spend on explaining the decisions I’ve made?

Well, if I need lots of time to explain my decisions, they aren’t that good.

So three years after my last usage of Ruby on Rails, I have decided to give it a chance again. gem install rails && rails new my project. And I was fascinated.

Rails have changed, but so did I.

I am a different software developer now. Three years ago, I didn’t care that Rails generates test files for every model, controller, etc. I actually removed all the tests. Yes, this is me three years ago. People change and the code they write and the quality of the software they ship change too.

Since the time I left Rails, it got way better. No, I haven’t used ActionCable yet, I’m talking about the the things you use daily. Having spring on every new Rails project is awesome. It makes it way faster to run the console and your tests. I recently learned a lot about RSpec, and it is such a fantastic tool. I haven’t really tried writing tests in Ruby beforehand. The hot code reloading works like a charm and feels way better and faster than using nodemon. Basically, spring and hot reloading combined give one hell of a fight to the Node.js development environment.

Time’s up

$ time node -e “console.log(‘hey’)”
0.06 real 0.05 user 0.01 sys

With only 0.06s to run this command, there is no wonder Node.js was so attractive to me. If we run the ruby command that does the same thing:

$ time ruby -e “puts ‘hey’” 17:38:08
0.12 real 0.02 user 0.04 sys

Oh, that’s double the time. Not that slow either, but still, double the time. Yet, I think that the commands above are lying to us. We almost never “just running node” or “just running ruby”. Running plain ruby scripts is cool, what was slow was Rails! And in Node land, I never use Node.js by itself in a real project. I find myself adding Babel, and sometimes even Flow, to any project I develop. I actually have 2625 modules called “babel*” in my development directory. So let’s print “hey” using babel-node:

$ time babel-node -e “console.log(‘hey’)”
1.04 real 0.93 user 0.14 sys

Oh man! this is much slower than Node, obviously, but also — It is way slower than Ruby! Still we need to check on Rails.

$ time rails runner ‘puts “hey”’
Running via Spring preloader in process 50596
2.18 real 0.25 user 0.04 sys
$ time time rails runner ‘puts “hey”’
Running via Spring preloader in process 50609
0.47 real 0.27 user 0.04 sys

So, the first time we launched Rails, it was slower by more than 2 times slower (one second) than babel-node. Yet, thanks to spring, The second time we’re launching our script, it is 50% faster than babel-node! This is a huge difference since it reflects the tests you run, the REPL, everything.

Image for post
Image for post

Wrapping up

It’s clearly not over.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store