Archive for the ‘golamg’ Category

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.