java - Java 是正交的吗?

标签 java theory definition orthogonal

我想知道 Java 是否是正交的,如果是,那么它的哪些特性使其正交。如何确定一种语言是否正交?比如我在一些网站上发现C++不是正交的,但是没有解释,为什么不呢。还有哪些其他语言是正交的?请帮助我,因为互联网上几乎没有关于此主题的信息。

谢谢

最佳答案

UNIX 编程艺术,第 4 章模块化、正交性,第 89 页:

Orthogonality

Orthogonality is one of the most important properties that can help make even complex designs compact. In a purely orthogonal design, operations do not have side effects; each action (whether it's an API call, a macro invocation, or a language operation) changes just one thing without affecting others. There is one and only one way to change each property of whatever system you are controlling.

编程语言语用学,第 6 章,第 228 页:

Orthogonality means that features can be used in any combination, that the combinations all make sense, and that the meaning of a given feature is consistent, regardless of the other features with which it is combined.

关于 Lisp,5.2 正交性:

An orthogonal language is one in which you can express a lot by combining a small number of operators in a lot of different ways.


我认为正交编程语言的每个特性都具有最小的副作用或没有副作用,因此可以使用它们而无需考虑这种用法将如何影响其他特性。我从正交 API 的定义中借用了这一点。

在 Java 中,例如,如果同时在标识符上使用可能会相互影响的关键字/结构的组合,则必须进行评估。例如,当将 publicstatic 应用于方法时,它们不会相互干扰,因此这两者是正交的(除了关键字的目的之外没有副作用)

您必须对其所有特征执行此操作才能证明正交性。这是解决问题的一种方法。我认为在这件事上也没有明确的不是正交。

关于java - Java 是正交的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3272019/

相关文章:

java - Native Extension 如何在 Android 设备上截屏?

algorithm - 暂停问题的一个稍微不同的版本

theory - 有限自动机有什么用?

html - Angular.js 中 ui-sref 的定义?

c++ - 定义未命名的类成员函数?

javascript - 在 Javascript 中获取未知对象的定义

java - mvn混淆器: Is there possible obfuscate dependency before copying

java - log4j2 文件已创建但未写入

theory - 图灵机不能接受的所有已知语言是什么?

java - spring中如何同时使用CustomDateEditor和DateTimeFormat?