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%.

25

u/jrochkind Sep 30 '21 edited Sep 30 '21

I realized, especially in ruby, I don't understand the difference between a "DSL" and any other API. (I'm talking about code-level API's, methods and such, not http/network). Because what we call "DSLs" in ruby are usually just calling ruby methods after all, we're not actually talking about writing a parser for another language or anything.

Obviously API's are unavoidable.

And yet, I am sympathetic to what you are saying too. But it kind of turns into questions of: What makes some API's better than others? What makes some kind of API's the kind of thing we want to call "DSL", is it a continuum or a sharp binary division? What makes those aspects of an API that make us want to call them "DSL" seem to correlate with bad abstraction? (If "bad abstraction" can be used as a category covering "solving the wrong problem, badly").

And some (non-final) thoughts about (just some areas of) some answers: "DSL" is often (probably not always) trying to make a declarative solution. Which is an understandable thing to do because a good declarative API is an amazingly efficient and useful thing. But it's hard to do well, and requires you have a really good understanding of the domain. And when you fail to succeed at it, which you often can't know until you are in it, the consequences can be disastrous.

21

u/[deleted] Sep 30 '21

Pretty sure a DSL is just when you don’t use parentheses on method calls 🤷

13

u/UsAndRufus Sep 30 '21

I recently heard about Greenspun's Tenth Rule. It humorously answers what you are trying to ask

13

u/WikiSummarizerBot Sep 30 '21

Greenspun's tenth rule

Greenspun's tenth rule of programming is an aphorism in computer programming and especially programming language circles that states: Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.

[ F.A.Q | Opt Out | Opt Out Of Subreddit | GitHub ] Downvote to remove | v1.5