Home computickets What is orthogonality?

What is orthogonality?




I noticed that the term orthogonality is often used incorrectly and did not find a source in the Russian Internet that would explain well what it is.

In response, I want:

  • See the exact definition of orthogonality along with a link to the source.
  • See code examples showing the orthogonal and non-orthogonal approach.

Answer 1, authority 100%

In my opinion, the best thing about this is written in the book “Programmer-Pragmatist. The path from apprentice to master. E. Hunt, D. Thoma “.

Here is a quote from the book:

This term was introduced in computer science to refer to a certain
varieties of independence or disconnection. Two or more objects
are orthogonal if changes made to one of them do not affect
any other. In a well-designed system, the base program
data will be orthogonal to the user interface: you can
change the user interface without affecting the database and change
places of the database without changing the interface.

Answer 2, authority 44%

Orthogonality is a mathematical term like addition , multiplication , or vector . Because the word “vector” is used in programming, it does not acquire any new meanings, and does not become a programming term. It’s the same with orthogonality.

The definition of orthogonality is as follows:

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

In the case of vectors, they turn out to be perpendicular to each other, hence the origin of the word “orthogonality” – the Greek “right angle”.
It follows from this that the projection of one vector onto another is equal to zero (since the cosine of the angle is equal to zero), i.e. in the coordinate system of one vector, the other is equal to zero.

When they talk about some kind of orthogonal entities, it means that these entities are not related to each other in any way. Those. as in the case of vector projection, one entity has no 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. Likewise, one could talk about “parallelism” (do not intersect), or about the absence of correlation. Those. the word “orthogonal” is simply synonymous with “unrelated”.

We can say that “in C++, algorithms are orthogonal to containers”, since they have no direct connection. You can also say that “logging should be orthogonal to the UI”. In any case, this is just the use of the buzzword “orthogonality” instead of the usual phrase “not connected”. The meaning of the phrase does not change at all.

Answer 3, authority 16%

Concept definition:

Orthogonality in a programming language means that relatively
a small set of primitive constructs can be combined into
relatively few ways to build control and
language data structures. The term most commonly used
relative to collection command sets as an orthogonal command set.

More details can be found here

In my opinion, this term is best explained by this example:


Suppose you are in a sightseeing helicopter making
flying over the Grand Canyon when the pilot who made the mistake
after eating fish at dinner, he suddenly cries out and loses consciousness. By
luckily this happens when you are hovering at altitude 30
meters. You guessed that the control lever for the overall pitch of the carrier
the screw allows the machine to be lifted, so that if it is lowered slightly,
the helicopter will begin to descend smoothly. However, when you try to do
this, then you realize that life is not such an easy thing. Helicopter
nodding, and you are spiraled to the left. Suddenly you
understand that you are managing a system in which every impact has
side effects. When you press the left lever, you will have to do
counterbalancing movement back with the right lever and press the right
pedal. But at the same time, each of these actions will again affect all
governing bodies. Suddenly you have to juggle incredibly
complex system in which any change affects all others
control actions. You are under phenomenal pressure: your
arms and legs are in constant motion, trying to balance everything
interacting forces. The helicopter controls are definitely not
are orthogonal.

Taken from here

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

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions