Drakon Book : Chapter 10 [English Translation]

Chapter 10

Page HistoryLast edited by PBworks 8 years, 7 months ago


All of the algorithm is clear and clearIf it is made ergonomically.

Ergonomically – it’s wonderful!

Ergonomically – so great!

Can I make a logical expression Ergonomic?

One of the main objectives of language DRAGON – improving the understandability of algorithms, programs and technologies. Until now, we solved this problem by visualization, transforming part of the text in an ergonomic graphical image. And how should look the other part of the text – the one that can not be written inside the visualization and icons?How to change the ergonomics of text inscriptions on dragon schemes to the maximum extent to improve their comprehensibility?

The question is too vast and complex. Therefore, we narrow the topic and confine private challenge: how to record the identifiers of logical variables and Boolean expressions to make them more understandable?

For discussion threads are best formal identifiers and formal logic expressions. This means that visual pseudolanguage DRAGON-1 for this purpose is not necessary, since its informal text syntax. For this reason, the material of this chapter is based on the idea of ​​a visual programming language DRAGON-2, in which both parts of the syntax (and the visual and textual) are strictly formal. Thus, in this chapter we first touch on the issue of programming in the language of dragons.More specifically, the discussion focuses on one particular issue program relating to the rights records of logical expressions.


Logical expression

So we’re going to find a way to write ergonomic complex logical expressions. To understand the essence of the matter, it is advisable to have at hand any example where we “play” a variety of methods to improve ergonomics.

Suppose you want to create an algorithm to control the car-robot, passing through the intersection with traffic lights in real traffic. Accept the agreement, that the car-robot moves in a straight line, and choose the simplest control algorithm (Fig. 75).

Boolean attribute to enable (or disable) the robot to go forward, is the identifier “Mozhno.ehat.cherez.perekrestok.” We assume that this feature is set to “yes” in three cases:

  •  lit green light and there is no interference movement;
  •  the yellow signal lights up, when the robot has left the intersection and there is no interference to the movement;
  •  traffic light broken (no green, no yellow or red signal) and there is no interference to the movement.

In other cases, a sign is “no”, prohibits the movement of the robot through the intersection.

We introduce the notation shown in Fig. 76, which correspond to the obvious equality:

Y = Mozhno.ehat.cherez.perekrestok (1)
A = Zelenyy.signal.svetofora (2)
V Zheltyy.signal.svetofora (3)
= Krasnyy.signal.svetofora (4)
D = Robot.vyehal.na.perekrestok (5)
= Pomehi.dlya.dvizheniya (6)

If you accept these terms and designations, the logical function is given by Y

Y = (A & ┐E) (B & D & ┐E) (┐A & ┐B & ┐C & ┐E) (7)

The example shown in Fig. 75 and 76, allows to begin the study of the problem. Below we consider several options records of logical expressions and compare them with the ergonomic point of view. It is assumed that the robot has five sensors forming the logic signals A, B, C, D, E, are received in an onboard computer controlling the robot movement.

Logical expression

With abstract identifiers

We make an equivalent conversion algorithm shown in Fig. 75. Taking into account the equality (1) replace the identifier “Mozhno.ehat.cherez. Crossroads “the letter Y, then Y instead substitute a logical expression of the formula (7). The result is an algorithm in Fig. 77.

Some mathematicians likely to praise the algorithm. They may say that from a mathematical point of view expressed in the icon “question” is a compact, concise, elegant and manageable one.

Unfortunately, this position does not take into account ergonomic considerations and is outdated. Outset: we are, of course, is not about to replace the math ergonomics, but only on the fact that, while maintaining the integrity of mathematical rigor, decisively abandon ergonomic carelessness traditional mathematical constructions. This means that a one-sided mathematical approach must give way to a systematic approach in which organically combines mathematical and ergonomic techniques. To designate a new approach can be offered the term “cognitive formalization of knowledge.”

Let us make another reservation. Formula (7) would be quite acceptable if it were an abstract task, whose purpose – to reveal the essence of a mathematical problem. However, in this case we are talking about the application task – to create a program of driving robot.

Lack of formula (7) and the algorithm in Fig. 77 is that the identifiers A, B, C, D, E is not meaningful, and abstract. They leave our knowledge of the subject area outside the program text.

