My time with Rails is up

Please also read my follow-up about abstractions and the role of a framework Last year I made a decision that I won’t be using Rails anymore, nor I will support Rails in gems that I maintain. Furthermore, I will do my best to never have to work with Rails again at work. Since I’m involved with many Ruby projects and people have been asking me many times why I don’t like Rails, what kind of problems I have with it and so on, I decided to write this long post to summarize and explain everything....

May 22, 2016 · 23 min · Peter Solnica

Invalid Object Is An Anti-Pattern

The idea of an object that validates its own state has been made very popular by Rails’ ActiveRecord. We can see this pattern in many places, not only in ORM libraries but in many other gems whenever some sort of validation is needed. Have you ever thought about why we’re allowing invalid state just to…validate data? It doesn’t seem to be a good idea, in fact, it feels like a huge anti-pattern....

December 28, 2015 · 4 min · Peter Solnica

Introducing dry-validation

We started experimenting with a new validation library under dry-rb organization a couple of months ago, and last month I released the first version of dry-validation. Since then I worked hard on improving it and adding support for i18n. Today, I released dry-validation 0.3.0 with a couple of bug fixes, new features and a complete support for i18n. Before I tell you what it is and how it can help you, let me start by explaining the reasoning behind this project....

December 7, 2015 · 8 min · Peter Solnica

Ditch Your ORM

I’ve been promoting a functional approach in Ruby for a while now and even though it includes many different techniques and patterns, there’s this one idea, one fundamental idea that changes everything - immutability. But what does it even mean in Ruby? To freeze everything? That would be too slow, so no. Immutability-oriented design means that you avoid interfaces that can change your objects. Yes, there are plenty of methods in Ruby to mutate something, but when you are designing your object interfaces, you can design them in a way that your objects won’t change....

September 18, 2015 · 7 min · Peter Solnica

Encapsulating Business Transactions With Transflow

It’s a known fact that when you deal with a big problem it’s good to split it into smaller problems, solve them in isolation using separate components and use an integration layer to combine them into a single unit. Unfortunately it’s easier said than done. In an OO language like Ruby there are countless approaches you can take to tackle complex scenarios in your application. Objects accumulating state, which gets mutated as a result of some business transaction, is already a complex thing to deal with....

August 17, 2015 · 5 min · Peter Solnica

Importing Data With ROM and Transproc

Importing data into a database can be a complicated task. This process can be quite painful as you need to deal with data transformation, filling in missing information, specifying validation rules, handling errors and so on. Without proper tools to solve this problem it can become more complicated than it should be. In my current project at work I’m dealing with exactly that problem - we’re importing data from YAML documents into a PostgreSQL database....

July 15, 2015 · 9 min · Peter Solnica

New Transproc Released

Transproc is a small library I wrote a couple of months back. It’s been growing nicely and yesterday its 0.3.0 version was released which redefined how it works and what it really is. I’m exicited about this project as it’s been used in ROM to implement its Mapper component and turned out to be very powerful and flexible while remaining simple. In this post I’d like to show you what transproc really is and how it can be used with other libraries....

July 13, 2015 · 3 min · Peter Solnica

Cutting Corners or Why Rails May Kill Ruby

Today I’m tired and frustrated. And it’s not the first time that I have those negative feelings. Typically I just complain on twitter, lose some followers, wait a bit to calm down and move on. But today I need to vent and convert my negative emotions into something constructive and hopefully meaningful to others. Every time I simply whine about certain aspects of Ruby ecosystem and especially Rails people are asking me specific questions that I fail to address properly....

June 6, 2015 · 6 min · Peter Solnica

Introducing Transproc - functional data transformations for Ruby

Data mapping, or how I prefer to call it - data transformations, is something I’ve tackled in a couple of projects already. First, in DataMapper ORM with its Property API. Then in Virtus, a project that started as an extraction of DataMapper Property API to a separate gem. Then Virtus evolved into something more powerful and quite a lot of people really enjoy using it until this day. The approach used in Virtus and many other libraries similar to Virtus is typical OO design....

April 16, 2015 · 4 min · Peter Solnica

8 Things I Learned During 8 Years of Ruby and Rails

Check out a follow-up on Ruby Rogues Exactly 8 years ago I started working professionally as a rails developer. I’ve spent a lot of time working for various clients, on various projects - from small green-field apps to 5+ year old rails monstrosities. In addition to Rails development I got involved in OSS. Back in 2011 I joined DataMapper core team, a couple years later I started working on ROM project and effectively stopped working on DataMapper....

March 4, 2015 · 6 min · Peter Solnica