in Coffeescript or TypeScript.It ' s there. It works. Some people prefer it, Some don ' t.Today, many people use Haml or Jade to write HTML, and to write CSS in Sass or less, write JavaScript with Coffeescript or TypeScript. Existence is the truth, can catch the mouseis a good cat. Some people love, of course, some people hate.The point is this there is nothing fundamentally wrong in not writingJavaScript in vanilla JavaScript, CSS in CSS and HTML in HTML. It ' sReally a matter of preference.Th
DSL Concept
Martin FowlerDefines a domain-specific language (DSL) as "a computer language that's targeted to a particle kind of problem, rather than a general purpose language that's aimed at any kind of software problem"
Domain-specific agesAren't a new idea by any means. dsls have been around since long before the start of computing. People have always developed specialized
Vocabularies for specialized tasks.
Regular Expressions and SQLAre si
The previous issue of this series describes how to use a specific domain language (DSL) to capture domain idiomatic patterns. This issue will continue with this topic to showcase various DSL build methods.
In the next book, in Domain specific Languages, Martin Fowler will explain the difference between the two DSLs. External DSLs can build a new syntax that requires tools such as Lexx and Yacc or ANTLR to
meaning of different terms and give a clear definition. The vague concept of components has a formal and clearly defined meaning in this system.
Of course, it does not end here. Next we will discuss how to encode the component implementation and discuss which part of the system can be automatically generated. For more information, see the next section.Summary advantages what have we done
This includes defining a formal language for the conceptual architecture of a project or system. With your
to overflow, to create DSLs for DSLs, for the sake of technology and DSL, but these are not the focus. The advent of DSLs is an inevitable consequence of high abstraction, which naturally dies out of the abstract DSL.
Give some chestnuts:
ORM
I have now n entity classes and I need to persist these entity classes for storage. So I wrote n a DAO. Later found that
(where:option[sqlexpr]): Table = {
where match {
case None + =
table Case Some (x:sqlexpr) = Table Filter (Evalwhereeachrow (_, x)
}
}} where Evalwhereeachrow (_,x) is another function, the first parameter is a column in the table, a map object, and the second parameter is the portion of the AST that is parsed by SQL, corresponding to the WHERE clause.
GroupBy clauseGroupBy operations for collections are also available in Scala, followed by the previous exa
some cases, the order of execution of those business rules that use the rule flow may also be graphically determined. The last one is often the cause of confusion between business processes and business rules. Although they look similar, business process flows define the order in which services can be executed across many different and heterogeneous systems. On the other hand, the business rule flow is limited by the order in which the rules are executed (orchestration).
Domain-specific progra
Document directory
Using Non JVM languages ages with storm
Dsls and multilang adapters
Using Non JVM languages ages with storm
Https://github.com/nathanmarz/storm/wiki/Using-non-JVM-languages-with-Storm
Multilang Protocol
Https://github.com/nathanmarz/storm/wiki/Multilang-protocol
Using Non JVM languages ages with storm
The JVM language is relatively simple. You can directly improve DSL encapsulation of Java.Non-JVM languages are a little more c
In this column last month, I covered an example of using a specific domain language (DSL), defined in your code as a common design practice. (I introduced the concept of idiomatic patterns in the "combining methods and SLAP" article.) DSL is a good medium for capturing patterns because they are declarative, easier to read than "normal" source code, and make your capture patterns stand out from the surrounding code.
The language technology used to build a DSL is often an ingenious way to implici
A DSL is a specialized language that addresses domain-specific issues. By getting closer to the problem, the DSL can provide benefits that may not be found in the common language. The Java world is full of DSLs. Property files, Spring contexts, a usage of annotations, and Ant tasks are examples of DSLs.
When I started to look at other languages like Ruby, I began to understand that the Java language is not
.
Kotlin is very good at "take doctrine". Kotlin often copy ideas from other computer language designs and is not shy about it. They said: "We love the way C # is handled, so we're going to do it ourselves." ”
Kotlin supports DSLs. DSLs are not to be introduced, but they have to admit that the DSL is powerful. For example, if you look at Gradle's DSL and maven ratio, in a typical MAVEN project, the conf
Org.jooq.impl.DSL is the main class that generates all Jooq objects. It acts as a static factory to generate database table expressions, column expressions, conditional expressions, and other query parts. After Jooq 2.0, the static factory method was introduced in order to make the client code more approximate to SQL. When you use a DSL, you simply need to introduce all the static methods from the DSL class. Columns such as: Importstatic org.jooq.impl.dsl.*;
Dslcontext and
method of gaining extensibility, and it provides a good solution to the problem, except for the lengthy design patterns that the visitor has caused.In any case, it is highly recommended that you look at the section "Two Directions of extensibility" (two Directions of extensibility) in the article mentioned above.Simple DSL (domain-specific language)Writing a Dsl,scala is a good choice. In fact, Scala works for both internal and external DSLs. In this
.
It's important to point out that groovy does not support the 'Expect CT: 'and 'where: 'keywords out of the box. spock extends the groovy compiler to change the execution flow of your tests. awesome!
Jruby (or it's better to say Ruby) has lots of nice features for writing dsls as well. for example, the fact that class bodies are executable enables you want to write some really interesting dsls:
class Perso
4))(clojure.walk/macroexpand-all '(++ 1 2 3 4))(clojure.core/+ 1 (clojure.core/+ 2 (clojure.core/+ 3 4)))Using macros to create dslsOne common use of macros is to generate custom dsls. using macros, a few simple, intuitive expressions can generate much more bulky, complex code without exposing it to the user.The potential use for dsls in clojure is unlimited. Enclojure(The web framework for clojure) all
ArticleDirectory
Integrate DSL in applications
Boo summary and rhino
Integrate DSL in applications
Naming Conventions
Ordering the execution of scripts
Performance considerations when using a DSL
Segregating the DSL from the application
Advantages and disadvantages of centralized IntegrationBoo summary and rhino
DSL infrastructure shocould meet:
Define codify common DSL idioms so you don't have to keep rewriting them
Ƒ handle caching of DSL scripts
Ƒ abstract the compiler boo
direction Maxheight = 100 // The largest terrain ing height in the world Maxmipmaplevel = 5 // Upper limit of level details # Vertexnormals = Yes // Calculate the vertex normal, computer light, or GPU in the buffer.ProgramOpen when used # Vertexcolors = Yes // Set the vertex color in the buffer. If a GPU program needs to enable this function # Usetristrips = Yes // We recommend that you disable the current hardware. Vertexprogrammorph = Yes// Use the vertex program for the processing of the
language), a lot of discussion about DSLs, I recommend two books, One is Uncle Martin's domain specific Language, and the other one is DSL inAction Scala was chosen because of the built-in support for DSLs in the Scala language, which makes it easy to implement one of your own parser, which allows you to parse your DSL script (here is the SQL statement) and get the intermediate result you want. Usually we
]Common declarative languages include those of database query languages (e.g., SQL, XQuery),
regular Expressions,
logic programming,
functional programming, and
configuration Management Systems.
subparadigms[edit] Declarative programming is an umbrella term that includes a number of better-known programming paradigms.Constraint Programming[Edit] Constraint programming states relations between variables in the form of constraints that specify the properties of t
Dependency RegistrationGuice provides a dependency configuration class that needs to be inherited to Abstractmodule to implement the Configure method. In the Configure method we can configure dependencies with binder.Binder uses chaining to form a unique set of semantic DSLs, such as:
Basic configuration: Binder.bind (ServiceClass). to (Implclass). In (scopes.[ SINGLETON | No_scope]);
No base class, interface configuration: Binder.bind (
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.