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?

Arseni Mourzenko
  • 134,780
  • 31
  • 343
  • 513
  • 6
    I'm not sure why the two need to be mutually exclusive, but maybe I'm missing something... – FrustratedWithFormsDesigner May 04 '12 at 15:16
  • @Telastyn I could have just as easily not said RIA, but just said form-based web application. An RIA and a DSL can both be about "information discovery". –  May 04 '12 at 15:32
  • Ok, define a Yacc-like DSL as a RIA. Or SQL-like DSL. Or a rule engine. – SK-logic May 04 '12 at 19:26
  • If you know only 100 words in a human language, the number of sentences you can produce is very large. Not so much when you have to fill in blanks on a form. Have you compared (for example) Visual Basic for Applications macros with the early form-based macros? –  Mar 22 '17 at 18:12

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,326
  • 19
  • 166
  • 181
Michael Borgwardt
  • 51,037
  • 13
  • 124
  • 176
  • Michael, can you provide an example of a problem domain where the amount of logic might make it better suited for a DSL? –  May 04 '12 at 15:36
  • [Sinatra](http://en.wikipedia.org/wiki/Sinatra_(software)) is considered to be a DSL, shows that you are trying to compare apples and oranges. – sebastiangeiger May 04 '12 at 15:42
  • 3
    @BrianReindel: Rating insurance policies. – FrustratedWithFormsDesigner May 04 '12 at 15:43
  • @sebastiangeiger Ruby is not a DSL, and neither is Sinatra. See the answer to this question: http://stackoverflow.com/questions/2822002/why-is-rails-called-a-dsl. All you have to ask is a simple question: what is the domain? If it is general purpose (web application framework development), then it is a GPL. See the answer that FrustratedWithFormsDesigner gave in the comment above. That would be a better example of a domain. –  May 04 '12 at 16:06
  • @BrianReindel I never said that ruby was. But (part of) Sinatra is a DSL for defining what actions should be executed if a certain route is accessed. – sebastiangeiger May 04 '12 at 16:10
  • @Brian Reindel: One example where I've personally seen both variants in action is EAI data mapping. For a banking application the batch interface mapping was based on code and maintained as a routine job, while the online interface had to use a specially developed graphical mapping rule editor that was inconvenient and slow to use, causing a permanent maintenance headache. – Michael Borgwardt May 04 '12 at 19:30
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
  • 38,959
  • 8
  • 94
  • 152
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
  • 146,727
  • 38
  • 279
  • 479
  • You said: "*programmers like to create systems that are easy for themselves to use.*" Laughed when I read that - on point! But, a DSL could also be usable by non-programmers, if it is well designed. I have seen that happen before. –  Mar 22 '17 at 17:53
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
  • 3
  • 30
  • 54
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,608
  • 3
  • 71
  • 142
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).