Intension, Extension, and Type Hierarchies
Learn about intension, extension, and type hierarchies.
We'll cover the following
Intension versus extension
The intension of an object type is given by the set of its features, this includes attributes, associations, constraints, and operations. The extension of an object type is the set of all objects that instantiate the object type. The extension of an object type is also called its population.
All features of a supertype are included in the intensions or feature sets, of its subtypes (intensional inclusion). All instances of a subtype are included in the extensions, or instance sets, of its supertypes (extensional inclusion).
Due to this duality intension and extension, we can specialize a given type in two different ways:
- We can extend the type’s intension. This can be done if we add features to the new subtype. For example, we can add the attribute
subjectArea
to the subtypeTextBook
. - We can restrict the type’s extension. This can be done if we add a constraint. For example, we can define a subtype
MathTextBook
as aTextBook
, where the attributesubjectArea
has the specific value “Mathematics”.
Typical OO programming languages, such as Java and C#, only support the first option. However, XML Schema and SQL99 support both options.
Type hierarchies
A type hierarchy (or class hierarchy) consists of two or more types, one of them is the root (or top-level) type, and all others which have at least one direct supertype. When all non-root types have a unique direct supertype, the type hierarchy is a single-inheritance hierarchy.
For instance, in the figure below, the class Vehicle
is the root of a single-inheritance hierarchy, while the next figure shows an example of a multiple-inheritance hierarchy. This is due to the fact that AmphibianVehicle has two direct superclasses: LandVehicle
and WaterVehicle
.
Get hands-on with 1400+ tech skills courses.