Drakon Book : Chapter 12 [English Translation]

Chapter 12

Page HistoryLast edited by PBworks 8 years, 6 months ago


Software industry must be a miracle – a miracle that would embody the vision of a quick and easy programming.

Tom Manuel

HYBRID programming languages ​​DRAGON SI

Suppose you want to build a system on a hybrid visual programming language DRAGON-SR. The problem can be solved, for example, by means of three programs: the dragon-editor, the dragon-converter and the C compiler. The user with the help of a dragon-editor draws on the computer program in DRAGON-SR (Fig. 90, the right of the graph). Then a dragon-converter converts the internal representation of graphic codes in C language source code (Fig. 90, the middle of the graph), after which the standard C compiler converts the source code into object code.

To better understand the benefits of language DRAGON-SR, we perform mentally reverse conversion. As can be seen from Fig. 90, when converting the text of the program source code in visual C program is divided into two parts. Assignment statements, conditional expressions, and declarative description of almost no changes are transferred to the visual program and placed it inside the icons. The remaining tekstoelementy C language (which may be called to remove or “parasitic”) become unnecessary, becoming a graphic lines and keywords are “yes” and “no” (yes and no). Figure 90 shows that the list of parasitic (deleted) elements C language is impressive: it includes all the keywords in Examples 1-7 except thedefault, all curly, circular and oblique brackets, colon, tags, comments in Examples 3-5, and furthermore of semicolons in Examples 2, 3, 7 and 6 in part.

Thus, in order to build a language-SEA DRAGON, according to certain rules need to connect the visual syntax of a dragon with text syntax of the C language, removing the last of all the elements whose functions are realized visual operators DRAGON. A couple of the C language and the dragon-SI is equivalent in the sense that it can be built converter performs both direct and inverse transformation. This converter can convert the source code in the language of DRAGON-SR (Fig. 90, the right of the graph) to the equivalent C program (Fig. 90, the middle of the graph), and vice versa.

Create any hybrid language (for example, a dragon-SI) can hardly be considered original work since the latter is almost fully preserves the concept, structure, data types, and other features of the source language (SI). Correct to say that the construction of a hybrid language (DRAGON SI) is technique in which in a strictly defined number of cases of the source language text notation is replaced by the visual. However, this technique can significantly improve the ergonomic shape of the source language.


DRAGON Modules

Referring to the above example in Fig. 91. The middle column shows program in Modula-2, on the right – the equivalent program in DRAGON modules. The left column is a list of keywords that are used in the module-program and are “vital” for the language module, but which do not need to program dragon.

From an ergonomic point of view, these and many other keywords present in the text-based languages, there is nothing more than a visual disturbance, attracting the attention of the reader and distract his attention from the substantive aspect of the case. Ergonomic advantage of the Dragon is that instead of keywords used by the visual image that is perceived by the reader unconsciously, on an intuitive level, while conscious attention channel operates more efficiently – for the perception of the most important, substantive aspects of the problem.

EXAMPLE ergonomic optimization


Fig. 91 (at the bottom, in the middle column) program is written in Pascal. Acting similarly to the previous example, it can be easily converted to a program in PASCAL dragon. To do this, draw a visual statement “fork” and the icon “issue” put the record

K = 1 OR K = 2

Lower output icon “question” mark the word “yes” and join him switch with two icons “option” and the right way (the answer is “no”) is connected to the icon “withdrawal” in which top write WRITELN, bottom – ERROR. As a result, we obtain the Dragon scheme, which is undoubtedly a completely correct solution of the problem. (For clarity, we recommend the reader to perform the construction on paper.)

But now change the conditions of the problem. Let’s try to create a program that would not only be equivalent to the Pascal program in Fig. 91, and an ergonomically optimal for the Russian-speaking reader. Seeking a program written in the language of the Dragon 2 is shown in the same figure at the bottom right.