How bad is it? Recall that the critical issue now is not a machine and human resources, and saving the past is closely linked to the problem of understanding, which is transformed into the central problem of computer science. Labour productivity in the creation of information systems and control systems depends on the successful resolution of the problem of understanding, ensuring fast and error-free development of algorithms and programs. This common position is closely related to the subject under discussion. In fact, people who are well aware of applications and the subject area, but do not know or have forgotten the notation (1) – (6), for example, customers, directors tasks kompleksniki and so on. E., Perceive identifiers A, B, C, D, E and are made up of formulas as meaningless set of characters. Consequently, these people are deprived of the opportunity to participate in the validation of algorithms and programs and to contribute to the elimination of errors.

To detect an error in the logical expression, you must have a good understanding of its meaning. To understand the essence of the logical expression in Fig. 77, a person has to remember not only the meaning of the concept, but also abstract identifiers hard to know the correspondence between them. This creates a double burden on the memory of the person (the algorithmic, programming, and so on. D.), Gives rise to additional and unfounded difficulties in finding and identifying errors.

For the majority of experts who know the application task, the logical expression in Fig. 77 does not give any clues about the semantics of logical variables, and in fact is a mysterious puzzle. It serves as a typical example of ergonomic untidiness traditional methods of mathematical description of applications. Hence the conclusion: in applications to use identifiers of abstract logical expressions ergonomically unacceptable.

Logical expression

SHORT meaningful identifiers

Abstract identifiers used in the first stage of the program. Today, the application programs are much rarer, replaced by so-called mnemonic names, t. E. A short semantic identifiers, which in most cases have a length of up to eight characters. The predominance of an eight identifier characteristic of the second phase of the development of programming languages.Here is a typical recommendation of this period: “not justified the use of names such as X or I, while the names of the MAXor NEXT convey the meaning is much more accurate.”

Follow the advice and continuing our example with the car-robot, replace the abstract identifiers for nicknames according to the table. 2.

Abstract ID Nickname
Y Mozhneh
A Zelsig
B Zhelsig
C Krasig
D Robnaper
E Pom

Fig. 78 is a flowchart obtained by such substitution. Can you call a logical expression in Fig. 78 ergonomic? Obviously, the best nicknames abstract. They were designed with a noble purpose – to facilitate the memorization of concepts to the formal name for the hint on the content side of things. Alas! Speak hints – it does not mean to say is clear. The reason for the failure is that the length of the identifier of eight characters are too small and clearly insufficient for a good, clear and easy to understand description of complex concepts. Therefore, when creating an eight identifiers have to save every character, and often use unintelligible words, stumps, such as Zelsig (green light), Krasig, Zhelsig and so on. D.

In fact, looking at the ID “Robnaper” (Fig. 78), few would guess that it is a sign of “Robot.vyehal.na.perekrestok.”

Comparing the logical expression in Fig. 77 and 78, it can be said that in the latter case, the comprehensibility of the algorithm, and if increased, it slightly. Thus, an eight semantic identifiers may not provide the desired improvement in the ergonomic characteristics of logical expressions.

Logical expression

LONG meaningful identifiers

For the third stage of development of programming languages, which began recently, characterized by the transition to a long semantic identifiers, containing up to 32 characters. It is necessary to clarify. Some compilers divided into two parts IDs, processing only the first part, and ignoring the second. As a result, different identifiers with the difference in the last characters are treated as identical to the translator. Such cases we exclude from consideration. If what follows is intended that all instrumental programs, including compiler, provide the necessary software processing of all 32 characters in the ID.

Increasing the length of the identifier up to 32 characters allows you to get two important ergonomic advantages. Firstly, in many (but not all) cases, there is an opportunity to abandon the cuts and use the full word. Second, to distinguish between words that are part of the ID, you can enter the ergonomic delimiters, such as point or bottom line.

An example of a logical expression that uses identifiers points and full-delimited (Unabridged) words, is shown in Fig. 79. It is easy to see that it has a higher readability than the previous examples. Nevertheless, there is one “but.”

An important point that is often overlooked

