Re the new Rails normalize thing ( github.com/rails/rails/pull/43 )
It’s a great example of how not using a data type and instaed dealing with domain data as primitives adds so much complexity. And AR HAS a decent type transformation story already. What you want is an email class or a non-empty string or whatever. But Ruby and Rails culture is to use strings and hashes everywhere.

Creating data types is another thing that OO does really well (due to aforementioned encapsulation), but I don’t see it that often outside of mapping to database tables.

Follow

@davetron5000 yeah, and in Ruby you don’t even need to create a new file. You can experiment and find the shape of classes at very low cost. Get the abstractions fitting together properly. Hashes everywhere means you’re constantly inspecting code and scratching your head.
Can’t get the reference now but I know the anti pattern is called “primitive obsession”.

Sign in to participate in the conversation
Green Plenty

This is the companion community to the Green Plenty substack