Sunday 1 November 2009

The case for Domain Specific Languages

Instead of wondering why Domain Specific Languages (DSLs) make sense, let's try to look at the number of people doing programming. According to various sources, there could be about:

* 9 million programmers in the world
* 0.5 million professional programmers in USA+Canada
* 25,000 self-employed programmers in USA+Canada

I live in Denmark, and can relate to these numbers - the situation probably looks similar here. However, a recent official statistics about internet usage in Denmark has asked the population, whether they have ever written a computer program. 18% of Danish men answer yes, 7% of Danish women answer yes, giving a total of 13% of the Danish population. This also seems very realistic, since primary schools, high schools, universities all teach programming. Compare this to the fact, that only 48% of the Danish men have tried to compress a file, and 25% of Danish women have tried the same, and connecting peripherials have been done by 72% of men and 51% of women. For background, 86% of Danish families have a computer at home, 83% have internet, 76% have high-speed internet. For families with children, 98% have a computer and 97% have internet. This is age-dependent, of course, and only 65% of the above-60 y.o. have internet at home. Education also influences percentages, and 94% of all university graduates have internet at home - and remember that 15% of the population is more than 65 y.o.

So, if the number of people, who are capable of writing a program, is far larger than the number of professional programmers, it makes sense to use the knowledge of these people to automate processes, that a professional programmer would struggle to understand. That's one place where DSLs makes sense.

5 comments:

Jolyon Smith said...

I don't understand your reasoning... how do you figure that there are huge numbers of people capable of writing software? It seems that you are looking at people capable of *using* a computer for some task and then determining that simply being able to use a computer is enough to determine that they are capable of writing software (unless there was some other statistic that didn't communicate well in your post).

It's like saying that there are millions (if not billions) of people driving cars every day, but only a few hundred designing them... so clearly we need a way to allow those millions of people who drive cars to be able to design them without having to learn the "language" (skills, practices and processes) of car design.

I don't doubt that there is *a* use for DSL's, but I don't think these sorts of numbers make a good argument.

Lars D said...

As I wrote, 18% of all Danish men have written software, 13% of all Danes have written software. To me, that's a huge number compared to the number of programmers, and the people who have created software, outnumber programmers by a lot.

The IT usage numbers were only provided for comparison.

Jolyon Smith said...

I, along with many child hoods friends also once "designed a car". That is, we sketched something that we thought looked cool and would be a car we would like to own.

Of course, not being car designer's, these weren't usable car designs.

How many of those "programs" that those people say they wrote would actually pass muster?

And perhaps they didn't *want* to be programmer - they just did it because they had to, in the same way that I can change the tire on my car if I need to, but I don't want to be (or expect to be called) a car mechanic.

That doesn't require that car designers come up with non-car-mechanic ways of changing a tire, it simply requires that I learn enough to be able to use *some* mechanics tools - namely a wrench and a car jack.

Lars D said...

I'm not sure that I understand your car analogy, but I think Microsoft Excel is a good analogy. If you had to contact a programmer each time you needed to write a complex expression, it would slow down productivity immensely. However, many people have the necessary skills to do branches and complex stuff in Excel, without being programmers, and they do many great things.

DSLs are just like that. We have a DSL in our main product, that features variables, loops, branches etc., which makes it easy for a medico-technician to configure complex protocols, without involving a programmer. These DSL programs are usually 1-10 lines, sometimes up to 20 or 30 lines. The typical scenario would be, that the technician gets a new complex device, installs a driver, connects the device, and a couple of hours after receiving the device, everything has been configured correctly. If a programmer had to be involved, that could take days.

There are a huge number of reasons to use DSL. But even though DSL is about making programming simpler, it still requires some very basic programming skills. That's why it is interesting to know the scale of skills with non-programmers. Most university graduates that I know, have learned programming as part of their study. It seems that this is not a statistical special case.

Caleb Hattingh said...

Every language is a DSL, for varying definitions of "domain". There is no general-purpose language, save mathematics, and even then, axioms define the domain. The discovery of non-Euclidean geometry is a case in point, where manipulation of the axioms can produce a different mathematical language.