Fig. 75 written question “Mozhno.ehat.cherez.perekrestok” which explains the principle of branching algorithm: If you answer “yes” to the command “Ehat.vpered” answering “no” no action. This question is key: if it is removed, the algorithm becomes incomprehensible. In this regard, it is advisable to introduce the concept of the main issue conditional statement.

And now look at Fig. 77-79. It is easy to notice that the icon of the “question” is written a lot of interesting details, but there is no question of interest. He disappeared without a trace.

Thus, the logical expressions in Fig. 77-79 have a common drawback, and very significant. They do not have the main question, there is no key, explaining the essence of the algorithm. There is a paradox: the logical expression do not provide explicit information on how to exactly what we answer the question “yes” or “no.” Moreover, they do not allow the reader to easily and quickly restore the wording of the main issue, and do not stimulate his desire for such information. It is no exaggeration to say that these logical expressions obscure the essence, since the absence of the main issue can not be compensated by anything. As a result, the algorithms in Fig. 77-79 are incomprehensible and ergonomically unacceptable.It follows that the use of ergonomically correct length semantic identifiers is a necessary but not sufficient condition for the construction of ergonomic logical text.

To assign a Boolean variable?

We have already said that in traditional languages ​​for the values ​​of logical variables use the words TRUE and FALSE, TRUE and FALSE, 1, and 0. However, logic-ergonomic studies show that these designations are redundant and can be safely and usefully be excluded from the program texts. The desire to “destroy” superfluous notation is due to ergonomic reasons, as all unnecessary records are visual disturbances, which litter the text of the program and confuse the reader.

DRAGON language allows to solve the problem in two ways. In the first case, the icon is used “action” within which written assignment operator (Fig. 80). Visual operator in Fig. 80 means that the identifier “Mozhno.ehat.cherez.perekrestok” is assigned a value. What is it? To do this, we must calculate the logical framework of expression in the framework of the three connected characters or less. The result of calculation is “1” or “0”. Thus, the purpose is achieved, although the notation of “1” and “0” in the text program no.

In the second case, the icon is used “shelf” (Fig. 1, the icon of the E10), on the top floor which is reserved write the sentence “Set tag” or “Remove tag”. Downstairs point ID feature. Operators of the language DRAGON

It means that a logic variable “Norma.nasosa” is set to “1” and “0” respectively. Another example of the use of the icon “shelf” is shown in Fig. 81.

It is easy to see that in Fig. 81 uses the same trick as in Fig. 80, namely, the logical variable is assigned a value of “1” or “0”, while the notation “1” and “0” in the program never occur!

Rules for writing logical expressions FRAMEWORK

Increasing the length of identifiers causes that conventional horizontal recording logical expressions becomes impossible.In this regard, the vertical post used, an example of which is shown in Fig. 80. Vertical logic text in the language DRAGON write in accordance with the following rules.

  • The icon of the “action” placed one assignment operator.
  • The top line of writing a logical identifier and a sign variable assignment.
  • Below, write a logical expression, and each conjunction is a rectangular frame.
  • For operations AND, OR, NOT using the notation & OR, ┐ respectively.
  • Use the identifiers up to 32 characters.
  • The first characters of all identifiers placed on the same vertical.
  • Sign of denial ┐ written to the left of the identifier.
  • All the signs of negation (if any) are placed on the same vertical.
  • Signs & conjunctions written to the right of the identifier.
  • All signs of the conjunction written in the same column.
  • Vertical lines in the framework of a vertical one.
  • Signs and OR = placed on the same vertical.


Previously, we have concluded that the algorithm in Fig. 79 is ergonomically unsuccessful. How can I fix it? The question is not simple. Apparently, in many situations it may lead to different answers. In this regard, the following observations and advice are not mandatory, but only advisory in nature. They should be regarded as one of the possible ways to solve problems.

  • The icon of the “question” should not record the logical expression, particularly difficult. Instead, it is recommended to put a single identifier that contains clear and precise wording of the main issue.
  • In general, said identifier may be uncertain. To eliminate this trouble, you need to give it advance the value. To do this, there are two methods: a framework and a visual.
  • The framework method uses a logical framework of expression in the icon of the “action”. Perform calculations framework of expression, the result is assigned to the identifier main issue (Fig. 80).
  • In the visual method uses visual and logical expression of the two operators’ Set sign “and” remove tag “, recorded in the icons” regiment. “

