Archive for the ‘Orthogonality’ Category

h1

Consistency and Subtyping Orthogonality.

December 6, 2015

“Gradual typing can easily be integrated into the type system of an object-oriented language that already uses the subsumption rule to allow implicit up-casts with respect to subtyping. The main idea is that consistency and subtyping are orthogonal ideas that compose nicely.”

h1

Orthogonality III Functions, Objects and the Expression Problem.

June 29, 2014

“Object-oriented languages are good when you have a fixed set of operations on things, and as your code evolves, you primarily add new things. This can be accomplished by adding new classes which implement existing methods, and the existing classes are left alone.Functional languages are good when you have a fixed set of things, and as your code evolves, you primarily add new operations on existing things. This can be accomplished by adding new functions which compute with existing data types, and the existing functions are left alone.When evolution goes the wrong way, you have problems:Adding a new operation to an object-oriented program may require editing many class definitions to add a new method.Adding a new kind of thing to a functional program may require editing many function definitions to add a new case.”

h1

Orthogonality 2: Interfaces and Implementations, and the Question of what a Language is.

June 18, 2014

Prompted by a stack overflow questioner wondering whether Object and Class are orthogonal concepts. They’re not. What are orthogonal concepts are interface and implementation…indeed, allowing interface and implementation to vary independently, ie safe polymophism, is one of the aims of OOP.

One of my conclusions is that the OO languages most people are familiar with do not reveal the nature of OO clearly. The class-object system of C++, Java and smalltalk is a convience.. Classes define both interface and implementation, and allow re use of code through inheritance. It is convenient to have interface and implementation defined in the same place, since changes to interface generally require changes to implementation. The merging of interface and implementation has drawbacks too, such as causing unnecessary recompilation. The go programimg language is able to provide the bare bones of OO without classes.

My other conclusion is that people do not , but should. apply this desirable orthogonality to languages themselves. The language qua syntax is an interface to an engine that implements a compiler, interpret.er or whatever.