DEV Community

Jonathan Apodaca
Jonathan Apodaca

Posted on

Which do you prefer?: DSL or a well-designed Library?

Lately, I am preferring libraries over DSLs more and more. As I have ventured into learning Rust, it seems that all too many Crate authors abuse the (otherwise awesome) macro-system to create their own DSL. If more library-developers spent their time on designing a well-put-together API, then I would have the benefit of everything else my IDE supports:

  • Syntax I am familiar with: nothing else to learn besides the API surface
  • Autocomplete for discovery! (instead of switching between a Docs page and my text-editor)
  • Inline documentation, if methods were documented
  • etc.

The epitome of this philosophy would be RethinkDB's query language, which is actually an API, and not its own query language!

What do you all prefer?

Oldest comments (1)

Collapse
 
rhymes profile image
rhymes

Definitely libraries, they also usually make the code easier to port :-)