TITLE: a glossary of OO terminologies (Newsgroups: comp.object,comp.lang.c++, 17 Oct 98) THANATOS: <3627AC7F.15A36D79@biotrack.com> >Can any knowledgeable person please go into details regarding the >differences, similarities, relations and overlap between the following >terms: > >User Defined Type MARTIN: "Robert C. Martin" Exactly as it sounds. A type defined by the user. It could be as simple as a typedef or as complex as a class with lots of methods. >Abstract Data Type There is some debate about this. The definition I prefer is a class with nothing but pure virtual methods. i.e. a Java interface. [ The other definition I have seen is a class which has no parentage and is not intended to be derived from. These are usually basic building blocks like point, vector, etc. -adc ] >Polymorphic Type Any class that has at least one virtual function. Or in Java, any class with at least one non-final method. Or in Smalltalk any class, period. A polymorphic type is the definition of an interface. That interface can be used to control many different implementations, without the controller knowing which interface is being controlled. One simple example is the FILE datatype in UNIX. You can call open, close, read, and write on any file at all, and you never need to know what kind of file it is. It might be a disk file, a tape file, a socket, a terminal, etc... Another way of defining a polymorphic type is: A set of variables controlled by functions accessed through a jump table. >Concrete Data Type A class whose methods are all implemented. >Primitive Type A data type defined by the language you are using. e.g. int, double, float, char. >Meta Type The 'Type' of a 'Type'. In some language, classes are represented by objects called metaclasses. You can manipulate metaclasses as objects. >First Class Object The best I can tell, this is an ambiguous term sometimes used to define an entity that has no special constraints imposed upon it by the language. For example, in C++, an 'int' is not a first class object because you cannot derive from it. VANDEVOORDE: David Vandevoorde , (private email) > MARTIN: "Robert C. Martin" > > Exactly as it sounds. A type defined by the user. It could be > as simple as a typedef or as complex as a class with lots of > methods. In C and C++, typedefs do not really introduce new types; just new names for existing types. As a result, the type denoted by Int in: typedef int Int; is generally not considered a "user-defined type". Often, the term is meant to denote one of: (a) a struct or class, (b) a union, (c) an enum. (a) and (b) could be obtained by template instantiation. I've also seen writings that "forget" about (c); i.e., they use "user defined type" to denote class-like types only. Now, if X is a user-defined type, you could also say that: typedef X* Xptr; names another user-defined type. Similarly with: typedef void fX(X); However, this terminology is rarely applied. I've seen such types called "modified types" and (confusingly) "derived types". In standard lingo, there is a disinction between "fundamental types" (int, bool, double, ...), and "compound types"; the latter could be taken to be the widest definition of "user defined types", but as mentioned above, that is rarely done.