Striking structural difference between the programs. Pascal program contains two constructs: if-then-else and case-of.Ergonomic optimization is that the dragon program uses only one visual operator (the switch with three options), which nevertheless “alone” performs the same function as the two text operator Pascal. As a result, a complex condition K = 1 OR K = 2 and other excesses Pascal programs are eliminated, and the dragon diagram is considerably simplified and becomes laconic, clear and elegant.

Dialog programs

We continue the presentation of one of the possible approaches to building a programming language DRAGON-2. Once again, we recall that the reader will not find here the description of the language. Our goal is much more modest: to show that the formalization of the syntax of the language of the text DRAGON is feasible, and to give a few examples to prove this point.

Consider interactive program in Fig. 92 and 93, having improved teaching (teaching) properties. To do this, use an extensive set of ergonomic tools. In particular, during filling of the icon “comment” is used zoning text. Text comments to facilitate understanding of spatially divided into two zones, which are, firstly, have a clearly defined and easily discernible boundaries, and secondly, a different color background (gray and white). The gray area is placed the text that appears on the computer screen in white – explaining to him. Delimitation between the text of the explanatory comments easier to read and improve their comprehensibility.

Ergonomic reception “zoning text” is useful not only in the comments, but in other cases, such as input-output statements.

Operator “Message”

Operator “message” is used to display information on a computer screen. It contains the icon “withdrawal”, on the top floor which put the keyword “Message” at the lower – output information. In describing the final text of the zoning applies: in the gray zone write variable names or expressions (values ​​should be displayed on the screen), a white zone – permanent information (which is displayed unchanged). Newline is a black circle. For example, in Fig. 92 using the “Message” appears on the screen, the phrase “sum of the numbers is” and the expression m + n.

Operator “Request”

Operator “Request” shall enter into the computer the values ​​of variables, display fixed information, variable names and values ​​entered. In the upper part of the icon “input” write the keyword “Query” at the bottom – the input and output information. There is also present zoning of the text: in the gray area indicate the names of the variables to be entered into the computer, in white – put a constant information.

Suppose you want to enter the values ​​m = 23 and n = 45 (Fig. 92). This is done, for example, as the cursor is fed into the zone m, type in the number 23 and press the “carriage return.” Wherein m area on the screen disappears and instead the number of turns 23. The value of n is introduced analogously. Thus, the operator “Query” prompts the user variables, stores them in memory, and simultaneously displays on the screen along with the constant information (if the latter is available on the ground floor of the operator “Query” in the white zone).

Data Description

For a description of the data is the icon of “shelf”. Upstairs write the keyword “data” at the bottom – a description of the data. For example, in Fig. 92 in the icon “regiment” indicated that the variables m and n are of the type “a.”

You can offer another way: data description endure beyond the dragon-circuit and placed in a separate table.


Here are the rules for writing identifiers.

  • The length of the identifier 1 … 32 characters.
  • Permission is granted to use any of Russian and Latin letters, numbers, periods, and may have special characters.
  • The first character must be a letter (not a digit and not the point).
  • Inside the identifier may not use spaces.
  • Words must be separated by dots, to facilitate reading.
  • Do not use the contraction of the words, if the length of the ID is less than 32 characters.
  • If the length of the identifier more than 32 characters, it is necessary to replace certain words or abbreviations to reduce the number of words.
  • We must strive to come up with intelligible identifiers make it easy to understand the meaning of the concept, so that the reader quickly understand the essence.
Examples of valid ID





Examples of invalid identifiers
Nomer.vagona.passazhirskogo.poezda (Here 33 symbols,and can be no more than 32)
Chislo.vagonov freight train (Spaces are used)
3 y.zapusk.avariynogo.nasosa (There are two mistakes:First symbol – the figure;

In addition, there is a hyphen)

An example of reducing the length of the complex concept

Suppose you want to create an identifier for the following notion: “The radius vector of the center of the Earth at the center of the runway in the landing coordinates.” Verbal description of the concept contains 92 characters. The aim is to reduce the 92-character description of up to 32-character, retaining as much as possible a clear sense of the concept.