In contrast to the framework for visual method for calculating a logical expression, as such, no. Visual expression process branches and leads it to one of two points (A or B in Fig. 81). The first point of the statement is executed “Install a sign,” the second – “Remove the sign.” Algorithms in Fig. 80 and 81 are equivalent.

Tool language program DRAGON should provide automatic translation algorithm framework (Fig. 80) into a visual (Fig. 81) and vice versa. The provision of such services to the user creates for him an additional intellectual and ergonomic comfort, allows you to compare the two forms of representation of the logical knowledge and choose the one that is more to their liking. As the author of the algorithm and the tastes of its readers may differ, each of them can get a listing (drawing) program in a form that personally he likes, thereby realizing their right to individual preference of one or another form of knowledge representation.

The optimal length of the formal semantic identifier is approximately 32 characters. It is understood that the software tool, the processing 32-byte ID field. It is desirable that specific identifiers, depending on the complexity of the concept have a length of at least 25 and no more than 32 characters. To avoid errors when manually entering such long identifiers to the computer, it is advisable to prohibit re-enter. This means that the identifier is entered into the system only once and is stored in the database. If necessary, re-entry is carried up from the database. This method requires special tools, but guarantees identity of all copies of the same identifier.

Conclusion of optimality 32-character identifier is consistent with the analysis of the history of programming languages, which detect a clear trend: from the abstract to the codes and names

8-character mnemonic names, and then – to the 32-character semantic identifiers. However, many programmers, following well-established habits, “stuck” in step 8-character name, so that the experience with the new features associated with the permission to use 32 characters, while still relatively small. Meanwhile, the ergonomic perspective, open to increase the length to 32 characters, promises to significantly change our preconceived notions and habits, because thanks to this wonderful innovation of formal language identifiers in its clarity is much closer to the natural human language, which is clearly seen in Fig. 80 and 81. In fact, a lot of 32-character identifier forms a very expressive, although a kind of language, laws and regulations which optimize the yet to be discovered, discussed and subjected to experimental verification.

Special designation for the values ​​of logical variables as belonging to a programming language – it is an anachronism that should be excluded from all languages ​​as completely unnecessary and even harmful “architectural extravagances”. To justify this conclusion, let us compare two expressions in a conditional statement:

If (Standard 1 = 1) & (2 Norm = 1) & (tripping = 0), the … (10)
If Norma Norma 1 & 2 & ┐Avariya, then …. (Eleven)

(10) reads as follows:

If the sign “Norm 1″ is equal to one and a sign of “Norm 2″ is equal to one and a sign of “Accident” is zero, then … (10a)

(11) reads as follows:

If there is a sign “Norm 1″ and a sign of “Norm 2″ and there is no sign of “Crash”, then … (11a)

Phrase (11a) in its lexical structure corresponds to the usual figure of speech used by domain experts who are not programmers. It accurately reflects the essence of the matter and understood by all employees, while the phrase (10a) contains artificial and deliberate inclusions “is equal to one” and “zero”, the occurrence of which unnecessarily lengthen the text and damaging to the perception of the process of making an offer for all the unknown but programmers.


  1. Growth point of modern science is an interdisciplinary research, particularly at the junction of logic and ergonomics.
  2. Today, when the critical issue is not a machine and human resources, the traditional methods of recording logical expressions should be recognized largely obsolete, because they do not account for ergonomic reasons.
  3. We propose a two-step method ergonomizatsii logical expressions. The first stage involves the separation of logical records into two parts, one of which is subject to imaging, and the other stored in a tabular format. The second stage – ergonomizatsiya both parts: the visual and textual.
  4. Ergonomizatsiya text part includes, inter alia, the following methods:
    • optimization of the length and recording rules identifiers;
    • selection of alternatives: a logical expression or identifier of the main issue;
    • except symbols for the values ​​of logical variables;
    • Comparative analysis of visual and recording forms framework and the selection of one of them.


Leave a comment

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

+ 9 = ten

Leave a Reply