Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Domain-specific languages vs. library of functions

This may be subjective, I don't know: I have this problem, which I'm kind of equating to the "what language for this project?" question, since I can't seem to solve it.

I've been commisioned to write a book about a certain domain (let's say a very specific branch of physics) for a very technically savvy community, but who are not programmers. It is a book on this subset of algorithms that they use day in day out.

For this, given my audience, I've been toying with the idea of defining a DSL, instead of making them learn language X, and discuss the algorithms in this light, instead of in a given language or in pseudo-code.

The question is, then: what are some indications that what you need is a DSL rather than a library of functions to be called from a well-established, general-purpose language?

Thanks.

EDIT: Suggestions so far in favor of DSL:

  • Shield from general-purpose language complexity.
  • Make "programmer" more productive in his/her domain.
  • Make language concepts highly intuitive for newbies in programming. (Just thought of this now)
like image 731
Dervin Thunk Avatar asked Sep 28 '09 01:09

Dervin Thunk


People also ask

What is domain-specific language?

A Domain-Specific Language (DSL) is a computer language that's targeted to a particular kind of problem, rather than a general purpose language that's aimed at any kind of software problem. Domain-specific languages have been talked about, and used for almost as long as computing has been done.

What is the advantage of domain-specific language?

Some of the advantages: Domain-specific languages allow solutions to be expressed in the idiom and at the level of abstraction of the problem domain. The idea is that domain experts themselves may understand, validate, modify, and often even develop domain-specific language programs.

Is Python a domain-specific language?

A Domain Specific Language, or DSL for short, is a language that's specialized to a particular application domain. In other words, it's a programming language that's used for a more specific application or use case than a general-purpose language like Python. For example, regular expressions are a DSL.

What is DSL example?

A good example of a DSL is HTML. It is a language for the web application domain. It can't be used for, say, number crunching, but it is clear how widely used HTML is on the web. A GPL creator does not know where the language might be used or the problems the user intends to solve with it.


2 Answers

  1. Your audience are non-programmers.
  2. You are targeting a specific field.
  3. They need to get job done.

I would choose a DSL over a general purpose language.

like image 91
Khaled Alshaya Avatar answered Oct 15 '22 20:10

Khaled Alshaya


You could choose a DSL to match exactly the domain you're dealing with. Programmers can be comfortable with a general purpose language and applying it in many situations. Your non-programmers may benefit from a language that is directly relevant to them. It can also be easier for them to understand if keywords and concepts match their expertise.

Like most things, it's a trade-off. A DSL should be easier for your audience, but it could well be more work for you.

like image 45
dave Avatar answered Oct 15 '22 22:10

dave