====== GENERATIVE SOFTWARE ENGINEERING: WHAT ARE ALTERNATIVES TO DSLs? ====== ====== Introduction ====== Generative software development is an approach in programming that aims to create program code automatically based on certain mathematical and logical algorithms. This method allows you to save time resources, create fault-tolerant code and do it more efficiently, eliminating the human factor when developing a certain system. Languages play an important role in generative development. These can be not only programming languages, but also languages that allow you to form requirements for a software system and reflect the structure and processes in the system in a simpler and more visual way. Domain-oriented languages can serve as examples of such languages. Domain-oriented languages are languages that are highly specialized and are created to solve a certain narrow range of tasks, usually these are specific tasks in a non-specific subject area. These languages serve to simplify the type of structure and processes in a particular system, as well as to solve problems that arise in it. The data is simple and intuitive for any person from any subject area. The purpose of this essay is to analyze existing alternatives to domain-oriented languages, consider each option in more detail and form a conclusion about existing alternatives. ====== Domain-Specific Languages ====== Before you start exploring alternatives to DSL, you need to understand what DSL is. DSLs are specific, narrowly focused languages that are designed to solve a specific task or an array of tasks in a specific subject area. The subject area can be absolutely any and a subject-oriented language can be developed for any subject area. These languages are designed to interact with a specific system or industry. The DSL developed for a specific software system takes into account the requirements and features of the interaction system. DSL can be demonstrated as a set of commands, thanks to which you can control the system. DSLs are similar to programming languages, but there are differences. The differences are that these languages can only be used to solve a specific range of tasks, unlike conventional programming languages.[1] An example of DSL is the language for database management - SQL (Structured Query Language). This language is subject-oriented, because it is intended only for solving database management tasks and also for specific operations inside the database, such as deleting, changing, adding data, etc. Domain-oriented languages can also be used to develop software systems and to simplify interactions between developers in one area. ====== Alternatives to Domain-Specific Languages ====== After studying and understanding the essence of subject-oriented languages, you can proceed to the definition and analysis of existing analogues. This task is necessary to perform, since there are many tasks and needs in software development that need to be solved, and the analysis of alternatives will help to understand which alternative is the best for solving a certain range of tasks. At the moment, there are several common alternatives to DSLs. Briefly about each: 1. Metaprogramming is an approach that calls for creating software products that can analyze their actions during execution, interfere with someone else's code and make changes to the program code, in other words, the program will be able to change itself and other programs and perform the same actions differently on one program example. 2. Metamodeling is an approach that consists in creating abstract models and describing their behavior at an abstract level, but preserving the essence. 3. Generative templates - this approach uses ready-made behavior models and features of program code formation. 4. Precedent-based modeling is an approach that does not create new rules, but uses existing solutions. ====== Metaprogramming ====== Metaprogramming is programming in which computer programs can process other programs as their own data. Metaprogramming is also considered as the process of writing code through other code. This approach provides flexibility and automation in the process of developing software products. [2] Metaprogramming is reflected in the following concepts: introspection, reflection, metaclasses and metaprograms, code generation and dynamic code execution. 1. Introspection is the ability of a software product to analyze its state and structure. 2. Reflection is the ability of a software product to change its behavior and structure during execution. 3. Metaclasses and metaprograms are classes that are created to change or extend the behavior of objects. 4. Code generation is the ability to create new code by analyzing your own structure and behavior of a software product 5. Dynamic code execution is the ability to execute code that was added during the execution of program code. ====== Metamodeling ====== Metamodeling is the process of creating metamodels. Metamodels are tools that are used when creating models. A model is a data structure. Data is the simplest units of information of entities. Metamodeling has many goals, one of the main ones is an in-depth description of the data to prohibit modification of the structure. Metamodeling includes the following steps: 1. Description of the data. This step describes the data structure. For example, to create a model of a person, data on his physical characteristics can be used 2. Description of the model. In this step, it is necessary to describe the limitations of the data, for example, a certain physical characteristic has its maximum and minimum. This is how the model is formed. 3. Description of the meta model. This step uses an in-depth description and definition of the relationships between certain properties.[3] ====== Generative Templates ====== Generative or generative patterns are a process when ready-made behaviors and rules for generating program code are used. The essence of generative templates is simplicity, ease and a clear understanding of which program code needs to be generated. The following advantages of generative templates are distinguished: 1. Using generative templates, you can create many text and program files with a single structure. This advantage is very useful when there is a large amount of data, but with a similar structure, which must be brought to a single view. 2. Generative templates are used for various purposes, including the generation of code, documentation, configuration files and other text data. 3. Changing the template will allow you to make changes to each generated file simultaneously with the others. This will minimize the risk of erroneous filling. 4. Maintaining a clear structure.[4] ====== Precedent-based modeling ====== Precedent-based modeling is the ability to make decisions based on accumulated decisions. These decisions are called precedents. The work of this approach consists of several steps: 1. The preservation of precedents is the preservation of already solved tasks in memory for further use in solving other tasks. 2. Indexing - indexing of use cases for quick search. 3. Adaptation - search for solutions for common and similar solutions in the current context. 4. Solving the problem. 5. Evaluation and training - evaluation of the success of solving the problem, drawing conclusions and training your own model.[5] ====== Conclusion ====== In conclusion, of the DSL alternatives considered, each is useful, the choice of these alternatives depends on specific tasks and requirements. It is necessary to understand that there is no universal approach, and any method can be the best for the task. ====== References ====== 1. Jetbrains. Domain-Specific languages. [[https://www.jetbrains.com/ru-ru/mps/concepts/domain-specific-languages/]] 2. Habr. Metaprogramming. [[https://habr.com/ru/articles/137446/]] 3. Wikibooks. Metamodeling. [[https://ru.wikibooks.org/wiki/Метамоделирование#:~:text=Метамоделирование%20—%20это%20процесс%20создание%20метамоделей]] 4. Wikipedia. Generative templates. [[https://ru.wikipedia.org/wiki/Порождающие_шаблоны_проектирования]] 5. Isa. Precedent-based modeling. [[http://www.isa.ru/aidt/images/documents/2009-02/45-57.pdf]]