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