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 ObjectSome important characteristics of an object are:
1. Object name
2. Object identifier
- The name is used to refer different objects in the program.
3. Structure of object
- This is the system generated identifier which is assigned, when a new object is created.
4. Transient 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.
5. Persistent objects
- In OOPL, objects which are present only at the time of execution are called as transient object.For example: Variables in OOPL
- 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.
- 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 OID1. Uniqueness:
OID cannot be same to every object in the system and it is generated automatically by the system.
OID cannot be changed throughout its entire lifetime.
OID is not visible to user.
Attributes are nothing but the properties of objects in the system.
Employee can have attribute 'name' and 'address' with assigned values as:
Type of AttributesThe 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.
'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.
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.
Manager is reference of staff object.