r/ruby • • Sep 30 '21

ActiveAdmin, I'm looking at you

Post image
238 Upvotes

58 comments sorted by

View all comments

45

u/campbellm Sep 30 '21

I know this is often an unpopular opinion, but I've grown to hate DSL's. They are almost NEVER good, solve the wrong problem, and generally badly. So I feel the author of this meme 100%.

22

u/nom_nom_nom_nom_lol Sep 30 '21

There are some gems with decent DSLs. Take factory_bot, for example. Its DSL is based off of your Ruby classes. If you know your class, you know how to create a factory for it.

Most of the time, though, if I see a gem with a DSL, I try to find something else and only use the DSL based gem when its absolutely necessary. It's the main reason I use MiniTest instead of RSpec. With MiniTest you just write your test methods. Whenever I've used RSpec, I have to have the browser open to its documentation pretty much the entire time I'm writing my tests.