Domain Specific Languages
On encountering a new programming "technology" my initial reaction is usually puzzlement: I can not see the point. Often I then notice some area in which it provides a cleaner solution, and I begin to see the light. With Aspect Oriented Programming it was declarative transaction handling and logging.
I have been having trouble seeing the point of Domain Specific Languages, as highlighted in Sergey Dmitriev's Language Oriented Programming article. I was not convinced that a well defined Obejct Oriented model would be significantly less expresive than a DSL; in fact in I'm still not so sure, but - thanks to a conversation with Andy Swan - I am beginning to see applications for pluggable DSLs.
A good example is database access within a Java (or other) program. It would be much neater to plug a syntax checked SQL language extension into the data access parts of program than any of the options currently open to us. Imagine if you could write the following:
public void updateDescription(int id, String newDescription)
{
UPDATE mytable SET description={newDescription} WHERE id={id};
}
Other examples might be XPath for xml querying, or regular expression extensions.
Replacing embedded languages with DSLs is hardly the revolution that Sergey seems to be describing. It is, however, a starting point from which to explore the idea.

0 Comments:
Post a Comment
<< Home