Object and Attributes

What is Object?

Object consists of entity and attributes which can describe the state of real world object and action associated with that object.

Characteristics of Object

Some important characteristics of an object are:

1. Object name
  • The name is used to refer different objects in the program.
2. Object identifier
  • This is the system generated identifier which is assigned, when a new object is created.
3. Structure of object
  • Structure defines, how the object is constructed using constructor.
  • In object oriented database the state of complex object can be constructed from other objects by using certain type of constructor.
  • The formal way of representing objects as (i,c,v) where 'i' is object identifier, 'c' is type constructor and 'v' is current value of an object.
4. Transient object
  • In OOPL, objects which are present only at the time of execution are called as transient object.
  • For example: Variables in OOPL
5. Persistent objects
  • An object which exists even after the program is completely executed (or terminated), is called as persistent objects. Object-oriented databases can store objects in secondary memory.

Object identity

  • Every object has unique identity. In an object oriented system, when object is created OID is assigned to it.
  • In RDBMS OID is value based and primary key is used to provide uniqueness of each table in relation. Primary key is unique only for that relation and not for the entire system. Primary key is chosen from the attributes of the relation which makes object independent on the object state.
  • In OODBMS OID are variable name or pointer.

Properties of OID

1. Uniqueness: OID cannot be same to every object in the system and it is generated automatically by the system.
2. Invariant: OID cannot be changed throughout its entire lifetime.
3.Invisible: OID is not visible to user.

Attributes

Attributes are nothing but the properties of objects in the system.
Example: Employee can have attribute 'name' and 'address' with assigned values as:

AttributeValue
NameRadha
AddressPune
ID07

Type of Attributes

The three types of attributes are as follows:

1. Simple attributes
Attributes can be of primitive data type such as, integer, string, real etc. which can take literal value.
Example: 'ID' is simple attribute and value is 07.

2. Complex attributes
Attributes which consist of collections or reference of other multiple objects are called as complex attributes.
Example: Collection of Employees consists of many employee names.

3. Reference attributes
Attributes that represent a relationship between objects and consist of value or collection of values are called as reference attributes.
Example: Manager is reference of staff object.