Custom DSLs

The most widely discussed of the three is the Domain-Specific Language or DSL。 There is some disagreement on exactly what the term means, but for the purposes of this discussion we'll refer to it simply as a language that has been created with a narrow focus to solve a particular problem, rather than as a general purpose language designed to solve every computing problem。 As such we would expect a DSL to be non-Turing complete and for the most part this is the case。 There are edge cases of course。 Postscript, for example, is a Turing complete language but also qualifies as a DSL using our definition。

As the above example also illustrates, the idea of a DSL is not new。 Other familiar DSLs include Regular Expressions, XSLT, Ant, and JSP, all of which require some sort of custom parser to process them。 Martin Fowler also suggests that fluent interfaces/APIs can be considered a second type of DSL, which he refers to as an internal DSL。 His definition is that an internal DSL is developed directly within the host language。 This was a common practice amongst bothLisp and Smalltalk programmers, and more recently the Ruby community has been popularising the technique。

Whilst many well-known DSLs are commercially developed and maintained, some enterprise development teams have used the technique to create a language that allows them to rapidly explore aspects of their problem domain。 It isn't however as common as it might be, perhaps because DSLs have a fairly intimidating barrier to entry。 The team has to design the language, build the parser and possibly other tools to support the programming team, and train each new developer that joins the team on how the DSL works。 Here the emergence of tools to specifically support DSL development could significantly change the landscape。 Intentional Software's Intentional Domain Workbench, which has been in development longer than Java has been around, is the first significant implementation of such a tool。 The project started life at Microsoft Research, and Dr。 Charles Simonyi's 1995 paper "The Death of Computer Languages, the Birth of Intentional Programming" describes his vision。 In 2002 Simonyi founded Intentional Software to continue working on his ideas and a hugely impressive video demo of the system is available。 The product itself is at 1。0 status, but access is restricted to very limited partners。

Other software houses are also exploring the concepts, amongst them JetBrains, well respected for their IntelliJ IDEA Java IDE, who have recently released the 1。0 version of their Meta Programming System (MPS)。 MPS doesn't use a parser, instead working with the Abstract Syntax Tree (AST) directly。 It provides a text-like projectional editor which allows the programmer to manipulate the AST, and is used to write languages and programs。 For each node in the tree a textual projection is created - as the programmer works with the projection, the change is reflected in the node。 This approach allows you to extend and embed languages in any combination (often referred to as language composing) promoting language re-use。 JetBrains are using the product internally and have recently released YouTrack, a bug tracking product developed using the system。

The Java 6 Annotation Processor

Whilst DSLs are less common in more mainstream languages such as Java than they are in Ruby, Smalltalk and Lisp, recent developments in the Java language, in particular the annotation processor which was added in Java 6, offer new possibilities for developers looking to use them in Java。 The JPA 2。0 criteria API that will ship as part of Java EE 6, itself a DSL, offers anexample。 Here the annotation processor builds up a metamodel type for each persistent class in the application。 Whilst it would be perfectly possible for the developer to hand craft the metamodel in Java, it would be both tedious and error prone。 The use of the annotation processor eliminates that pain and, since the annotation processor is built into Java 6, the approach requires no specific IDE support – an IDE delegates to the annotation processor triggered by the compiler, and the metadata model is generated on the fly。

上一篇:面向对象程序设计英文文献和中文翻译
下一篇:JSP应用框架英文文献中文翻译

数控机床制造过程的碳排...

新的数控车床加工机制英文文献和中文翻译

抗震性能的无粘结后张法...

锈蚀钢筋的力学性能英文文献和中文翻译

未加筋的低屈服点钢板剪...

台湾绿色B建筑节水措施英文文献和中文翻译

汽车内燃机连杆载荷和应...

LiMn1-xFexPO4正极材料合成及充放电性能研究

网络语言“XX体”研究

张洁小说《无字》中的女性意识

安康汉江网讯

互联网教育”变革路径研究进展【7972字】

新課改下小學语文洧效阅...

老年2型糖尿病患者运动疗...

我国风险投资的发展现状问题及对策分析

麦秸秆还田和沼液灌溉对...

ASP.net+sqlserver企业设备管理系统设计与开发