What is “Orthogonality”?

前端 未结 17 1553
离开以前
离开以前 2020-12-12 09:42

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

What are some examples of Orthogonality?

17条回答
  •  伪装坚强ぢ
    2020-12-12 10:01

    While talking about project decisions on programming languages, orthogonality may be seen as how easy is for you to predict other things about that language for what you've seen in the past.

    For instance, in one language you can have:

    str.split

    for splitting a string and

    len(str)

    for getting the lenght.

    On a language more orthogonal, you would always use str.x or x(str).

    When you would clone an object or do anything else, you would know whether to use

    clone(obj)

    or

    obj.clone

    That's one of the main points on programming languages being orthogonal. That avoids you to consult the manual or ask someone.

    The wikipedia article talks more about orthogonality on complex designs or low level languages. As someone suggested above on a comment, the Sebesta book talks cleanly about orthogonality.

    If I would use only one sentence, I would say that a programming language is orthogonal when its unknown parts act as expected based on what you've seen. Or... no surprises.

    ;)

提交回复
热议问题