What is orthogonality?
rm
roel.mathys at gmail.com
Wed Oct 18 23:30:06 PDT 2006
Bill Baxter wrote:
> The world orthogonality has been thrown around a bit here, me included.
> I just read this interesting interview with Matz, Ruby's creator where
> he says he doesn't like orthogonality and gives an example of why it's bad:
>
> "An example of orthogonality is allowing any combination of small
> features or syntax. For example, C++ supports both default parameter
> values for functions and overloading of function names based on
> parameters. Both are good features to have in a language, but because
> they are orthogonal, you can apply both at the same time. The compiler
> knows how to apply both at the same time. If it's ambiguous, the
> compiler will flag an error. But if I look at the code, I need to apply
> the rule with my brain too. I need to guess how the compiler works. If
> I'm right, and I'm smart enough, it's no problem. But if I'm not smart
> enough, and I'm really not, it causes confusion. The result will be
> unexpected for an ordinary person. This is an example of how
> orthogonality is bad." -- Matz
>
> First a definition. My concept of orthogonal comes mostly from linear
> algebra. If you have two vectors that are orthogonal there is no
> component of one that can be represented using the other. I.e. the
> projection of one onto the other is zero. They have zero overlap.
>
> What Matz is talking about is more like "syntactic orthogonality". The
> syntax of those two features is orthogonal so they can coexist without
> issues. The syntax subspaces they cover have zero overlap.
>
> That's important, but I think a low-level kind of orthogonality. What
> I'm talking about is more of a "semantic orthogonality". What does the
> feature let you express? In the semantic sense his example of
> overloading functions by number of paramters versus using default
> parameters is exactly 100% UN-orthogonal. They both achieve exactly the
> same behavior. They overlap 100% in terms of what you can express.
>
> In the end he says he wants things to be "harmonious", which I think is
> more or less equivalent to "semantically orthogonal". Harmonious in the
> sense that I do my job and you do yours, and we don't step on each
> other's toes. But that's precisely what orthogonality is -- not
> overlapping.
>
> The full interview is here:
> http://www.artima.com/intv/ruby.html
>
> --bb
IMHO - in the C++ world - STL is a much better example of orthogonality.
e.g. the algorithms and containers are type independent.
So a sort algorithm for a vector containing ints can be the same as for
a vector containing chars.
roel
More information about the Digitalmars-d
mailing list