Reading Notes: Development Guide for specific fields of Visual Studio DSL tools

Source: Internet
Author: User

Microsoft started to provide DSL in vs2005sdk, and also published a book dedicated to writing Visual Studio DSL. This book details the DSL content, in the current environment where there are few DSL books, it is good to have such a book for reference.

I have read this book a few years ago. Since I recently began to consider adding model-driven development support for openmetaedit to openexpressapp, I have read it again, the following is an excerpt of some non-Visual Studio-specific knowledge in the book. If you are interested in DSL, you can learn it.

 

  1. Development in specific fields is to design a language for specific purposes to make most of the problems encountered in software development easier to solve.
  2. If applicable only to generalProgramming LanguageOnly one problem can be solved at a time. However, if some special languages are designed and implemented using development methods in specific fields, each special language can efficiently solve a similar problem.
  3. A specific domain language can be a text or graphic language.
    • The graphic language is not just a chart. Otherwise, you can use the drawing software such as Visio. It is actually used to create a model. This model must be able to visually depict the system you are creating, and the content is displayed in a graphical representation. A model can be represented by multiple charts at the same time. Each chart represents an aspect of the model.
    • Text language user input, Fast typing.
    • The advantage of text language is that it can be compared and merged, while graphical expressions can easily see the association between content.
    • Relatively speaking, text language is more complex than graphics
  4. During Development in a specific field, a method is used to solve repeated problems.For each occurrence of a problem, use this special language to create a model or expression, and then insert the model into the fixed solution.Part. The fixed part of the solution is implemented using traditional design, coding, and testing technologies. Based on the scale and type of the solution, the fixed part can be a framework, platform, interpreter, or API. The fixed part establishes the structure pattern that constitutes the problem domain, and also provides scalability, so that it can be used in multiple solutions.
  5. Software Development Process Customization
    1. Locate the fixed parts of all the problems and place them in a general architecture or platform.
    2. Identify the variation of all the problems and design a DSL. The DSL expression or model can provide a solution to the problem.
  6. Advantages of DSL applications
  7. Definition of a specific domain language:
    A specific domain language is a language customized for a small problem domain. It describes and verifies the problem using the terminology unique to the domain.
  8. Development in specific fields is closely related to the creation of many other authors and institutions. Some of them are listed below: 
    • Model-driven development (MDA)
    • Language-oriented Lop
    • Language work platform language workbenches
    • Domain-specific modeling DSM
    • Generative programming generative rrogramming
    • Intent software intentional Software
    • Software factory software factories
  9. Structure specification:Structure container, compartment, connection line, weight, Port
  10. Indicates the behavior specification:Lifeline and arrow, Arrow, swimming path, villain
  11. A graphic DSL has several important content that must be defined: symbols, Domain Models (domain classes and relationships, constraints), generation, serialization, and tool integration.
  12. DSL tools are generated by DSL definition in a self-raising manner. The core of the system is those automatically generatedCodeAnd extended functions by writing code.
  13. In most cases, DSL is mainly used to parameterize general frameworks.
  14. To reduce risks,We didn't start developing the framework and Its DSL right away.But starting from the existing code that can be used in some applications, we will gradually parameterize it and gradually discover the changed parts in different applications, then make these parts dependent on DSL
  15. The top-down approach tends to quickly build a complete and self-contained model with long-term considerations, helping to ensure structural consistency.. However, on the other hand, this method may easily lead to complicated model design at the conceptual layer, and this model is difficult to implement. Therefore, in practical application,It is more effective to use both top-down and bottom-up methods.The progressive method can avoid the risks of excessive early investment, but regular consistency checks are required.
  16. One function of DSL is to make the work closer to the customer's understanding, rather than implementing itself.
  17. Design of separation between presentation layer and underlying modelSo that the DSL compiler can reasonably change the representation of the domain model without modifying the model. Two files are generated when DSL is saved. One file includes the domain class and link instances and Their attribute information. The other file contains the layout information for graphical display.
  18. To generate a large amount of code, it is more advantageous to replace some code with common code parameterized during runtime.
  19. DSL-driven applicationsProgram: Generative application, interpreted application. In some cases,The system may need to evolve from a generative framework to an explanatory framework to increase runtime flexibility.
  20. The structure of a DSL implementation is divided into three layers: The compiled framework, the Code defined by DSL, and the code automatically

    Microsoft. visualstudio. Modeling: the core of the entire system in the domain model framework. It is responsible for managing model elements and connections, that is, instances of domain classes and domain relationships.
    Modeling.Disgrams: The design interface framework is built on the domain model framework. It is responsible for displaying graphical symbols, including displaying charts, graphs, connectors, decorations, and other elements on the design interface.
    Modeling.Validation: The verification framework is responsible for executing verification methods on Model Elements and connections. If verification fails, it is also responsible for creating error objects. It interacts with the shell framework and displays the error information in the error window of Visual Studio.
    Modeling.Texttemplation: The template engine executes text templates to generate code or other artifacts. Template engine is an independent component used to execute template input from non-DSL
    Modeling.Shell: The shell used for modeling is responsible for managing the integration of related tools into Visual Studio, such as processing tool windows and menu fame, and opening and closing of files.
  21. The core of each DSL is a domain model, which defines the various concepts represented by this prediction, the attributes of these concepts, and the relationships between them.
  22. shape: set shape, compartment shape, image shape, port, and Lane
  23. choose hard constraint or soft constraint
    • hard constraints refer to the constraints that the tool never allows users to violate. For example, in the" width "Field of a shape element, only valid numbers are allowed
    • A soft constraint can be violated sometimes, sometimes there are constraints that cannot be violated. For example, all elements in the model must have a unique name
    • most constraints involve a large amount of computing, the user does not always need the correct model
    • use the maximum number of duplicates as a hard constraint, use the minimum value as a soft constraint
    • when using DSL tools for modeling at the conceptual layer, it turns out that a useful practice is to use a practical string as the basic property type, then, we use a set of soft constraints to check that the attribute values conform to the stricter type set
    • using hard constraints alone does not bring the best user experience, because hard constraints only prevent users from performing any operations that violate the rules, instead of guiding the user experience
  24. One of the most important applications of DSL is to produce simple text-form artifacts, suchSource code, Database script, or persistence representation of another DSL
  25. Currently, DSL tools do not provide direct support for synchronization, because apart from a few DSL tools, the complexity of synchronization usually exceeds the benefits it brings.
  26. Design DSL
    1. recognition of variability and DSL discovery: DSL uses your framework to implement the variable part of your Architecture Model
    2. development domain model capturing variability
    3. define Tag: use common marking methods or conventions related to marking methods where appropriate
    4. Development Validation constraints: Identify the dependencies between trees, recognize the forced or prohibited cycle in the snapshot
    5. Development and Evolution framework: understand the code architecture of your DSL, write it in the Framework
    6. test DSL: verification constraints and rules, generators and commands, and generated code
    7. evolution and porting of DSL: ensure that the old model can be used in the new DSL version
    8. recognized DSL: range, minimum, common markup, moderate redundancy, and reasonable use of syntax Space, use user terms
  27. A special tree is a technology for considering and capturing changes under a single roof..
    • This tree includes all the features of the requirement document. Some of these features may eventually be unavailable.
    • The feature tree is designed to meet the needs rather than the needs. Each feature describes what customers can see in the system. Many changes involve changes in design decisions, rather than changes in requirements. For example, if you use a list to replace an array, these changes are not included in the feature tree.
    • Feature tree not only includes visible features of end users, but when you design something similar to a general wizard builder, your customers are the developers who call your subsystem, features are those actions that are visible to them in your API

 

welcome to reprint, reprint Please note: Reprinted from week gold root [http://zhoujg.cnblogs.com/]

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.