4

I've been reading some papers recently on domain specific languages (DSL), but none of them appear to address the advantages of a DSL over a rich internet application (RIA). In an RIA, instead of learning the domain language, the user is provided with domain objects as form fields, which abstracts the lexical definitions for the domain language. This seems more usable. What I am missing?

6 Answers6

5

This depends on the complexity of the domain. If it mainly consists of structured data, a visual editor may be more intuitive to use, but if the domain contains significant amounts of logic, experience has shown time and time again that visual editors are a poor tool for that.

Additionally, there are some very common, very useful tasks that are trivial with a character-based language (such as copy&paste, search&replace) but require a lot of effort to implement in a visual editor and are therefore often missing.

Oded
  • 53,734
3

A form restricts the possible expressions to just one type. In natural language terms, you can write anything you can imagine in English. What you can express with a form is much more limited: think Mad Libs for example.

Caleb
  • 39,298
1

I will be the contrarian and point out that DSLs are often recommended inappropriately, because they are a more natural and flexible interface for programmers, and programmers like to create systems that are easy for themselves to use.

That means DSLs are best suited for features designed for programmers or highly trained and specialized users like IT departments. Things like site-specific configuration/customization, script automation, or relatively infrequently-changed business logic.

DSLs can also be useful as intermediate representations, allowing the programmer to write code at higher layers in a more compact, better suited language, even if end users never see it.

Karl Bielefeldt
  • 148,830
0

Since the DSL is text, I can use text-based tools. Most notably I can generate code for the DSL with a shell script via metaprogramming. As others have said, the DSL doesn't prevent having an RIA as well.

chrisaycock
  • 6,655
0

If you embed the DSL in a full programming language (Python, Ruby, Groovy, etc.) then you can you use the DSL to automate tasks.

kevin cline
  • 33,798
0

You would write a DSL system when you can imagine a need for 'scripts' that express a series of steps more compactly than a conventional program would. You would also create a DSL when you want something to be configurable "in the field" by non-programmers, yet still have all the power required to accomplish what the users are likely to need. An obvious example is HTML.

In the past I would often create script languages to help me perform automated tasks (out of date example now, but): copying and deleting files on a WAN so that input files are distributed and output files collected and removed. I created a language and a 'runner' that was designed to copy files around a network. This was a lot less effort and debugging than writing similar programs in C (this was 25 years ago).