Of types and classes
Jim writes: "I haven't seen a discussion of "type" in the OO stuff that involves any single meaning for the word."Mostly an OO language, any OO language, is an embodiment of somebody's preconceptions about "typing" in the broad sense - how "things" in the world are to be "classified". It's taken me years of having my brain beaten upon by postmodern texts, but I've finally grokked that there simply cannot be One Right Way of classifying things. So there cannot be a single meaning for the word "type".
In Java, the preconceptions that rule are that the labeling of types has more importance than the types themselves - that's the strong typing preconception. Hence interfaces. They are a way of saying, formally, "This is a set of methods that belong together" and "This class implements this predefined set of methods".
By contrast, in Smalltalk you don't spend much time predefining and looking up labels of types, making sure that a class belongs to a particular type, and so on. In Smalltalk "type" just means having certain expectations of classes that take part in some behaviour.
I remember that interfaces made a big impression on me when I started learning Java, presumably because of previous exposure to Eiffel. Now that I have also learned Smalltalk they're less of a big deal.
Between Java and Smalltalk I got exposed to LambdaMOO, which has some of the characteristics of Self : "class" isn't a concept at all in there, there is only "object". The notion of "type" there is closer to biology's - it's all about who's descended from whom.
one comment:
True enough, but . . .
For purposes of a given discussion it’s often necessary to agree on a particular use of a particular term. Classication schemes abound. Approaches to classifications schemes abound. In the context of building software to address a particular problem, or even a group of potential problems, it’s useful to agree on a definition of something like “type” if only a definition good enough for the conversation at hand.
The point isn’t the definition, but agreeing on a common one. The two critical skills here are the ability to recognize when an apparant disagreement in content is actually a lack of agreement about the working definition for a term, and to work with a definition that is “precise enough” for the conversation at hand.
James Bullock () - 06 09 03 - 03:48
No trackbacks:
Trackback link: