2 ms·
What does orthogonal mean as an adjective for a programming language? I've never heard that word outside of math and I always get excited by a word that might e
by seisvelas 7y ago
What does orthogonal mean as an adjective for a programming language? I've never heard that word outside of math and I always get excited by a word that might expand my ability to think about code.
- sorokod 7y agoNot the OP but guessing that in this context probably means independent of historical baggage.
- tomlu 7y agoEvery feature controls one "dimension" of a language, and can be freely combined with other features that control other "dimensions" without worrying about how they interact. I am quoting the word "dimension", because applying a precisely defined mathematics concept to something messier (like programming) will require a certain amount of hand waving and squinting.
- lone_haxx0r 7y agoImagine a programming language that gives you three different ways to add 2 numbers: 1 + 2; std::add(1, 2); std::int(1).add(std::int(2)); That's is not orthogonal at all, since we have 3 different ways to do the same thing for no discernible reason. An orthogonal interface is one where there are fewer reasonable ways to do something, and each function/operation has it's role clearly defined, it doesn't try to do things unrelated to its main role, and the interface doesn't mix different layers of abstraction (like intertwining OOP and arithmetic in my 3rd example, when there already are native arithmetic operations).
- gugagore 7y agoOne place where this shows in a fairly technical way is in discussing instruction sets: https://en.wikipedia.org/wiki/Orthogonal_instruction_set https://en.wikipedia.org/wiki/Orthogonal_instruction_set "In computer engineering, an orthogonal instruction set is an instruction set architecture where all instruction types can use all addressing modes. It is "orthogonal" in the sense that the instruction type and the addressing mode vary independently. An orthogonal instruction set does not impose a limitation that requires a certain instruction to use a specific register[1] so there is little overlapping of instruction functionality.[2]" Its use here is more general, but I hope the specific example helps.
- jejones3141 7y agoI first came across the notion of orthogonality for programming languages in Algol 68. Perhaps it's easiest to give examples of what it's not. At first in C you could only assign scalars; to assign a struct or union you had to call memcpy() or something like it. Eventually you could assign aggregates, but you still can't assign arrays unless you hide them in structs. It took a while before you could pass or return an aggregate. Exceptions of that sort are non-orthogonalities.
- shanemhansen 7y agoHonestly I think it's a silly word to use for features. In math orthogonal means roughly "at right angles" or "dot product equals zero". When two things are orthogonal it means that they are unrelated so you can deal with them independently which makes things simpler. In describing features orthogonal is basically jargon for unrelated and adds no additional clarity imo.
- peheje 7y agoYou don't want to write unrelated code, you want to write orthogonal code.
- peheje 7y agoI recommend the book: The pragmatic programmer. There's a section there explaining orthogonality by explaining a system that is not: a helicopter. That example sticks with me.
- paulddraper 7y agoOrthogonal means that aspect are independent of other aspects. I.e. you can understand one aspect of a programming language (memory allocation, generic programming, standard library, mutability, control flow, pattern matching, etc.) without understand every aspect. As a counterexample, if a language has generics, but only generics for a standard array type, that lacks orthogonality.