When Rails first came out, I was still a PHP guy. Slaving away at a web agency, pushing out website after website and letting designers have all the fun.
At the time I didn't even notice Rails existed.
When news of Ruby and Rails finally did reach me, I was fully immersed in Python and Django. I scoffed at the idea of anything being better. Them silly Ruby people, why on earth would I play with their toys when I can use a real language such as Python?
In part because node.js was really buzzing at the time (around version 0.3.x I think), in part because by then a lot of the big names in the startup world started abandoning Rails in favour of faster executing environments.
What really attracted me to node.js was the blistering speed of execution and the fact it was the new kid on the block. That exciting new thing everyone's looking at. Of course you're going to learn node if you're going to look at a new tech stack.
Just like these days you'd probably look at Go or Scala if you were going to learn a completely new way of making web apps.
A few weeks ago somebody calls me up and says "Hey, you seem to have a grasp on automated testing. Want to help us write tests for our Rails app?"
"Uh, sure, but I've never even looked at Rails before ..."
"No problem, I started the project off with zero Rails experience too. You'll figure it out."
In stark contrast to how programmers are hired these days, somebody was willing to use a generalist instead of holding out for a specialist. Bloody awesome, if you ask me!
And so I was thrown into the dizzying world of Ruby and Rails and a whole new ecosystem of stuff that is completely beyond my comprehension.
The really cool things
What struck me when I first saw Ruby code was just how readable it is. Even though I was looking at the language for the first time in my life, I could understand what everything is doing. I could follow the code and decide what tests need to be written.
Although a lot of the syntax is confusing - what's with all the colons? - I like the fact you can execute functions without using parentheses. As with Haskell, this often makes code more readable, but unlike Haskell can be very confusing when you're trying to discern functions from variables.
I also like the truthyness test by just appending a question mark to a variable/property/thing.
Rails has amazing support for writing tests. While Django makes it easy to write a bunch of unit tests and go so far as integration testing by calling the HTTP interface as a real browser would, Rails goes a step further by making it dead simple to test a real user's interaction with your website ... although I think that might actually be Capybara and not vanilla Rails.
Another thing I really like is that Rails is opinionated. Or maybe that's just the impression I got. Either way, it's a lot more mature than the node.js ecosystem so it is usually very easy to decide what library to use to do something. You pick Rails and you get this whole package of stuff.
Conversely, the most popular (perhaps even best) framework in the node.js ecosystem - express.js - can't even decide what template engine to use. Database? Ha, you're on your own, kid. Testing? Pick any of a million different testing libraries - you're on your own.
Things that suck
Ruby's most powerful feature - meta programming and the whole domain specific language shebang, is also the most annoying for a beginner.
The project I'm working on just ... works. I have no idea where dependencies are coming from, I can't tell which gem file a function I'm calling is defined in and most of the time I am completely at a loss as to what is actually going on.
It's getting better, slowly.
So far I've always been used to explicitly defining imports, explicitly calling a function from this library or that. You never do import * and yet with Ruby, that's all you get. Everything is an import * and more often than not, it redefines the behaviour of the language itself.
As such, I have no idea whether I'm learning how to use Rails, Ruby or any of the 30 something gems the project depends on. It's all rather confusing.
But what really ticks me off about Rails, or Ruby, possibly both, is just how slow the whole thing is! It runs well once it gets going, but what the hell is it doing in those 5+ seconds it takes to warm up to a functioning state? Mindboggling.
Maybe node.js just spoiled me.
All in all, I have to say I've grown quite fond of Rails. I love how simple it is to get started as a complete newbie and all the powerful tools are already giving me ideas for what I'm missing in node.js
Just a matter of finding some time to start bringing some of the cool concepts into node.js. Right now I doubt I'll be making a full switch to Rails any time soon.
- Ruby on Rails Receives the Third Security Patch in Less Than a Month
- Forcing myself to learn RoR
- Node.js Hatred Reveals Significant Dysfunction In The Ruby Culture
- Our First Node.js App: Backbone on the Client and Server
- Why Choose Ruby on Rails
Learned something new?
Read more Software Engineering Lessons from Production
I write articles with real insight into the career and skills of a modern software engineer. "Raw and honest from the heart!" as one reader described them. Fueled by lessons learned over 20 years of building production code for side-projects, small businesses, and hyper growth startups. Both successful and not.
Subscribe below 👇
Software Engineering Lessons from Production
Join Swizec's Newsletter and get insightful emails 💌 on mindsets, tactics, and technical skills for your career. Real lessons from building production software. No bullshit.
"Man, love your simple writing! Yours is the only newsletter I open and only blog that I give a fuck to read & scroll till the end. And wow always take away lessons with me. Inspiring! And very relatable. 👌"
Senior Mindset Book
Get promoted, earn a bigger salary, work for top companiesLearn more
Have a burning question that you think I can answer? Hit me up on twitter and I'll do my best.
Who am I and who do I help? I'm Swizec Teller and I turn coders into engineers with "Raw and honest from the heart!" writing. No bullshit. Real insights into the career and skills of a modern software engineer.
Want to become a true senior engineer? Take ownership, have autonomy, and be a force multiplier on your team. The Senior Engineer Mindset ebook can help 👉 swizec.com/senior-mindset. These are the shifts in mindset that unlocked my career.
Curious about Serverless and the modern backend? Check out Serverless Handbook, for frontend engineers 👉 ServerlessHandbook.dev
Want to Stop copy pasting D3 examples and create data visualizations of your own? Learn how to build scalable dataviz React components your whole team can understand with React for Data Visualization
Did someone amazing share this letter with you? Wonderful! You can sign up for my weekly letters for software engineers on their path to greatness, here: swizec.com/blog
By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️