What is “Orthogonality”?

2019-01-20 21:55发布

What does "orthogonality" mean when talking about programming languages?

What are some examples of Orthogonality?

16条回答
虎瘦雄心在
2楼-- · 2019-01-20 22:55

Orthogonality is the property that means "Changing A does not change B". An example of an orthogonal system would be a radio, where changing the station does not change the volume and vice-versa.

A non-orthogonal system would be like a helicopter where changing the speed can change the direction.

In programming languages this means that when you execute an instruction, nothing but that instruction happens (very important for debugging).

There is also a specific meaning when referring to instruction sets.

查看更多
女痞
3楼-- · 2019-01-20 22:55

Think of it has being able to change one thing without having an unseen affect on another part.

查看更多
小情绪 Triste *
4楼-- · 2019-01-20 22:55

Broadly, orthogonality is a relationship between two things such that they have minimal effect on each other.

The term comes from mathematics, where two vectors are orthogonal if they intersect at right angles.

Think about a typical 2 dimensional cartesian space (you typical grid with X/Y axes). Plot two lines: x=1 and y=1. The two lines are orthogonal. You can change x=1 by changing x, and this will have no effect on the other line, and vice versa.

In software, the term can be appropriately used in situations where you're talking about two parts of a system which behave independently of each other.

查看更多
该账号已被封号
5楼-- · 2019-01-20 22:58

In programming languages a programming language feature is said to be orthogonal if it is bounded with no restrictions (or exceptions). For example, in Pascal functions can't return structured types. This is a restriction on returning values from a function. Therefore we it is considered as a non-orthogonal feature. ;)

查看更多
登录 后发表回答