Visual Studio DSL Entry 1

Source: Internet
Author: User

what is development in specific fields and DSL
development in specific fields is used to solve repeated problems, summarize and analyze each problem to solve the same problem at one time. frequently changing aspects can be expressed in a special language. for this special language, we can create a model or expression and insert it to a fixed part.
for our solutions in the software industry, the fixed part adopts the traditional design and implementation methods, which can be frameworks, platforms, interpreters or programming interfaces. it provides scalability, high abstraction and reusability. the specific domain language is used to create the changed part so that the entire solution can be applied.
a specific domain language (DSL) is a descriptive language especially used to describe the connotation of a specific domain. In fact, it is not unfamiliar with HTML, SQL is an example of DSL.

several other DSL
MPs http://www.jetbrains.com/mps/ jetbrains DSL tool, through which you can directly define rules, generate Code
metaedit + http://www.metacase.com/graphical DSL tool
Oslo http://msdn.microsoft.com/zh-cn/data/ee460940 (En-US ). aspx Microsoft's new graphical DSL language, But Oslo and we want to introduce DSL toolkit there are some differences, here are some introduction to http://blogs.msdn.com/keith_short/archive/2008/11/06/oslo-and-the-dsl-toolkit.aspx. oslo consists of the "M" language, tool quadrant, and relational storage.
GMF, EMF http://www.eclipse.org/modeling/gmf/ uses eclipse modeling framework (EMF) and graphical modeling framework (GMF) technology for domain-specific language (DSL) auxiliary Tools for generating domain-specific modeling (DSM)

What is Visual Studio DSL?
Vistual studio DSL tool is specially designed by Microsoft for specific fields. included in the vistual studio SDK (which will be separately installed in vs 2010), developers are allowed to design their own exclusive graphical tools, which have built-in model-related support, it also supports model verification, rules, and transactions, and allows developers to combine.. Net extension. for example, tool bar and menu. you can use the model with T4 to generate the target code. vs. net's current class designer, distributed system designer (distributed system designer), linqtosql designer, and entityframework designer are based on. developed by net DSL, vs 2010 added the UML modeling project and finally provided support for class diagrams, sequence diagrams, and use case diagrams. This is also based on. net DSL.

Why use DSL tools?
Several DSL tools are introduced above, but why should we use them? What does it bring to us? The key point is that DSL is different from UML to solve the problem, rather than describe the problem. if you are writing the same or similar code repeatedly in your work and solution, and the repeated code can be generated separately, then you can consider using the DSL tool to generate the code.
Some may say that this is different from using the existing database-based code generation tools (codesmith, Li Tianping's codematic? DSL stands at the height of experts in the field, rather than software development experts to solve the problem. If you need to design the database and then generate code coding, so you can only say that this tool is an auxiliary tool for developers, but it is only for actual developers, and this will not work in large software systems.

custom development process using DSL
1. locate the fixed part of the problem and place the fixed part in the general architecture or platform. the general part is basically fixed according to our long-term experience and accumulation. for example, the Enterprise Library we use has encapsulated Data Access Operations, log operations, and verification caches to provide calls.
2. identifies variability and DSL discovery. find the changed part, design the DSL, and provide a solution to the problem through the DSL expression or model. when using Enterprise Library, you find that most of the changes are relatively "fixed". They are still based on your model, your entity model, and service model, if you abstract the metadata and use DSL to configure the metadata, you can directly generate the metadata to your target solution.

advantage
1. Greatly improve productivity. Generating code is much faster than copying and pasting manually.
2. make the system more normative. each developer has a different implementation method for a function. Using a DSL design model and code generation can make the implementation of the function relatively fixed.
3. reduces the chance of making mistakes.
4. enable non-developers, consultants, and presales personnel to directly understand the model. The development process can be advanced, or even the consultant's research needs can be used to communicate with the customer, abstract the requirements, and provide them to the secondary developers.
5. the solution can be verified at a higher abstraction level to detect problems too early.
6. different technical implementation processes can be configured based on the same model. reduces technical difficulty and workload. For example, the sculpture introduced last time can provide different technical options for different levels. For the same model, we can choose to use Entity Framework or nhib.pdf. For the UI Layer, you can select Asp.net MVC, sliverlight, WPF, and other implementation methods.
7. DSL is not limited to generating our technical solutions. It can also be used to generate building scripts, documents, plans, and so on.
8. It is easier to transfer the technology of the solution by modifying the generator or interpreter. The model metadata is relatively fixed, so that our solutions are relatively standardized. We only need to generate different codes.

Of course, this is also a prerequisite. First, developing DSL requires the cost for abstract integration. Second, not all solutions are suitable for using DSL. For example, a portal website may have few fixed departments and few customized departments, which is not suitable for use, if it is not suitable for use, it will be stuck in the customization trap. You must retain some flexibility in design and development, because it is impossible for all code to be generated. You must provide certain scalability to ensure that the generated code can be extended. In addition, you must ensure that there are too many implementation specifications and your DSL will be too complicated. Sometimes you even need to discard some implementations and some requirements. "The solution to simple problems should be simplified, and the solution to complicated problems should be possible" (Alibaba Kay, founder of Smalltalk ).

Series Introduction
At the beginning of this series, we will use a case to briefly introduce the DSL development process. This case comes from DSL tools lab and mainly introduces some simple development methods of DSL, it also includes the combination of T4 and DSL to complete code generation and deployment of DSL tools. it mainly completes the DSL application of a state machine. The details will be described in the following sections.

After a brief understanding of DSL development, we will complete the development of a complete development tool that is actually used. This process also contains the DSL design and development process and issues that should be paid attention to. Of course, it also includes some in-depth applications of DSL and vsx.


Reference
Visual Studio DSL Tools Development Guide for specific fields doamin-specific development with Visual Studio DSL tools

Author: lone knight (like a year of water)
Source: http://lonely7345.cnblogs.com/
The copyright of this article is shared by the author and the blog. You are welcome to repost this article, but you must keep this statement without the author's consent andArticleThe original text connection is clearly displayed on the page. Otherwise, the legal liability is retained.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.