What is orthogonality?

I noticed that the term ортогональность is often used incorrectly and did not find a source in Runet that explains well what it is.

In the answer I want to:

  • See the exact definition of ортогональность along with a link to the source.
  • See code examples showing the orthogonal and non-orthogonal approach.
Author: Kromster, 2016-01-12

3 answers

In my opinion, this is best described in the book "Programmer-Pragmatist. The path from apprentice to master. E. Hunt, D. Toma".

Here is a quote from the book:

The term was coined in computer science to refer to a kind of independence or disjointedness. Two or more objects orthogonal if the changes made to one of them do not affect any other. In a well-designed system , the database program will be orthogonal to the interface user interface: you can change the user interface without affecting the database and change the swapping databases without changing the interface.

 22
Author: sys_dev, 2016-01-15 12:40:49

Orthogonality is a mathematical term, the same as addition, multiplication orvector . From the fact that the word "vector" is used in programming, it does not acquire any new meanings, and does not become a programming term. The same goes for orthogonality.

The definition of orthogonality is as follows:

If the scalar product of two space elements is zero, then they are called orthogonal to each other. (The source is Wikipedia, or any math textbook).

In the case of vectors, they are perpendicular to each other, hence the origin of the word "orthogonality" - Greek "right angle".
It follows that the projection of one vector on another is zero (because the cosine of the angle is zero), i.e. in the coordinate system of one vector, the other is zero.

When we talk about some orthogonal entities, it means that these entities are not related to each other in any way. I.e., as in the case of vector projection, one entity does not have any effect on the other.


As for the applicability of the word "orthogonality" in the code , this only indicates that the two systems are not connected. Similarly, one could speak of "parallelism" (not overlapping), or lack of correlation. I.e., the word "orthogonal" is simply a synonym for "not connected".

We can say that " in C++, the algorithms are orthogonal containers", because they do not have any direct connection. You can also say that "logging should be orthogonal to the UI". In any case, it's just using the clever word "orthogonality", instead of the usual phrase"not connected". The meaning of the phrase does not change at all.

 10
Author: Abyx, 2016-01-15 18:44:59

Definition of the concept:

Orthogonality in a programming language means that a relatively small set of primitive constructs can be combined into a relatively small number of ways to construct the language's controls and data structures. The term is most commonly used with respect to the meeting command sets as an orthogonal command set.

Read more here

In my opinion the best explanation is this term this example:

Non-orthogonal system:

Let's say you are in a sightseeing helicopter flying over the Grand Canyon when the pilot who made the mistake, after eating fish for dinner, he suddenly screams and loses consciousness. By a lucky chance, this happens when you are hovering at an altitude of 30 meters. You can guess that the lever controls the overall pitch of the carrier the screw provides the lift of the machine, so that if it is slightly lowered, the helicopter will begin to descend smoothly. However, when you try to do this, then you realize that life is not such a simple thing. Helicopter he nods, and you begin to spin in a spiral to the left. Suddenly you you understand that you are managing a system in which every impact has its own value. side effects. When you press the left lever, you will have to do counterbalance movement backward with the right lever and push down on the right the pedal. But at the same time, each of these actions will again affect everything bodies management. Suddenly you have to juggle incredibly a complex system in which any change affects all other control actions. You are experiencing a phenomenal load: your arms and legs are in constant motion, trying to balance all the interacting forces. The helicopter controls are definitely not are orthogonal.

Taken from here

If in two words and on the fingers, then in my opinion this term speaks about weak consistency in the designed architecture.

 4
Author: Мстислав Павлов, 2016-01-12 11:33:08