Reducing spend on the following schedule:

  • “The radius vector of the center of the Earth” substitute “Radius.zemli.”
  • Instead of “In the center of the runway,” write “na.polose.”
  • “The landing coordinate system” is replaced by the CPM, as this reduction is commonly used in the collective development of the system.

As a result, we obtain a 26-character identifier


which retains nearly all the key words of the original concepts and provides a relatively high comprehensibility.

Record rules of arithmetic expressionsassignment statements

We must distinguish two cases. If the expression is simple, it is recommended to use a 32-character identifiers, and “vertical” record mathematical formulas, as shown in Fig. 94 and 95.

However, when it comes to complex mathematical calculations, the method described is not suitable as a “vertical” formula with a 32-character identifiers do not allow the reader to see the mathematical structure calculations, diverting his attention to reading long identifiers that, paradoxically, turn out useful tips into its opposite and begin to play a negative role of visual interference. Thus, there is an ergonomic impasse: short identifiers do not allow you to quickly understand the meaning of concepts and long – obscure the structure of complex formulas.

As one of the possible approaches to the outbreak of this Gordian knot can be offered a three-point plan.

  • For each mathematical concept provides two identifiers: a long (32-character) and short (alias).
  • In arithmetic expressions are used only aliases, which makes the structure of formulas transparent.
  •  In the beginning of the program provides an icon “comment”, which houses a table of correspondences between aliases and long identifiers. This table serves as a crib, which is in the same field of vision with assignment operators and allows you to quickly recall, which means that one or another alias.

Array processing

Fig. 94 and 95 are examples of programs that have operations on arrays.

Data description located on the ground floor of the icon “regiment.”

Record ARRAY VESCH Ves.krolika 100

It means that the specified one-dimensional array called “Ves.krolika” containing 100 elements, each of which is a real number.

The main element of both programs is the cycle for. Consider the rules of registration cycle. In the icon “start cycles for” in the top line of writing the word “cycle” and after a space one-character alias, indicating the loop variable (the letter k in Fig. 94, 95). The bottom line indicates the range of change, for example,

from k = 1 to 100

But what stands for the letter k? What is the physical meaning of the loop variable in the application program? The authors of many programs forget (or do not consider it necessary) to answer this question, with the result that the program often turns into a puzzle. To avoid this, in the middle line should write a formal comment, for example,

k ≡ Nomer.krolichey.kletki

≡ identically equal sign shows that after followed by the name, comment, t. E. Comment that is written by the rules record identifiers.

Ergonomic “fat” formal comment involves two advantages. First, it eliminates the traditional “forgetfulness” of programmers and humanly explain to the reader the meaning of abstract ID: say, k – is the number of rabbit cages. Second, importantly, the explanation is placed on the drawing exactly where needed (in the icon “start cycle for”), on the principle of “expensive egg to the day of Christ.” This means that the reader gets an instant response – at the very moment when he first saw the alias k and glimmer in his mind a question: What is k?

The icon of the “end of cycle for the” record

End cycle (loop variable)

The meaning of the operators that organize array processing is clear from Fig. 94 and 95 and requires no explanation.


In this section we will look at the transformation of the visual language program DRAGON-2 in the text program in BASIC.This transformation is useful in two ways: it will allow deeper visualization to understand the essence and learn important concept abstract dragon scheme.

As an example, take a school program called “Igra.ugadayka” and write it in the language of the Dragon 2 (Fig. 96). Then, completely eliminate it from the text and get the drawing-mole rat, which is called “abstract dragon diagram” (Fig. 97). This scheme is an invariant of the program, which can be converted in two steps in the program in any programming language.

We choose as the target language BASIC and get down to business. The first step is to fill the empty icon abstract schema text in the language BASIC. The result is the equivalent program in BASIC-DRAGON (Fig. 98). In the second step we pass to normal BASIC program (we deliberately chose the old-fashioned version of BASIC to demonstrate the use for a variety of goto statements when describing equivalent dragon program) – see. Fig. 99.

Philosophy of language DRAGON

