Database Reference
In-Depth Information
Objects and Classes
The notions of object and class are keys to the understanding of object-oriented tech-
nology. An object is a single thing, and a class represents a collection of things. From
this primitive definition, let us build up and review the notions in greater detail.
An Object An object is a single, uniquely identifiable entity that consists of attrib-
utes or characteristics that describe the state of the object in the real world, as well
as the actions or behavior associated with it. As noted, an object contains informa-
tion about its current state. An object also holds information about the actions that
can take place to change the current state of the object.
One or more attributes describe the current state of an object. The values of the
attributes determine the state of an object. If you modify the value of any of its
attributes, the object goes from one state to another. Attributes are also called
instance variables—relating to a single object instance.
Note the following concepts with regard to objects and attributes:
Simple attribute. A primitive type of attribute such as a string or integer that takes
a literal or numeric value.
Complex attribute. Contains a collection of objects or references to other objects.
Reference attribute. Refers to a relationship between objects.
Complex object. Contains one or more complex attributes
Object identifier (OID). A system-generated identifier for identifying an object
instance. An OID cannot be altered or reused; it does not depend on the state of
the object; it is transparent to the user.
Figure 20-2 presents an example of attributes for an instance of the EMPLOYEE
object. Note the different types of attributes and also determine why this is a
complex object.
Attributes or
representation
Type
Simple, primitive
EmployeeNumber
SocialSecurityNumber
EmployeeName
EmployeeAddress
EmployeePhone
Salary
DepartmentNumber
Simple, primitive
Simple, primitive
Simple, primitive
Simple, primitive
Simple, primitive
Reference (relationship with
DEPARTMENT object)
Project
Complex (collection of
PROJECT objects)
Figure 20-2
Attributes for employee instance.
Search WWH ::




Custom Search