毕业论文

打赏
当前位置: 毕业论文 > 外文文献翻译 >

Java编程语言英文文献和中文翻译(2)

时间:2021-12-26 11:46来源:毕业论文
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 well ref

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。 Java编程语言英文文献和中文翻译(2):http://www.youerw.com/fanyi/lunwen_87410.html

------分隔线----------------------------
推荐内容