Any imperative language (C, Pascal, ADA, modules, BASIC, and so on. D.) Can be divided into three parts, three relatively independent language: routing, command and declarative.

Trip language – a set of control statements. Command language contains all the non-control statements, such as the assignment operator, the rules for writing arithmetic and logical expressions, identifiers, keywords, and so on. D.Declarative language used to describe data, and other classes.

Let us illustrate this with an example. Abstract dragon diagram shown in Fig. 97, there is some “words” Shuttle language.To make it meaningful, icons should be placed within the text. This text is written in the command language. However, the description of data classes and sometimes it is advisable to make the scope of the dragon-circuit and put them somewhere else, such as a single record or table.

Hence the principle of differentiation of three sublanguages. Trip language – the language of “pictures” (abstract dragon schemes in which the text is completely absent). Command language used to write text inside dragon scheme declaratory – for those records that can be taken outside its borders.

Constructing another language dragon family, you can select a team and declarative sublanguages ​​in any way (by borrowing from other languages, or inventing anew). This provides a wealth of features dragons and flexible configuration for various applications. Thus, the dragon family has only one hard link – trip language that is none other than the visual components DRAGON (visual syntax and semantics).

Trip language – a visual standard dragon family, dragon supports visual editor (see. Ch. 14), which is small and easy to remember. He is a constant hallmark of the Dragon, its standardized visual image (Fig. 97).


Every program has a certain amount of knowledge, which can be separated into an imperative and declarative part.The above considerations make it possible to clarify this thesis. A new approach to the problem is presented in Fig. And 100 is as follows:

  •  To analyze the knowledge contained in the source code of a computer program written in an imperative language, it is advisable to use two classifications: basic and alternative. / Li>
  • Basic classification is that all the knowledge contained in the initial program, split into declarative and imperative.
  • In turn, the imperative of knowledge are divided into control and command.
  • As a criterion for the alternative classification proposed question: what tools are best used for knowledge representation – graphics or text?
  • The answer is as follows. To present knowledge of Governors is better to use the schedule (Block language) for command and declarative knowledge – text.
  • Thus, in the alternative classification of knowledge is divided into visual (control), and text (command and declarative).

Finally add: the use of the text for submission to the complex control of knowledge seems as absurd as an attempt to describe a map in words. The fact that the text is still used for this purpose, can be explained only one: the programming is much younger than geography!


  1. If we now have a formal visual syntax, for the construction of a visual programming language is sufficient to construct a formal text syntax. We are convinced that this problem is quite solvable, and in several ways. The end result, a family of programming languages ​​as the original (the dragon-2), and hybrid (DRAGON-SR-DRAGON modules DRAGON Pascal, BASIC and dragon t. H.).
  2. It can be argued that the comprehensibility of visual languages ​​is significantly higher than the comprehensibility of their text counterparts. Therefore, in all cases where the comprehensibility is regarded as the main criterion for the quality of programs (and there are a lot of cases), visual languages ​​are out of competition. It is appropriate caveat: the very term “visually” does not guarantee anything. Business success is achieved through a thorough and rigorous application of the science of human factors (ergonomics). To be more precise, it is a synthesis of methods of computer science and ergonomics, the formation of a new interdisciplinary direction – infoergonomiki, the restructuring of the building of modern programming ergonomic basis.
  3. The creation of any programming language, the next generation must begin with an analysis of ergonomic requirements and end with evaluation of the ergonomic features of the language. One of the main obstacles to the implementation of this plan is the inertia of thinking of many experts, an underestimation of the importance of ergonomic methods. To change the stereotypes of thinking, you need to make major changes in the program and methods of teaching of computer science in schools and universities.


  • R99-100 (48.48 KB
  • R98 (77.71 KB
  • R97 (13.83 KB
  • R96 (78.26 KB
  • R94-95 (57.84 KB
  • R92-93 (55.75 KB
  • R90 (73.57 KB
  • R90-91 (86.02 KB

Leave a comment

Your email address will not be published. Required fields are marked *

three × 9 =

Leave a Reply