Duck typing vs type safety in Ruby

Duck typing is one of the virtues of the Ruby language, it adds a lot of flexibility to the code, and allows us to use objects of different type in places where only specific methods are needed. Even though the idea behind duck typing may seem to be straight-forward, it is easy to use it... Continue Reading →

Abstractions and the role of a framework

This is a follow-up to the discussion that was started last week after I published “My time with Rails is up”. Since this article received a lot of feedback, over 1000 comments on various sites and even more tweets, despite my greatest efforts, I didn’t manage to reply to everything. Many people were confused about... Continue Reading →

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... Continue Reading →

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... Continue Reading →

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... Continue Reading →

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... Continue Reading →

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... Continue Reading →

Up ↑