My Past and Future Ruby
I want to tell you a story about my life with Ruby.
I’ve been building Ruby on Rails apps since 2005, having dabbled in Ruby for several years prior. For a lot of this time, things were great! Rails really delivered on its productivity promises. As time passed and as I shipped more apps, I grew discontent. I’d been toeing the Rails line (you know, fat model, skinny controller and all the rest), but I felt like my apps were becoming harder and harder to maintain.
I experimented with things: form classes, service classes, splitting apps up into discrete engines. These certainly helped in places, but they were never comprehensive enough.
I built several iterations of monolithic CMS-like systems to avoid repeating common work from project to project, but these were never flexible enough to be truly portable.
What became clear was that Rails didn’t offer enough supporting architecture. Of course, this was the intention all along, but the reality for me was that it wasn’t helping me to write apps that were easy to maintain and extend.
It turns out I needed a whole different kind of Ruby.
It was August 2015 and I had started to research Rails alternatives to share and discuss with the team at Farmlab, Icelab’s annual retreat. I found ROM and started following its visionary author, Piotr Solnica.
This was when things started to change. I watched one of Solnica’s conference talks and learnt about blending functional and object-oriented programming in Ruby. Soon after, I read Brad Urani’s take on applying this same technique to web apps.
My perspective was starting to shift. For a long time I’d been interested in functional programming, but it always seemed removed from the world of Ruby I inhabited day to day. Here I had just been offered a bridge. In the clearest terms, I learnt about the real benefits of loose coupling and immutability (and the perils of the opposite!). I learnt how to build things from the bottom up. Importantly, I learnt that functional Ruby was a real and viable thing.
After much time learning from the ROM and fledgling dry-rb Gitter communities, I worked out how to employ these principles in a real web app. It was our little website for Rails Camp Canberra, a good chance to try something new. The experience was convincing enough for me to suggest we take the same approach for serious client work here at Icelab. The team agreed, and we already have one of several such projects in production.
And what a refreshing feeling this was!
After a small amount of time finding our feet, we put together an app that felt solid from start to finish. Even as we hustled to meet a tight deadline, we could still maintain the same level of clean code across the whole app. It felt like we were finally working with our tools. We didn’t need to cut corners.
This is the Ruby I needed. It’s a Ruby that brings me that same joy I felt when I first got started. And it’s how we’ll be writing our Ruby web apps from now on.
Even though these are still early days, we’ve already learnt so much. If you’re interested in functional Ruby and building next-generation web apps with dry-rb, ROM, and Roda, stay tuned, because we have plenty to share. I’ll be writing on these topics once a week, and I hope to help you see a new kind of Ruby in your future!